--- loncom/build/lpml_parse.pl 2002/10/13 17:27:49 1.51 +++ 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.51 2002/10/13 17:27:49 harris41 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,8 +385,10 @@ $parser->{textify}={ target => \&format_target, note => \&format_note, build => \&format_build, + installscript => \&format_installscript, status => \&format_status, dependencies => \&format_dependencies, + privatedependencies => \&format_privatedependencies, buildlink => \&format_buildlink, glob => \&format_glob, sourcedir => \&format_sourcedir, @@ -642,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 ''; } @@ -1217,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++; @@ -1236,6 +1241,9 @@ sub format_file { my (@deps)=split(/\;/,$dependencies); my $retval=join("\n",($source, (map {"$command$_"} @deps))); + if ($tokeninfo[2]{type} eq 'private') { + return "\n"; + } return $retval."\n"; } elsif ($mode eq 'html') { @@ -1290,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=@_; @@ -1618,12 +1645,24 @@ sub format_status { # ------------------------------------------------- Format dependencies section sub format_dependencies { my @tokeninfo=@_; - $dependencies=''; + #$dependencies=''; my $text=&trim($parser->get_text('/dependencies')); if ($text) { $parser->get_tag('/dependencies'); - $dependencies=join(';', - (map {s/^\s*//;s/\s$//;$_} split(/\;/,$text))); + $dependencies=join(';',((map {s/^\s*//;s/\s$//;$_} split(/\;/,$text)),$dependencies)); + $dependencies=~s/;$//; + } + return ''; +} +sub format_privatedependencies { + my @tokeninfo=@_; + #$dependencies=''; + my $text=&trim($parser->get_text('/privatedependencies')); + if ($text) { + $parser->get_tag('/privatedependencies'); + if ($mode eq 'MANIFEST') { return ''; } + $dependencies=join(';',((map {s/^\s*//;s/\s$//;$_} split(/\;/,$text)),$dependencies)); + $dependencies=~s/;$//; } return ''; }