--- loncom/build/lpml_parse.pl 2001/11/05 02:57:21 1.14 +++ loncom/build/lpml_parse.pl 2001/12/01 16:51:07 1.25 @@ -6,7 +6,10 @@ # 06/19/2001,06/20,06/24 - Scott Harrison # 9/5/2001,9/6,9/7,9/8 - Scott Harrison # 9/17,9/18 - Scott Harrison -# 11/4 - Scott Harrison +# 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison +# +# $Id: lpml_parse.pl,v 1.25 2001/12/01 16:51:07 harris41 Exp $ +### ############################################################################### ## ## @@ -46,7 +49,7 @@ Only the 1st argument is mandatory for t Example: cat ../../doc/loncapafiles.lpml |\\ -perl lpml_parse.pl html default /home/sherbert/loncapa /tmp/install +perl lpml_parse.pl html development default /home/sherbert/loncapa /tmp/install END # ------------------------------------------------- Grab command line arguments @@ -83,9 +86,11 @@ if (@ARGV) { $sourceroot=~s/\/$//; $targetroot=~s/\/$//; +my $logcmd='| tee -a WARNINGS'; + my $invocation; # --------------------------------------------------- Record program invocation -if ($mode eq 'install') { +if ($mode eq 'install' or $mode eq 'configinstall' or $mode eq 'build') { $invocation=(<{textify}={ sourceroot => \&format_sourceroot, categories => \&format_categories, category => \&format_category, + abbreviation => \&format_abbreviation, targetdir => \&format_targetdir, chown => \&format_chown, chmod => \&format_chmod, @@ -312,7 +319,7 @@ exit; # ------------------------ Final output at end of markup parsing and formatting sub end { if ($mode eq 'html') { - return "
THE END\n"; + return "\n"; } if ($mode eq 'install') { return ''; @@ -331,7 +338,56 @@ sub format_lpml { my (@tokeninfo)=@_; my $date=`date`; chop $date; if ($mode eq 'html') { - $lpml = "
LPML BEGINNING: $date"; + $lpml=< + +LPML Description Page +(dist=$dist, categorytype=$categorytype, $date) + + +END + $lpml .= "
LPML Description Page (dist=$dist, ". + "categorytype=$categorytype, $date)". + ""; + $lpml .=< +
  • About this file
  • +
  • File Type Ownership and Permissions +Descriptions
  • +
  • Software Package Description
  • +
  • Directory Structure
  • +
  • File and Directory Structure
  • + +END + $lpml .=< 
    +About this file +

    +This file is generated dynamically by lpml_parse.pl as +part of a development compilation process. Author: Scott +Harrison (harris41\@msu.edu). +

    +END + } + elsif ($mode eq 'text') { + $lpml = "LPML Description Page (dist=$dist, $date)"; + $lpml .=<get_text('/categories')); $parser->get_tag('/categories'); if ($mode eq 'html') { - return $categories="\n
    BEGIN CATEGORIES\n$text\n". - "
    END CATEGORIES\n"; + return $categories="\n
     
    ". + "\n
    ". + "\nFile Type Ownership and Permissions". + " Descriptions". + "\n

    This table shows what permissions and ownership settings ". + "correspond to each category.

    ". + "\n\n". + "". + "". + "". + "". + "". + "\n$text\n". + "
    IconCategory NamePermissions ". + "($categorytype)
    \n"; + } + elsif ($mode eq 'text') { + return $categories="\n". + "\nFile Type Ownership and Permissions". + " Descriptions". + "\n$text". + "\n"; } else { return ''; @@ -404,12 +484,21 @@ sub format_category { my (@tokeninfo)=@_; $category_att_name=$tokeninfo[2]->{'name'}; $category_att_type=$tokeninfo[2]->{'type'}; - $chmod='';$chown=''; + $abbreviation=''; $chmod='';$chown=''; $parser->get_text('/category'); $parser->get_tag('/category'); if ($mode eq 'html') { - return $category="\n
    CATEGORY $category_att_name ". - "$category_att_type $chmod $chown"; + if ($category_att_type eq $categorytype) { + return $category="". + "\n". + "${category_att_name}\n". + "$chmod $chown\n". + "". + "\n"; +# return $category="\n
    CATEGORY $category_att_name ". +# "$category_att_type $chmod $chown"; + } } else { if ($category_att_type eq $categorytype) { @@ -420,6 +509,17 @@ sub format_category { return ''; } } +# --------------------------------------------------- Format categories section +sub format_abbreviation { + my @tokeninfo=@_; + $abbreviation=''; + my $text=&trim($parser->get_text('/abbreviation')); + if ($text) { + $parser->get_tag('/abbreviation'); + $abbreviation=$text; + } + return ''; +} # -------------------------------------------------------- Format chown section sub format_chown { my @tokeninfo=@_; @@ -447,7 +547,24 @@ sub format_rpm { my $text=&trim($parser->get_text('/rpm')); $parser->get_tag('/rpm'); if ($mode eq 'html') { - return $rpm="\n
    BEGIN RPM\n$text\n
    END RPM"; + return $rpm=< 
    +
    +Software Package Description +

    + + +
    +$text
    +
    +END + } + elsif ($mode eq 'text') { + return $rpm=<get_text('/rpmSummary')); $parser->get_tag('/rpmSummary'); if ($mode eq 'html') { - return $rpmSummary="\n
    RPMSUMMARY $text"; + return $rpmSummary="\nSummary : $text"; + } + elsif ($mode eq 'text') { + return $rpmSummary="\nSummary : $text"; } else { return ''; @@ -469,7 +589,10 @@ sub format_rpmName { my $text=&trim($parser->get_text('/rpmName')); $parser->get_tag('/rpmName'); if ($mode eq 'html') { - return $rpmName="\n
    RPMNAME $text"; + return $rpmName="\nName : $text"; + } + elsif ($mode eq 'text') { + return $rpmName="\nName : $text"; } else { return ''; @@ -480,7 +603,10 @@ sub format_rpmVersion { my $text=$parser->get_text('/rpmVersion'); $parser->get_tag('/rpmVersion'); if ($mode eq 'html') { - return $rpmVersion="\n
    RPMVERSION $text"; + return $rpmVersion="\nVersion : $text"; + } + elsif ($mode eq 'text') { + return $rpmVersion="\nVersion : $text"; } else { return ''; @@ -491,7 +617,10 @@ sub format_rpmRelease { my $text=$parser->get_text('/rpmRelease'); $parser->get_tag('/rpmRelease'); if ($mode eq 'html') { - return $rpmRelease="\n
    RPMRELEASE $text"; + return $rpmRelease="\nRelease : $text"; + } + elsif ($mode eq 'text') { + return $rpmRelease="\nRelease : $text"; } else { return ''; @@ -502,7 +631,10 @@ sub format_rpmVendor { my $text=$parser->get_text('/rpmVendor'); $parser->get_tag('/rpmVendor'); if ($mode eq 'html') { - return $rpmVendor="\n
    RPMVENDOR $text"; + return $rpmVendor="\nVendor : $text"; + } + elsif ($mode eq 'text') { + return $rpmVendor="\nVendor : $text"; } else { return ''; @@ -513,7 +645,10 @@ sub format_rpmBuildRoot { my $text=$parser->get_text('/rpmBuildRoot'); $parser->get_tag('/rpmBuildRoot'); if ($mode eq 'html') { - return $rpmBuildRoot="\n
    RPMBUILDROOT $text"; + return $rpmBuildRoot="\nBuild Root : $text"; + } + elsif ($mode eq 'text') { + return $rpmBuildRoot="\nBuild Root : $text"; } else { return ''; @@ -524,7 +659,10 @@ sub format_rpmCopyright { my $text=$parser->get_text('/rpmCopyright'); $parser->get_tag('/rpmCopyright'); if ($mode eq 'html') { - return $rpmCopyright="\n
    RPMCOPYRIGHT $text"; + return $rpmCopyright="\nLicense : $text"; + } + elsif ($mode eq 'text') { + return $rpmCopyright="\nLicense : $text"; } else { return ''; @@ -535,7 +673,10 @@ sub format_rpmGroup { my $text=$parser->get_text('/rpmGroup'); $parser->get_tag('/rpmGroup'); if ($mode eq 'html') { - return $rpmGroup="\n
    RPMGROUP $text"; + return $rpmGroup="\nGroup : $text"; + } + elsif ($mode eq 'text') { + return $rpmGroup="\nGroup : $text"; } else { return ''; @@ -546,7 +687,10 @@ sub format_rpmSource { my $text=$parser->get_text('/rpmSource'); $parser->get_tag('/rpmSource'); if ($mode eq 'html') { - return $rpmSource="\n
    RPMSOURCE $text"; + return $rpmSource="\nSource : $text"; + } + elsif ($mode eq 'text') { + return $rpmSource="\nSource : $text"; } else { return ''; @@ -557,7 +701,10 @@ sub format_rpmAutoReqProv { my $text=$parser->get_text('/rpmAutoReqProv'); $parser->get_tag('/rpmAutoReqProv'); if ($mode eq 'html') { - return $rpmAutoReqProv="\n
    RPMAUTOREQPROV $text"; + return $rpmAutoReqProv="\nAutoReqProv : $text"; + } + if ($mode eq 'text') { + return $rpmAutoReqProv="\nAutoReqProv : $text"; } else { return ''; @@ -568,7 +715,14 @@ sub format_rpmdescription { my $text=$parser->get_text('/rpmdescription'); $parser->get_tag('/rpmdescription'); if ($mode eq 'html') { - return $rpmdescription="\n
    RPMDESCRIPTION $text"; + $text=~s/\n//g; + $text=~s/\\n/\n/g; + return $rpmdescription="\nDescription : $text"; + } + elsif ($mode eq 'text') { + $text=~s/\n//g; + $text=~s/\\n/\n/g; + return $rpmdescription="\nDescription : $text"; } else { return ''; @@ -579,7 +733,8 @@ sub format_rpmpre { my $text=$parser->get_text('/rpmpre'); $parser->get_tag('/rpmpre'); if ($mode eq 'html') { - return $rpmpre="\n
    RPMPRE $text"; +# return $rpmpre="\n
    RPMPRE $text"; + return ''; } else { return ''; @@ -590,8 +745,15 @@ sub format_directories { my $text=$parser->get_text('/directories'); $parser->get_tag('/directories'); if ($mode eq 'html') { - return $directories="\n
    BEGIN DIRECTORIES\n$text\n
    ". - "END DIRECTORIES\n"; + return $directories="\n
     
    ". + "
    ". + "Directory Structure". + "\n$text\n
    ". + "\n"; + } + elsif ($mode eq 'text') { + return $directories="\nDirectory Structure\n$text\n". + "\n"; } elsif ($mode eq 'install') { return "\n".'directories:'."\n".$text; @@ -656,7 +818,17 @@ sub format_files { my $text=$parser->get_text('/files'); $parser->get_tag('/files'); if ($mode eq 'html') { - return $directories="\n
    BEGIN FILES\n$text\n
    END FILES\n"; + return $directories="\n
     
    ". + "
    ". + "File and Directory Structure". + "\n$text\n
    ". + "\n"; + } + elsif ($mode eq 'text') { + return $directories="\n". + "File and Directory Structure". + "\n$text\n". + "\n"; } elsif ($mode eq 'install') { return "\n".'files:'."\n".$text. @@ -688,22 +860,22 @@ sub format_files { $depstring.="\telif !(test -r $command/$dep);\\\n"; $depstring.="\t\tthen echo ". "\"**** WARNING **** missing the file: ". - "$command/$dep\";\\\n"; + "$command/$dep\"$logcmd;\\\n"; $depstring.="\t\ttest -e $source || test -e $target || echo ". "'**** ERROR **** neither source=$source nor target=". - "$target exist and they cannot be built';\\\n"; + "$target exist and they cannot be built'$logcmd;\\\n"; $depstring.="\t\tmake -f Makefile.build ${source}___DEPS;\\\n"; if ($olddep) { $depstring2.="\t\tECODE=0;\\\n"; $depstring2.="\t\t! test -e $source && test -r $command/$olddep &&". - " { perl filecompare.pl -B $command/$olddep $target || ECODE=\$\$?; } && { [ \$\$ECODE != \"2\" ] || echo \"**** WARNING **** dependency $command/$olddep is newer than target file $target; SOMETHING MAY BE WRONG\"; };\\\n"; + " { perl filecompare.pl -b2 $command/$olddep $target || ECODE=\$\$?; } && { [ \$\$ECODE != \"2\" ] || echo \"**** WARNING **** dependency $command/$olddep is newer than target file $target; SOMETHING MAY BE WRONG\"$logcmd; };\\\n"; } $olddep=$dep; } $binfo.="$source: $tword\n". "\t\@if !(echo \"\");\\\n\t\tthen echo ". "\"**** WARNING **** Strange shell. ". - "Check your path settings.\";\\\n". + "Check your path settings.\"$logcmd;\\\n". $depstring. "\telse \\\n\t\t$command2\n\tfi\n\n"; $binfo.="${source}___DEPS:\n".$depstring2."\t\tECODE=0;\n\n"; @@ -763,17 +935,17 @@ sub format_file { foreach my $dep (@deps) { $depstring.=<