From 586899149cca71a9df5c268e230211b2a7684501 Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 17 Jun 2008 17:13:10 +0000 Subject: Frank Loeffler's patch "Support for svn in 'make update' (2)" (http://www.cactuscode.org/old/pipermail/patches/2008-June/000242.html) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4494 17b73243-c579-4c4c-a9d2-2d5706c11dac --- Makefile | 33 +++++++++++++++++++++++++-------- lib/sbin/CVSUpdate.pl | 47 +++++++++++++++++++++++++++++++++-------------- lib/sbin/MakeUtils.pl | 10 +++++++++- 3 files changed, 67 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 846810d1..64f8f0fe 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ # # # @enddesc -# @version $Id: Makefile,v 1.175 2007-05-21 20:58:15 schnetter Exp $ +# @version $Id: Makefile,v 1.176 2008-06-17 17:13:10 tradke Exp $ # @@*/ ################################################################################## @@ -373,7 +373,7 @@ else @echo " -testsuite : run the test suites." @echo " -thornlist : regenerate the ThornList file." @echo " -ThornGuide : create the thorn manual for a specific configuration." - @echo " -cvsupdate : update the files for a specific configuration." + @echo " -update : update the files for a specific configuration from CVS and/or SVN." @echo " -examples : copy thorn parameter files to examples directory." endif @echo $(DIVIDER) @@ -392,7 +392,7 @@ endif @echo " cvsdiff - show differences between installed Cactus and" @echo " version in CVS repository." @echo " cvsstatus - report on status of Cactus (when installed from CVS)." - @echo " cvsupdate - update flesh and arrangements from CVS." + @echo " update - update flesh and arrangements from CVS and/or SVN." @echo " default - create a new configuration with a default name." @echo " distclean - delete all existing configurations." @echo " downsize - remove non-essential files." @@ -1192,20 +1192,32 @@ cvsstatus: # run cvsudpate on a configuration -.PHONY: cvsupdate +.PHONY: update cvsupdate: $(PERL) -s $(CCTK_HOME)/lib/sbin/CVSUpdate.pl arrangements +update: + $(PERL) -s $(CCTK_HOME)/lib/sbin/CVSUpdate.pl arrangements ifneq ($strip($(CONFIGURATIONS)),) .PHONY $(addsuffix -cvsupdate,$(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; \ + @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." + +$(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." @@ -1213,9 +1225,14 @@ endif %-cvsupdate: @echo $(DIVIDER) - @echo Configuration $(@:%-cvsupdate=%) does not exist. + @echo Configuration $(@:%-update=%) does not exist. @echo CVS Update aborted. +%-update: + @echo $(DIVIDER) + @echo Configuration $(@:%-update=%) does not exist. + @echo Update aborted. + .PHONY: cvsdiff cvsdiff: diff --git a/lib/sbin/CVSUpdate.pl b/lib/sbin/CVSUpdate.pl index 7ea82481..3341f6cd 100644 --- a/lib/sbin/CVSUpdate.pl +++ b/lib/sbin/CVSUpdate.pl @@ -11,18 +11,20 @@ my $cvs_ops="-z6 -q"; my $cvs_update_ops="-d -P"; +my $svn_ops=""; # 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"); +print("Updating Flesh\n"); $command = "cvs $cvs_ops update $cvs_update_ops $cvs_symbolic_name CONTRIBUTORS COPYRIGHT Makefile lib doc src arrangements/README"; if ($debug) { @@ -59,7 +61,7 @@ chomp ($home); $arrangement_dir = "$home/$arrangement_dir"; if ($thornlist =~ /^$/) { - %info = &buildthorns($arrangement_dir,"thorns"); + %info = &buildthorns($arrangement_dir,"thorns-to-update"); } else { %info = &ReadThornlist($thornlist); } @@ -76,7 +78,7 @@ foreach $thorn (sort keys %info) { chdir ("$arrangement_dir/$arrangement/doc") || die "Cannot change to arrangement directory '$arrangement_dir/$arrangement'\n"; - print("\nUpdating $arrangement\n"); + print("Updating arrangement $arrangement\n"); $command = "cvs $cvs_ops update $cvs_update_ops $cvs_symbolic_name"; if($debug) { @@ -106,30 +108,47 @@ foreach $thorn (sort keys %info) } } - if( ! -d "$arrangement_dir/$thorn/CVS") + if( -d "$arrangement_dir/$thorn/CVS") { - print "Ignoring $thorn - no CVS directory\n"; + $command = "cvs $cvs_ops update $cvs_update_ops $cvs_symbolic_name"; + } + if( -d "$arrangement_dir/$thorn/.svn") + { + $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"; + print("Updating thorn $thorn\n"); 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, ") + foreach $file (`ls CVS`) { - print; + chop($file); + print "Contents of $file\n"; + open (FILE, ") + { + print; + } } } } diff --git a/lib/sbin/MakeUtils.pl b/lib/sbin/MakeUtils.pl index 6dd9fdd6..905fb210 100644 --- a/lib/sbin/MakeUtils.pl +++ b/lib/sbin/MakeUtils.pl @@ -102,7 +102,15 @@ sub buildthorns { foreach $thorn (@total_list) { - if( -r "$thorn/interface.ccl" && -r "$thorn/param.ccl") + # don't check for {interface,param}.ccl files + # when compiling a list of thorns to be updated + if( $choice eq 'thorns-to-update' ) + { + # include this thorn with no further thorn info + # (only the keys are needed by the calling routine) + $info{$thorn} = 1; + } + elsif ( -r "$thorn/interface.ccl" && -r "$thorn/param.ccl") { $info{$thorn} = &ThornInfo($thorn); } -- cgit v1.2.3