(file) Return to jsoc_sync.pl CVS log (file) (dir) Up to [Development] / JSOC

  1 arta  1.1 #!/usr/bin/perl -w 
  2           
  3           # script for synchronizing your CVS working directory with the CVS JSOC module (new tree)
  4           
  5           # must run from root of JSOC tree (not necessarily from $JSOCROOT)
  6           
  7           # run this on each machine to be used.
  8           #    n02 - for linux_X86_64 machines
  9           #    n00 - for linux4 machines such as n00, phil, etc.
 10           # 
 11           #    n12 formerly used for AMD x86-64 can also be used instead of n02
 12           #    lws Itaniam processors no longer supported for JSOC
 13           
 14 arta  1.6 # This just in:
 15           #   The cvs update "-d" flag will cause files outside of the CVS module
 16           #   originally checked out to be downloaded.  This is bad, because
 17           #   if a user checks out DRMS, then does a 'cvs update -d .', the
 18           #   user then has the JSOC-module files in their working directory.
 19           #   BUT, as long as the "-d" flag is not used, cvs update respects
 20           #   boundaries of the module originally checked out: so 'cvs checkout DRMS'
 21           #   followed by 'cvs update DRMS' will not result in any new files being 
 22           #   downloaded that are outside of the DRMS module.  But new files
 23           #   within the DRMS module WILL be downloaded.
 24           #
 25           #   So, this script should use 'cvs update' not 'cvs checkout'.  checkout
 26           #   doesn't know how to remove files from the working directory that
 27           #   have been deleted from the repository.  Since this script uses
 28           #   'cvs update', there is no need to look at the 'modulespec.txt' file.
 29 arta  1.7 #
 30           #   This just in.  If a cvs user adds a new directory to the repository, 
 31           #   then the only way to get that new directory is to use the "-d" flag.
 32           #   But we can't use the "-d" flag because this causes files outside of the
 33           #   CVS module to be downloaded.  To work around the preposterous lameness of CVS
 34           #   first call cvs update (no "-d" flag), then call cvs checkout.  The first call
 35           #   will add/remove/update all files that are already in the user's 
 36           #   working directory.  The second call will add files WITHIN THE CORRECT CVS 
 37           #   MODULE that the user doesn't have.
 38 arta  1.6 
 39 arta  1.1 $LATESTREL = "Ver_LATEST";
 40           $CVSLOG = "cvsupdate.log";
 41           
 42           my($aidx) = 0;
 43           my($arg);
 44 arta  1.2 my($pos);
 45 arta  1.1 my($rev) = "";
 46           my($line);
 47 arta  1.7 my($cvsmod);
 48 arta  1.1 
 49           while ($arg = shift(@ARGV))
 50           {
 51 arta  1.2     if ($arg eq "-R")
 52 arta  1.1     {
 53           	$rev = "-r $LATESTREL";
 54               }
 55 arta  1.2     elsif (($pos = index($arg, "-l", 0)) == 0)
 56               {
 57           	$CVSLOG = substr($arg, 2);
 58               }
 59 arta  1.1 
 60               $aidx++;
 61           }
 62           
 63 arta  1.7 if (-e "suflag.txt")
 64           {
 65               $cvsmod = "JSOC";
 66           }
 67           else
 68           {
 69               $cvsmod = "DRMS";
 70           }
 71           
 72 arta  1.1 # remove old log file
 73           if (-e $CVSLOG)
 74           {
 75               unlink $CVSLOG;
 76           }
 77           
 78 arta  1.6 CallCVS($rev);
 79 arta  1.1 
 80           print "JSOC synchronization finished.\n";
 81           
 82           sub CallCVS
 83           {
 84 arta  1.6     my($rev) = @_;
 85 arta  1.1     my($updatecmd);
 86 arta  1.7     my($checkoutcmd);
 87               my($date);
 88 arta  1.1 
 89 arta  1.6     $updatecmd = "cvs update -AP $rev \.";
 90 arta  1.7     $checkoutcmd = "cvs checkout -AP $rev $cvsmod";
 91 arta  1.1 
 92               #Things that didn't really work:
 93               #$updatecmd = "(cd ..; $updatecmd | sed 's/^/STDOUT:/') 2>&1 |";
 94               #$updatecmd = "(cd $parent; $updatecmd) |";
 95           
 96 arta  1.7     $date = `"date"`;
 97           
 98               open(CVSLOG, ">>$CVSLOG");
 99               print CVSLOG "$date\n";
100               print CVSLOG "Calling '$updatecmd'.\n";
101               close(CVSLOG);
102 arta  1.6     $updatecmd = "($updatecmd) 1>>$CVSLOG 2>&1";
103 arta  1.1     print "Calling '$updatecmd'.\n";
104               system($updatecmd);
105 arta  1.7 
106               open(CVSLOG, ">>$CVSLOG");
107               print CVSLOG "Calling '$checkoutcmd'.\n";
108               close(CVSLOG);
109 arta  1.8     $checkoutcmd = "(cd ..; $checkoutcmd) 1>>$CVSLOG 2>&1";
110 arta  1.7     print "Calling '$checkoutcmd'.\n";
111               system($checkoutcmd);
112 arta  1.1 }

Karen Tian
Powered by
ViewCVS 0.9.4