--- loncom/build/lpml_parse.pl 2007/01/25 22:54:25 1.54 +++ loncom/build/lpml_parse.pl 2014/06/09 05:14:12 1.61 @@ -12,7 +12,7 @@ # The LearningOnline Network with CAPA # lpml_parse.pl - Linux Packaging Markup Language parser # -# $Id: lpml_parse.pl,v 1.54 2007/01/25 22:54:25 raeburn Exp $ +# $Id: lpml_parse.pl,v 1.61 2014/06/09 05:14:12 raeburn Exp $ # # Written by Scott Harrison, codeharrison@yahoo.com # @@ -86,6 +86,7 @@ Usage is for lpml file to come in throug 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 @@ END # ------------------------------------------------- Grab command line arguments my $mode=''; -if (@ARGV==5) { +if (@ARGV == 6 || @ARGV == 5) { $mode = shift @ARGV; } else { @@ -135,6 +136,11 @@ $targetroot=~s/\/$//; # remove trailing $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 @@ if ($mode eq 'install' or $mode eq 'conf # 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 @@ sub format_files { $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"; @@ -1223,6 +1230,7 @@ sub format_file { my @tokeninfo=@_; $file=''; $source=''; $target=''; $categoryname=''; $description=''; $note=''; $build=''; $status=''; $dependencies=''; $installscript=''; + $buildlink = ''; my $text=&trim($parser->get_text('/file')); my $buildtest; $file_count++; @@ -1266,14 +1274,15 @@ sub format_file { # "$build $status $dependencies" . # "\nEND FILE"); } - elsif ($mode eq 'install' && $categoryname ne 'conf') { + elsif (($mode eq 'install') && (($categoryname ne 'conf') && + ($categoryname ne 'www conf'))) { if ($build) { my $bi=$sourceroot.'/'.$source.';'.$build.';'. $dependencies; 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.=<get_text('/buildlink')); if ($text) { $parser->get_tag('/buildlink'); $buildlink=$sourceroot.'/'.$text; + } else { + $buildlink=''; } return ''; } @@ -1645,12 +1687,13 @@ sub format_status { # ------------------------------------------------- Format dependencies section sub format_dependencies { my @tokeninfo=@_; - #$dependencies=''; my $text=&trim($parser->get_text('/dependencies')); if ($text) { $parser->get_tag('/dependencies'); $dependencies=join(';',((map {s/^\s*//;s/\s$//;$_} split(/\;/,$text)),$dependencies)); $dependencies=~s/;$//; + } else { + $dependencies=''; } return ''; }