[LON-CAPA-cvs] cvs: loncom /build Makefile lpml_parse.pl

raeburn raeburn@source.lon-capa.org
Fri, 25 Mar 2011 22:55:06 -0000


raeburn		Fri Mar 25 22:55:06 2011 EDT

  Modified files:              
    /loncom/build	lpml_parse.pl Makefile 
  Log:
  - system shell can be passed to lpml_parse.pl as an optional 6th arg.
  - shell to be used for "make build" needs to be /bin/bash 
    (to avoid errors when running tthperl/commands, e.g., with /bin/dash in Debian 6. 
  
  
Index: loncom/build/lpml_parse.pl
diff -u loncom/build/lpml_parse.pl:1.56 loncom/build/lpml_parse.pl:1.57
--- loncom/build/lpml_parse.pl:1.56	Mon Jan 10 21:24:36 2011
+++ loncom/build/lpml_parse.pl	Fri Mar 25 22:55:06 2011
@@ -12,7 +12,7 @@
 # The LearningOnline Network with CAPA
 # lpml_parse.pl - Linux Packaging Markup Language parser
 #
-# $Id: lpml_parse.pl,v 1.56 2011/01/10 21:24:36 raeburn Exp $
+# $Id: lpml_parse.pl,v 1.57 2011/03/25 22:55:06 raeburn Exp $
 #
 # Written by Scott Harrison, codeharrison@yahoo.com
 #
@@ -86,6 +86,7 @@
     typical choices: default,redhat6.2,debian2.2,redhat7
 4th argument is to manually specify a sourceroot.
 5th argument is to manually specify a targetroot.
+6th argument is to manually specify a shell.
 
 Only the 1st argument is mandatory for the program to run.
 
@@ -100,7 +101,7 @@
 # ------------------------------------------------- Grab command line arguments
 
 my $mode='';
-if (@ARGV==5) {
+if (@ARGV == 6 || @ARGV == 5) {
     $mode = shift @ARGV;
 }
 else {
@@ -135,6 +136,11 @@
 $sourcerootarg=$sourceroot;
 $targetrootarg=$targetroot;
 
+my $shell = 'sh';
+if (@ARGV) {
+    $shell = shift @ARGV;
+}
+
 my $logcmd='| tee -a WARNINGS';
 
 my $invocation; # Record how the program was invoked
@@ -147,6 +153,7 @@
 #             3rd argument (distribution) is: $dist
 #             4th argument (sourceroot) is: described below
 #             5th argument (targetroot) is: described below
+#             6th argument (shell) is: $shell	
 END
 }
 
@@ -1151,11 +1158,11 @@
 	    $tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
 	    if ($command!~/\s/) {
 		$command=~s/\/([^\/]*)$//;
-		$command2="cd $command; sh ./$1;\\";
+		$command2="cd $command; $shell ./$1;\\";
 	    }
 	    else {
 		$command=~s/(.*?\/)([^\/]+\s+.*)$/$1/;
-		$command2="cd $command; sh ./$2;\\";
+		$command2="cd $command; $shell ./$2;\\";
 	    }
 	    my $depstring;
 	    my $depstring2="\t\t\@echo '';\\\n";
@@ -1274,7 +1281,7 @@
 		my ($source2,$command,$trigger,@deps)=split(/\;/,$bi);
 		$tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
 		$command=~s/\/([^\/]*)$//;
-		$command2="cd $command; sh ./$1;\\";
+		$command2="cd $command; $shell ./$1;\\";
 		my $depstring;
 		foreach my $dep (@deps) {
 		    $depstring.=<<END;
@@ -1303,7 +1310,7 @@
 		my $dir = $sourceroot.'/'.$source;
 		$dir =~ s|/([^/]*)$||;
 		my $result =" 
-$buildtest	cd $dir ; sh $installscript";
+$buildtest	cd $dir ; $shell $installscript";
 		if ($categoryname 
 		    && exists($categoryhash{"chmod.$categoryname"}) ) {
 		    $result .="\\\n";
Index: loncom/build/Makefile
diff -u loncom/build/Makefile:1.196 loncom/build/Makefile:1.197
--- loncom/build/Makefile:1.196	Thu Mar 24 02:04:46 2011
+++ loncom/build/Makefile	Fri Mar 25 22:55:06 2011
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 
-# $Id: Makefile,v 1.196 2011/03/24 02:04:46 raeburn Exp $
+# $Id: Makefile,v 1.197 2011/03/25 22:55:06 raeburn Exp $
 
 # TYPICAL USAGE of this Makefile is primarily for two targets:
 # "make build" and "make install".
@@ -13,6 +13,10 @@
 CATEGORY="development"
 SOURCE=../..
 TARGET=""
+CURRSHELL=`echo $(SHELL)`
+ifneq ('/bin/bash',${CURRSHELL})
+CURRSHELL=/bin/bash
+endif
 NORESTORECONF="0"
 HOSTNAME=""
 LAUNCH=| perl
@@ -593,7 +597,7 @@
 Makefile.build: $(SOURCE)/doc/loncapafiles/loncapafiles.lpml lpml_parse.pl
 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \
 	perl lpml_parse.pl build $(CATEGORY) $(DIST) "$(SOURCE)" "$(TARGET)" \
-	> Makefile.build
+	"$(CURRSHELL)" > Makefile.build
 
 Makefile.install: alwaysrun
 	cat $(SOURCE)/doc/loncapafiles/loncapafiles.lpml | \