/[CCFs]/bin/checkupdates
ViewVC logotype

Annotation of /bin/checkupdates

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Mar 19 15:36:00 2002 UTC (22 years, 8 months ago) by ccflib
Branch: MAIN
Changes since 1.1: +5 -1 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.27