/[CCFs]/bin/checkupdates
ViewVC logotype

Diff of /bin/checkupdates

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by ccflib, Tue Dec 2 16:01:07 2014 UTC revision 1.6 by ccflib, Fri Dec 19 14:39:16 2014 UTC
# Line 1  Line 1 
1  #! /usr/local/bin/perl -w  #! /usr/local/bin/perl -w
2  #  #
3    # $Id: checkupdates,v 1.5 2014/12/02 16:01:07 ccflib Exp $
4  #  #
5  # $Id: checkupdates,v 1.4 2005/12/07 14:48:46 ccflib Exp $  # Called in a directory containing CCF constituents (*.CCF). It checks
 #  
 # Called in a directory containing CCF constituents (*.CCF). It cheks  
6  # via the DBM .ccf.db if any CCF constituent has appeared or  # via the DBM .ccf.db if any CCF constituent has appeared or
7  # disappeared, and launches the notification script with the  # disappeared, and launches the notification script with the
8  # appropriate options.  # appropriate options.
# Line 11  Line 10 
10  # It needs to be told what type of CCF directory it is via the -t  # It needs to be told what type of CCF directory it is via the -t
11  # development|release|public flag.  # development|release|public flag.
12  #  #
13    # Required Ccflib.pm which defines directories in xvsoc01
14    # but it looks like have never been used. Commented out.
15    #
16    
17  require 5;  require 5;
18  use strict;  use strict;
19  use lib "$ENV{'HOME'}/cgi";  #use lib "$ENV{'HOME'}/bin";
20  $ENV{'PATH'} .= "$ENV{'HOME'}/bin:";  $ENV{'PATH'} .= "$ENV{'HOME'}/bin:";
21  use Ccflib;  #use Ccflib;
22    #use Ccflib_int;
23  use DB_File;  use DB_File;
24  use Getopt::Std;  use Getopt::Std;
25    
# Line 23  my %opts; Line 27  my %opts;
27  getopts('t:', \%opts);  getopts('t:', \%opts);
28  die("Usage: -t development|release|public\n") if(not exists $opts{'t'});  die("Usage: -t development|release|public\n") if(not exists $opts{'t'});
29    
30    # This constructs makes available in %ccf all the CCFs that have been stored i
31    # so far in .ccf.db as keys and '+'as values, e.g {XRT3_XPSF_0016.CCF, '+"}.
32  my %ccf;  my %ccf;
33  tie %ccf, "DB_File", ".ccf.db";  tie %ccf, "DB_File", ".ccf.db";
34    
35    # @present will list all the CCFs that are now present in the selected directory.
36    # Among them there will be some that were already processed and have been recorded in
37    # the .ccf.db file within that particular directory and perhaps some new.
38    # Those that were processed already appear in keys of %ccf as CCF already known.
39    # Therefore any CCF in the directory not listed in the keys of %ccf is new and should be
40    # put in @new.
41    # Let us remove all '+' in %ccf. Now we go through all in @present. For each CCF found there
42    # if the CCF is not in keys of %, then it is a new CCF and we push it to @new.
43    # Finally, for each CCF present, including new ones, we put a '+" in the values of %ccf
44    # just to mark them as present, so all the rest are gone and should go to @gone.
45    
46  my @new;  my @new;
47  my @gone;  my @gone;
48  my @present = glob("*.CCF");  my @present = glob("*.CCF");
# Line 48  foreach(keys %ccf){ Line 65  foreach(keys %ccf){
65    }    }
66  }  }
67    
68    # Those CCF that are new, must be processed with ccfextseq to set the submission date
69    # as of today. Then a notification is sent via the ccfnotify external perl script.
70    
71  if(@new){  if(@new){
72    my $cmd1 = "ccfextseq --sets='";    my $cmd1 = "ccfextseq --sets='";
73    my $cmd2 = "ccfnotify -t $opts{'t'} ";    my $cmd2 = "ccfnotify -t $opts{'t'} ";
# Line 65  if(@new){ Line 85  if(@new){
85    execute($cmd2);    execute($cmd2);
86    
87    # update the MIF if there are new files in the public area.    # update the MIF if there are new files in the public area.
88      # The MIF or Master Index File is a CALINDEX file created as new,
89      # but only if the repository is the public one.
90    
91    my $cmd3 = "updatemif";    my $cmd3 = "updatemif";
92    if($opts{'t'} eq 'public'){    if($opts{'t'} eq 'public'){
93      print "Creating a new MIF:\n";      print "Creating a new MIF:\n";
# Line 72  if(@new){ Line 95  if(@new){
95    }    }
96  }  }
97    
98    # Notify also on those CCF removed from any directory being tracked.
99    
100  if(@gone){  if(@gone){
101    my $cmd = "ccfnotify -t $opts{'t'} -d ";    my $cmd = "ccfnotify -t $opts{'t'} -d ";
102    foreach(@gone){    foreach(@gone){

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.27