--- loncom/build/lpml_parse.pl 2002/10/13 17:27:49 1.51 +++ loncom/build/lpml_parse.pl 2011/01/10 21:24:36 1.56 @@ -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.56 2011/01/10 21:24:36 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,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, @@ -528,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"; @@ -536,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 ''; @@ -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') { @@ -1258,7 +1266,8 @@ 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; @@ -1289,6 +1298,23 @@ END $buildtest.=<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 +1655,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 ''; }