[Patches] Subversion support for 'make <cvs|svn|>update'

Frank Loeffler frank.loeffler at aei.mpg.de
Fri Sep 28 18:26:15 CDT 2007


Hi,

this patch adds Subversion support for the Makefile in the following
way:

make cvsupdate
  will continue to do what it did in the past: updating Cactus
  and thorns which are in CVS

new:
make svnupdate
  will update thorns which are in Subversion

make update
  will update thorns that are either in CVS or Subversion

Frank
-------------- next part --------------
? arrangements/Whisky
Index: Makefile
===================================================================
RCS file: /cactusdevcvs/Cactus/Makefile,v
retrieving revision 1.175
diff -u -r1.175 Makefile
--- Makefile	21 May 2007 20:58:15 -0000	1.175
+++ Makefile	28 Sep 2007 23:24:24 -0000
@@ -1195,17 +1195,41 @@
 .PHONY: cvsupdate
 
 cvsupdate:
+	$(PERL) -s $(CCTK_HOME)/lib/sbin/CVSUpdate.pl only_CVS:arrangements
+svnupdate:
+	$(PERL) -s $(CCTK_HOME)/lib/sbin/CVSUpdate.pl only_SVN:arrangements
+update:
 	$(PERL) -s $(CCTK_HOME)/lib/sbin/CVSUpdate.pl arrangements
 
 
 ifneq ($strip($(CONFIGURATIONS)),)
 .PHONY $(addsuffix -cvsupdate,$(CONFIGURATIONS)):
+.PHONY $(addsuffix -svnupdate,$(CONFIGURATIONS)):
+.PHONY $(addsuffix -update,$(CONFIGURATIONS)):
 
 $(addsuffix -cvsupdate,$(CONFIGURATIONS)):
 	@echo $(DIVIDER)
 	@echo Updating files for configuration $(@:%-cvsupdate=%)
 	if test -r $(CONFIGS_DIR)/$(@:%-cvsupdate=%)/ThornList ; then \
-          $(PERL) -s lib/sbin/CVSUpdate.pl arrangements $(CONFIGS_DIR)/$(@:%-cvsupdate=%)/ThornList; \
+          $(PERL) -s lib/sbin/CVSUpdate.pl only_CVS:arrangements $(CONFIGS_DIR)/$(@:%-cvsupdate=%)/ThornList; \
+          cd $(CCTK_HOME);   \
+        fi
+	@echo " Done."
+
+$(addsuffix -svnupdate,$(CONFIGURATIONS)):
+	@echo $(DIVIDER)
+	@echo Updating files for configuration $(@:%-svnupdate=%)
+	if test -r $(CONFIGS_DIR)/$(@:%-svnupdate=%)/ThornList ; then \
+          $(PERL) -s lib/sbin/CVSUpdate.pl only_SVN:arrangements $(CONFIGS_DIR)/$(@:%-svnupdate=%)/ThornList; \
+          cd $(CCTK_HOME);   \
+        fi
+	@echo " Done."
+
+$(addsuffix -update,$(CONFIGURATIONS)):
+	@echo $(DIVIDER)
+	@echo Updating files for configuration $(@:%-update=%)
+	if test -r $(CONFIGS_DIR)/$(@:%-update=%)/ThornList ; then \
+          $(PERL) -s lib/sbin/CVSUpdate.pl arrangements $(CONFIGS_DIR)/$(@:%-update=%)/ThornList; \
           cd $(CCTK_HOME);   \
         fi
 	@echo " Done."
@@ -1216,6 +1240,16 @@
 	@echo Configuration $(@:%-cvsupdate=%) does not exist.
 	@echo CVS Update aborted.
 
+%-svnupdate:
+	@echo $(DIVIDER)
+	@echo Configuration $(@:%-svnupdate=%) does not exist.
+	@echo Subversion Update aborted.
+
+%-update:
+	@echo $(DIVIDER)
+	@echo Configuration $(@:%-update=%) does not exist.
+	@echo Update aborted.
+
 .PHONY: cvsdiff
 
 cvsdiff:
Index: lib/sbin/CVSUpdate.pl
===================================================================
RCS file: /cactusdevcvs/Cactus/lib/sbin/CVSUpdate.pl,v
retrieving revision 1.14
diff -u -r1.14 CVSUpdate.pl
--- lib/sbin/CVSUpdate.pl	11 May 2004 00:11:25 -0000	1.14
+++ lib/sbin/CVSUpdate.pl	28 Sep 2007 23:24:24 -0000
@@ -11,15 +11,17 @@
 
 my $cvs_ops="-z6 -q";
 my $cvs_update_ops="-d -P";
+my $svn_ops="-q";
 # Set this to eg -r TAGNAME checkout from a TAG
 my $cvs_symbolic_name="";
+my $svn_symbolic_name="";
 
 require "lib/sbin/MakeUtils.pl";
 
 $debug = 0;
 if ($debug)
 {
-  print "DEBUG mode: cvs commands not issued\n\n";
+  print "DEBUG mode: cvs/svn commands not issued\n\n";
 }
 
 print("\nUpdating Flesh\n");
@@ -56,6 +58,17 @@
 
 ($arrangement_dir, $thornlist) = @ARGV;
 
+if ($arrangement_dir =~ /only_CVS:(.*)/)
+{
+  $only_CVS = "yes";
+  $arrangement_dir = $1;
+}
+if ($arrangement_dir =~ /only_SVN:(.*)/)
+{
+  $only_SVN = "yes";
+  $arrangement_dir = $1;
+}
+
 $arrangement_dir = "$home/$arrangement_dir";
 
 if ($thornlist =~ /^$/) {
@@ -108,28 +121,61 @@
 
   if( ! -d "$arrangement_dir/$thorn/CVS")
   {
-    print "Ignoring $thorn - no CVS directory\n";
+    if ($only_CVS =~ /yes/)
+    {
+      print "Ignoring $thorn - no CVS directory\n";
+      next;
+    }
+  }
+  else
+  {
+    $command = "cvs $cvs_ops update $cvs_update_ops $cvs_symbolic_name";
+  }
+  if( ! -d "$arrangement_dir/$thorn/.svn")
+  {
+    if ($only_SVN =~ /yes/)
+    {
+      print "Ignoring $thorn - no .svn directory\n";
+      next;
+    }
+  }
+  else
+  {
+    $command = "svn $svn_ops update $svn_symbolic_name";
+  }
+  if ( ! -d "$arrangement_dir/$thorn/CVS" &&
+       ! -d "$arrangement_dir/$thorn/.svn" )
+  {
+    print "Ignoring $thorn - no CVS or .svn directory\n";
+    next;
+  }
+  if ( -d "$arrangement_dir/$thorn/CVS" &&
+       -d "$arrangement_dir/$thorn/.svn" )
+  {
+    print "Ignoring $thorn - both CVS and .svn directory\n";
     next;
   }
 
   chdir ("$arrangement_dir/$thorn") ||
     die "Cannot change to thorn directory '$arrangement_dir/$thorn'\n";
   print("\nUpdating $thorn\n");
-  $command = "cvs $cvs_ops update $cvs_update_ops $cvs_symbolic_name";
   if($debug)
   {
     $this_dir = `pwd`;
     chop($this_dir);
     print "In directory $this_dir\n";
     print "Issuing command\n  $command\n";
-    foreach $file (`ls CVS`)
+    if ( -d "$arrangement_dir/$thorn/CVS" )
     {
-      chop($file);
-      print "Contents of $file\n";
-      open (FILE, "<CVS/$file") || die "Could not open CVS file";
-      while (<FILE>)
+      foreach $file (`ls CVS`)
       {
-        print;
+        chop($file);
+        print "Contents of $file\n";
+        open (FILE, "<CVS/$file") || die "Could not open CVS file";
+        while (<FILE>)
+        {
+          print;
+        }
       }
     }
   }


More information about the Patches mailing list