--- loncom/build/lpml_parse.pl 2003/09/11 22:01:48 1.52 +++ loncom/build/lpml_parse.pl 2005/12/09 20:41:35 1.53 @@ -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.53 2005/12/09 20:41:35 albertel 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, @@ -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=@_;