--- loncom/build/lpml_parse.pl 2003/09/11 22:01:48 1.52 +++ loncom/build/lpml_parse.pl 2007/01/25 22:54:25 1.54 @@ -12,7 +12,7 @@ # The LearningOnline Network with CAPA # lpml_parse.pl - Linux Packaging Markup Language parser # -# $Id: lpml_parse.pl,v 1.52 2003/09/11 22:01:48 albertel Exp $ +# $Id: lpml_parse.pl,v 1.54 2007/01/25 22:54:25 raeburn Exp $ # # Written by Scott Harrison, codeharrison@yahoo.com # @@ -313,6 +313,7 @@ my $targets; my $target; my $source; my $note; +my $installscript; my $build; my $buildlink; my $commands; @@ -384,6 +385,7 @@ $parser->{textify}={ target => \&format_target, note => \&format_note, build => \&format_build, + installscript => \&format_installscript, status => \&format_status, dependencies => \&format_dependencies, privatedependencies => \&format_privatedependencies, @@ -529,7 +531,7 @@ END print ' by Scott Harrison 2001'."\n"; print '# This file was automatically generated on '.`date`; print "\n".$invocation; - $lpml .= "SHELL=\"/bin/bash\"\n\n"; + $lpml .= "\n"; } elsif ($mode eq 'configinstall') { print '# LPML configuration file targets (configinstall).'."\n"; @@ -537,14 +539,14 @@ END print ' by Scott Harrison 2001'."\n"; print '# This file was automatically generated on '.`date`; print "\n".$invocation; - $lpml .= "SHELL=\"/bin/bash\"\n\n"; + $lpml .= "\n"; } elsif ($mode eq 'build') { $lpml = "# LPML build targets. Linux Packaging Markup Language,"; $lpml .= ' by Scott Harrison 2001'."\n"; $lpml .= '# This file was automatically generated on '.`date`; $lpml .= "\n".$invocation; - $lpml .= "SHELL=\"/bin/sh\"\n\n"; + $lpml .= "\n"; } else { return ''; @@ -643,6 +645,8 @@ sub format_category { my ($user,$group)=split(/\:/,$chown); $categoryhash{$category_att_name}='-o '.$user.' -g '.$group. ' -m '.$chmod; + $categoryhash{"chmod.".$category_att_name}=$chmod; + $categoryhash{"chown.".$category_att_name}=$chown; } return ''; } @@ -1218,7 +1222,7 @@ sub format_links { sub format_file { my @tokeninfo=@_; $file=''; $source=''; $target=''; $categoryname=''; $description=''; - $note=''; $build=''; $status=''; $dependencies=''; + $note=''; $build=''; $status=''; $dependencies=''; $installscript=''; my $text=&trim($parser->get_text('/file')); my $buildtest; $file_count++; @@ -1294,6 +1298,15 @@ END fi END } + if ($installscript) { + my $dir = $sourceroot.'/'.$source; + $dir =~ s|/([^/]*)$||; + return <<"END"; +$buildtest cd $dir ; sh $installscript\\ + chmod -R $categoryhash{chmod.$categoryname} ${targetroot}/${target} \\ + chown -R $categoryhash{chown.$categoryname} ${targetroot}/${target} \\ +END + } my $bflag='-b1'; $bflag='-b3' if $dependencies or $buildlink; return <get_text('/installscript')); + if ($installscript) { + $parser->get_tag('/installscript'); + $installscript=~s/([^\\])\\\s+/$1/g; # allow for lines split onto new lines + } + return ''; +} # -------------------------------------------------------- Format build section sub format_buildlink { my @tokeninfo=@_;