/[CCFs]/bin/checkupdates
ViewVC logotype

Contents of /bin/checkupdates

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Tue Dec 2 16:01:07 2014 UTC (9 years, 11 months ago) by ccflib
Branch: MAIN
Changes since 1.4: +2 -3 lines
OK for sasbld01

1 #! /usr/local/bin/perl -w
2 #
3 #
4 # $Id: checkupdates,v 1.4 2005/12/07 14:48:46 ccflib Exp $
5 #
6 # Called in a directory containing CCF constituents (*.CCF). It cheks
7 # via the DBM .ccf.db if any CCF constituent has appeared or
8 # disappeared, and launches the notification script with the
9 # appropriate options.
10 #
11 # It needs to be told what type of CCF directory it is via the -t
12 # development|release|public flag.
13 #
14 require 5;
15 use strict;
16 use lib "$ENV{'HOME'}/cgi";
17 $ENV{'PATH'} .= "$ENV{'HOME'}/bin:";
18 use Ccflib;
19 use DB_File;
20 use Getopt::Std;
21
22 my %opts;
23 getopts('t:', \%opts);
24 die("Usage: -t development|release|public\n") if(not exists $opts{'t'});
25
26 my %ccf;
27 tie %ccf, "DB_File", ".ccf.db";
28
29 my @new;
30 my @gone;
31 my @present = glob("*.CCF");
32
33 print "Checking for new CCF constituents in track: $opts{'t'}\n";
34
35 foreach(keys %ccf) { $ccf{$_} = ""; }
36 foreach(@present){
37 # CALINDEX constituents are not considered.
38 next if /XMM_CALINDEX/;
39 push @new, ($_) if not exists $ccf{$_};
40 $ccf{$_} = '+';
41 }
42 foreach(keys %ccf){
43 if($ccf{$_} ne '+'){
44 # CALINDEX consituents are not considered.
45 next if /XMM_CALINDEX/;
46 push @gone, ($_);
47 delete $ccf{$_};
48 }
49 }
50
51 if(@new){
52 my $cmd1 = "ccfextseq --sets='";
53 my $cmd2 = "ccfnotify -t $opts{'t'} ";
54 my $l;
55 foreach(@new){
56 print "New constituent: $_\n";
57 $l .= "$_ ";
58 }
59 $cmd1 .= "$l'";
60 $cmd2 .= $l;
61
62 print "Running ccfextseq to update the SUBMISSION date:\n";
63 execute($cmd1);
64 print "Notification:\n";
65 execute($cmd2);
66
67 # update the MIF if there are new files in the public area.
68 my $cmd3 = "updatemif";
69 if($opts{'t'} eq 'public'){
70 print "Creating a new MIF:\n";
71 execute($cmd3);
72 }
73 }
74
75 if(@gone){
76 my $cmd = "ccfnotify -t $opts{'t'} -d ";
77 foreach(@gone){
78 print "Gone constituent: $_\n";
79 $cmd .= "$_ ";
80 }
81 if($opts{'t'} ne 'public'){
82 print "Notification:\n";
83 execute($cmd);
84 }
85 }
86
87 sub execute {
88 my $cmd = shift or return;
89 print "Executing: $cmd\n";
90 qx/$cmd/;
91 my $status = $? >> 8;
92 die("$cmd failed\n") if $status;
93 return;
94 }

  ViewVC Help
Powered by ViewVC 1.1.27