Annotation of loncom/build/lpml_parse.pl, revision 1.34

1.1       harris41    1: #!/usr/bin/perl
1.2       albertel    2: 
1.28      harris41    3: # The LearningOnline Network with CAPA
                      4: # lpml_parse.pl - Linux Packaging Markup Language parser
                      5: #
1.34    ! harris41    6: # $Id: lpml_parse.pl,v 1.33 2001/12/19 21:26:52 harris41 Exp $
1.28      harris41    7: #
                      8: # Written by Scott Harrison, harris41@msu.edu
                      9: #
                     10: # Copyright Michigan State University Board of Trustees
                     11: #
                     12: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                     13: #
                     14: # LON-CAPA is free software; you can redistribute it and/or modify
                     15: # it under the terms of the GNU General Public License as published by
                     16: # the Free Software Foundation; either version 2 of the License, or
                     17: # (at your option) any later version.
                     18: #
                     19: # LON-CAPA is distributed in the hope that it will be useful,
                     20: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     21: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     22: # GNU General Public License for more details.
                     23: #
                     24: # You should have received a copy of the GNU General Public License
                     25: # along with LON-CAPA; if not, write to the Free Software
                     26: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     27: #
                     28: # /home/httpd/html/adm/gpl.txt
                     29: #
                     30: # http://www.lon-capa.org/
                     31: #
1.4       harris41   32: # YEAR=2001
1.2       albertel   33: # May 2001
1.3       harris41   34: # 06/19/2001,06/20,06/24 - Scott Harrison
1.5       harris41   35: # 9/5/2001,9/6,9/7,9/8 - Scott Harrison
1.14      harris41   36: # 9/17,9/18 - Scott Harrison
1.21      harris41   37: # 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison
1.31      harris41   38: # 12/2,12/3,12/4,12/5,12/6,12/13 - Scott Harrison
1.28      harris41   39: #
1.18      harris41   40: ###
1.3       harris41   41: 
1.4       harris41   42: ###############################################################################
                     43: ##                                                                           ##
                     44: ## ORGANIZATION OF THIS PERL SCRIPT                                          ##
                     45: ## 1. Notes                                                                  ##
                     46: ## 2. Get command line arguments                                             ##
                     47: ## 3. First pass through (grab distribution-specific information)            ##
                     48: ## 4. Second pass through (parse out what is not necessary)                  ##
                     49: ## 5. Third pass through (translate markup according to specified mode)      ##
1.14      harris41   50: ## 6. Functions (most all just format contents of different markup tags)     ##
                     51: ## 7. POD (plain old documentation, CPAN style)                              ##
1.4       harris41   52: ##                                                                           ##
                     53: ###############################################################################
                     54: 
                     55: # ----------------------------------------------------------------------- Notes
                     56: #
1.3       harris41   57: # I am using a multiple pass-through approach to parsing
                     58: # the lpml file.  This saves memory and makes sure the server
                     59: # will never be overloaded.
1.4       harris41   60: #
                     61: # This is meant to parse files meeting the lpml document type.
                     62: # See lpml.dtd.  LPML=Linux Packaging Markup Language.
1.2       albertel   63: 
1.1       harris41   64: use HTML::TokeParser;
1.2       albertel   65: 
1.3       harris41   66: my $usage=<<END;
                     67: **** ERROR ERROR ERROR ERROR ****
                     68: Usage is for lpml file to come in through standard input.
                     69: 1st argument is the mode of parsing.
1.4       harris41   70: 2nd argument is the category permissions to use (runtime or development)
                     71: 3rd argument is the distribution (default,redhat6.2,debian2.2,redhat7.1,etc).
                     72: 4th argument is to manually specify a sourceroot.
                     73: 5th argument is to manually specify a targetroot.
1.3       harris41   74: 
                     75: Only the 1st argument is mandatory for the program to run.
                     76: 
                     77: Example:
                     78: 
                     79: cat ../../doc/loncapafiles.lpml |\\
1.25      harris41   80: perl lpml_parse.pl html development default /home/sherbert/loncapa /tmp/install
1.3       harris41   81: END
                     82: 
                     83: # ------------------------------------------------- Grab command line arguments
                     84: 
                     85: my $mode;
1.4       harris41   86: if (@ARGV==5) {
1.3       harris41   87:     $mode = shift @ARGV;
                     88: }
                     89: else {
1.4       harris41   90:     @ARGV=();shift @ARGV;
1.3       harris41   91:     while(<>){} # throw away the input to avoid broken pipes
                     92:     print $usage;
                     93:     exit -1; # exit with error status
                     94: }
                     95: 
1.4       harris41   96: my $categorytype;
                     97: if (@ARGV) {
                     98:     $categorytype = shift @ARGV;
                     99: }
                    100: 
1.3       harris41  101: my $dist;
                    102: if (@ARGV) {
                    103:     $dist = shift @ARGV;
                    104: }
1.2       albertel  105: 
1.3       harris41  106: my $targetroot;
                    107: my $sourceroot;
1.27      harris41  108: my $targetrootarg;
                    109: my $sourcerootarg;
1.3       harris41  110: if (@ARGV) {
1.4       harris41  111:     $sourceroot = shift @ARGV;
1.3       harris41  112: }
                    113: if (@ARGV) {
1.4       harris41  114:     $targetroot = shift @ARGV;
1.3       harris41  115: }
1.4       harris41  116: $sourceroot=~s/\/$//;
                    117: $targetroot=~s/\/$//;
1.27      harris41  118: $sourcerootarg=$sourceroot;
                    119: $targetrootarg=$targetroot;
1.3       harris41  120: 
1.19      harris41  121: my $logcmd='| tee -a WARNINGS';
                    122: 
1.5       harris41  123: my $invocation;
                    124: # --------------------------------------------------- Record program invocation
1.17      harris41  125: if ($mode eq 'install' or $mode eq 'configinstall' or $mode eq 'build') {
1.5       harris41  126:     $invocation=(<<END);
                    127: # Invocation: STDINPUT | lpml_parse.pl
                    128: #             1st argument (mode) is: $mode
                    129: #             2nd argument (category type) is: $categorytype
                    130: #             3rd argument (distribution) is: $dist
                    131: #             4th argument (targetroot) is: described below
                    132: #             5th argument (sourceroot) is: described below
                    133: END
                    134: }
                    135: 
1.3       harris41  136: # ---------------------------------------------------- Start first pass through
1.2       albertel  137: my @parsecontents = <>;
                    138: my $parsestring = join('',@parsecontents);
                    139: my $outstring;
                    140: 
1.3       harris41  141: # Need to make a pass through and figure out what defaults are
                    142: # overrided.  Top-down overriding strategy (leaves don't know
                    143: # about distant leaves).
                    144: 
                    145: my @hierarchy;
                    146: $hierarchy[0]=0;
                    147: my $hloc=0;
                    148: my $token;
                    149: $parser = HTML::TokeParser->new(\$parsestring) or
                    150:     die('can\'t create TokeParser object');
                    151: $parser->xml_mode('1');
                    152: my %hash;
                    153: my $key;
                    154: while ($token = $parser->get_token()) {
                    155:     if ($token->[0] eq 'S') {
                    156: 	$hloc++;
                    157: 	$hierarchy[$hloc]++;
                    158: 	$key=$token->[1].join(',',@hierarchy[0..($hloc-1)]);
                    159: 	my $thisdist=' '.$token->[2]{'dist'}.' ';
                    160: 	if ($thisdist eq ' default ') {
                    161: 	    $hash{$key}=1; # there is a default setting for this key
                    162: 	}
                    163: 	elsif ($dist && $hash{$key}==1 && $thisdist=~/\s$dist\s/) {
                    164: 	    $hash{$key}=2; # disregard default setting for this key if
                    165: 	                   # there is a directly requested distribution match
                    166: 	}
                    167:     }
                    168:     if ($token->[0] eq 'E') {
                    169: 	$hloc--;
                    170:     }
                    171: }
                    172: 
                    173: # --------------------------------------------------- Start second pass through
                    174: undef $hloc;
                    175: undef @hierarchy;
                    176: undef $parser;
                    177: $hierarchy[0]=0;
                    178: $parser = HTML::TokeParser->new(\$parsestring) or
                    179:     die('can\'t create TokeParser object');
                    180: $parser->xml_mode('1');
                    181: my $cleanstring;
                    182: while ($token = $parser->get_token()) {
                    183:     if ($token->[0] eq 'S') {
                    184: 	$hloc++;
                    185: 	$hierarchy[$hloc]++;
                    186: 	$key=$token->[1].join(',',@hierarchy[0..($hloc-1)]);
                    187: 	my $thisdist=' '.$token->[2]{'dist'}.' ';
1.4       harris41  188: 	# This conditional clause is set up to ignore two sets
                    189: 	# of invalid conditions before accepting entry into
                    190: 	# the cleanstring.
1.3       harris41  191: 	if ($hash{$key}==2 and
                    192: 	    !($thisdist eq '  ' or $thisdist =~/\s$dist\s/)) {
                    193: 	    if ($token->[4]!~/\/>$/) {
                    194: 		$parser->get_tag('/'.$token->[1]);
                    195: 		$hloc--;
                    196: 	    }
                    197: 	}
                    198: 	elsif ($thisdist ne '  ' and $thisdist!~/\s$dist\s/ and
                    199: 	       !($thisdist eq ' default ' and $hash{$key}!=2)) {
                    200: 	    if ($token->[4]!~/\/>$/) {
                    201: 		$parser->get_tag('/'.$token->[1]);
                    202: 		$hloc--;
                    203: 	    }
                    204: 	}
                    205: 	else {
                    206: 	    $cleanstring.=$token->[4];
                    207: 	}
                    208: 	if ($token->[4]=~/\/>$/) {
                    209: 	    $hloc--;
                    210: 	}
                    211:     }
                    212:     if ($token->[0] eq 'E') {
                    213: 	$cleanstring.=$token->[2];
                    214: 	$hloc--;
                    215:     }
                    216:     if ($token->[0] eq 'T') {
                    217: 	$cleanstring.=$token->[1];
                    218:     }
                    219: }
                    220: $cleanstring=&trim($cleanstring);
1.10      harris41  221: $cleanstring=~s/\>\s*\n\s*\</\>\</g;
                    222: 
1.3       harris41  223: # ---------------------------------------------------- Start final pass through
                    224: 
                    225: # storage variables
                    226: my $lpml;
                    227: my $categories;
1.29      harris41  228: my @categorynamelist;
1.3       harris41  229: my $category;
                    230: my $category_att_name;
                    231: my $category_att_type;
                    232: my $chown;
                    233: my $chmod;
1.25      harris41  234: my $abbreviation; # space-free abbreviation; esp. for image names
1.3       harris41  235: my $rpm;
                    236: my $rpmSummary;
                    237: my $rpmName;
                    238: my $rpmVersion;
                    239: my $rpmRelease;
                    240: my $rpmVendor;
                    241: my $rpmBuildRoot;
                    242: my $rpmCopyright;
                    243: my $rpmGroup;
                    244: my $rpmSource;
                    245: my $rpmAutoReqProv;
                    246: my $rpmdescription;
                    247: my $rpmpre;
                    248: my $directories;
                    249: my $directory;
                    250: my $targetdirs;
                    251: my $targetdir;
                    252: my $categoryname;
                    253: my $description;
                    254: my $files;
                    255: my $fileglobs;
                    256: my $links;
                    257: my $file;
                    258: my $link;
                    259: my $fileglob;
                    260: my $sourcedir;
                    261: my $targets;
                    262: my $target;
                    263: my $source;
                    264: my $note;
                    265: my $build;
1.14      harris41  266: my $buildlink;
1.3       harris41  267: my $commands;
                    268: my $command;
                    269: my $status;
                    270: my $dependencies;
                    271: my $dependency;
1.4       harris41  272: my @links;
                    273: my %categoryhash;
1.26      harris41  274: my $dpathlength;
                    275: my %fab; # file category abbreviation
1.29      harris41  276: my $directory_count;
                    277: my $file_count;
                    278: my $link_count;
                    279: my $fileglob_count;
                    280: my $fileglobnames_count;
                    281: my %categorycount;
                    282: # START TEMP WAY
                    283: #my %bytecount;  # TEMP WAY TO COUNT INFORMATION
                    284: #my %linecount;  # TEMP WAY TO COUNT INFORMATION
                    285: # END TEMP WAY
1.3       harris41  286: 
1.11      harris41  287: my @buildall;
1.12      harris41  288: my @buildinfo;
                    289: 
                    290: my @configall;
1.11      harris41  291: 
1.3       harris41  292: # Make new parser with distribution specific input
                    293: undef $parser;
                    294: $parser = HTML::TokeParser->new(\$cleanstring) or
                    295:     die('can\'t create TokeParser object');
                    296: $parser->xml_mode('1');
                    297: 
                    298: # Define handling methods for mode-dependent text rendering
1.26      harris41  299: 
1.3       harris41  300: $parser->{textify}={
1.31      harris41  301:     specialnotices => \&format_specialnotices,
                    302:     specialnotice => \&format_specialnotice,
1.3       harris41  303:     targetroot => \&format_targetroot,
                    304:     sourceroot => \&format_sourceroot,
                    305:     categories => \&format_categories,
                    306:     category => \&format_category,
1.25      harris41  307:     abbreviation => \&format_abbreviation,
1.3       harris41  308:     targetdir => \&format_targetdir,
                    309:     chown => \&format_chown,
                    310:     chmod => \&format_chmod,
                    311:     rpm => \&format_rpm,
                    312:     rpmSummary => \&format_rpmSummary,
                    313:     rpmName => \&format_rpmName,
                    314:     rpmVersion => \&format_rpmVersion,
                    315:     rpmRelease => \&format_rpmRelease,
                    316:     rpmVendor => \&format_rpmVendor,
                    317:     rpmBuildRoot => \&format_rpmBuildRoot,
                    318:     rpmCopyright => \&format_rpmCopyright,
                    319:     rpmGroup => \&format_rpmGroup,
                    320:     rpmSource => \&format_rpmSource,
                    321:     rpmAutoReqProv => \&format_rpmAutoReqProv,
                    322:     rpmdescription => \&format_rpmdescription,
                    323:     rpmpre => \&format_rpmpre,
                    324:     directories => \&format_directories,
                    325:     directory => \&format_directory,
                    326:     categoryname => \&format_categoryname,
                    327:     description => \&format_description,
                    328:     files => \&format_files,
                    329:     file => \&format_file,
                    330:     fileglob => \&format_fileglob,
1.4       harris41  331:     links => \&format_links,
1.3       harris41  332:     link => \&format_link,
                    333:     linkto => \&format_linkto,
                    334:     source => \&format_source,
                    335:     target => \&format_target,
                    336:     note => \&format_note,
                    337:     build => \&format_build,
                    338:     status => \&format_status,
                    339:     dependencies => \&format_dependencies,
1.14      harris41  340:     buildlink => \&format_buildlink,
1.3       harris41  341:     glob => \&format_glob,
                    342:     sourcedir => \&format_sourcedir,
                    343:     filenames => \&format_filenames,
                    344:     };
                    345: 
                    346: my $text;
                    347: my $token;
                    348: undef $hloc;
                    349: undef @hierarchy;
                    350: my $hloc;
                    351: my @hierarchy2;
                    352: while ($token = $parser->get_tag('lpml')) {
                    353:     &format_lpml(@{$token});
                    354:     $text = &trim($parser->get_text('/lpml'));
                    355:     $token = $parser->get_tag('/lpml');
                    356:     print $lpml; 
                    357:     print "\n";
1.4       harris41  358: #    $text=~s/\s*\n\s*\n\s*/\n/g;
1.3       harris41  359:     print $text;
                    360:     print "\n";
                    361:     print &end();
                    362: }
                    363: exit;
                    364: 
1.14      harris41  365: # ---------- Functions (most all just format contents of different markup tags)
                    366: 
                    367: # ------------------------ Final output at end of markup parsing and formatting
1.3       harris41  368: sub end {
                    369:     if ($mode eq 'html') {
1.29      harris41  370: 	# START TEMP WAY
                    371: #	my $totallinecount;
                    372: #	my $totalbytecount;
                    373: #	map {$totallinecount+=$linecount{$_};
                    374: #	     $totalbytecount+=$bytecount{$_}}
                    375: # 	  @categorynamelist;
                    376:         # END TEMP WAY
                    377: 	return "<br />&nbsp;<br />".
                    378: 	    "<a name='summary' /><font size='+2'>Summary of Source Repository".
                    379: 	    "</font>".
                    380: 	    "<br />&nbsp;<br />".
                    381: 	    "<table border='1' cellpadding='5'>".
                    382: 	    "<caption>Files, Directories, and Symbolic Links</caption>".
                    383: 	    "<tr><td>Files (not referenced by globs)</td><td>$file_count</td>".
                    384: 	    "</tr>".
                    385: 	    "<tr><td>Files (referenced by globs)</td>".
                    386: 	    "<td>$fileglobnames_count</td>".
                    387: 	    "</tr>".
                    388: 	    "<tr><td>Total Files</td>".
                    389: 	    "<td>".($fileglobnames_count+$file_count)."</td>".
                    390: 	    "</tr>".
                    391: 	    "<tr><td>File globs</td>".
                    392: 	    "<td>".$fileglob_count."</td>".
                    393: 	    "</tr>".
                    394: 	    "<tr><td>Directories</td>".
                    395: 	    "<td>".$directory_count."</td>".
                    396: 	    "</tr>".
                    397: 	    "<tr><td>Symbolic links</td>".
                    398: 	    "<td>".$link_count."</td>".
                    399: 	    "</tr>".
                    400: 	    "</table>".
                    401: 	    "<table border='1' cellpadding='5'>".
                    402: 	    "<caption>File Category Count</caption>".
                    403: 	    "<tr><th>Icon</th><th>Name</th><th>Number of Occurrences</th>".
1.32      harris41  404: 	    "<th>Number of Incorrect Counts</th>".
                    405: 	    "</tr>".
1.29      harris41  406: 	    join("\n",(map {"<tr><td><img src='$fab{$_}.gif' ".
                    407: 		 "alt='$_ icon' /></td>".
1.32      harris41  408:  	         "<td>$_</td><td>$categorycount{$_}</td>".
                    409: 		 "<td><!-- POSTEVALINLINE $_ --></td></tr>"}
1.29      harris41  410: 		@categorynamelist)).
                    411: 	    "</table>".
                    412: 	    "</body></html>\n";
                    413: 
                    414: # START TEMP WAY
                    415: #	    join("\n",(map {"<tr><td><img src='$fab{$_}.gif' ".
                    416: #		 "alt='$_ icon' /></td>".
                    417: # 	         "<td>$_</td><td>$categorycount{$_}</td><td>$linecount{$_}</td><td>$bytecount{$_}</td></tr>"}
                    418: #		@categorynamelist)).
                    419: #	    "<br />&nbsp;<br />".
                    420: #	    "Total Lines of Code: $totallinecount".
                    421: #	    "<br />&nbsp;<br />".
                    422: #	    "Total Bytes: $totalbytecount".
                    423: # END TEMP WAY
1.3       harris41  424:     }
1.4       harris41  425:     if ($mode eq 'install') {
                    426: 	return '';
                    427:     }
1.3       harris41  428: }
                    429: 
                    430: # ----------------------- Take in string to parse and the separation expression
                    431: sub extract_array {
                    432:     my ($stringtoparse,$sepexp) = @_;
                    433:     my @a=split(/$sepexp/,$stringtoparse);
                    434:     return \@a;
                    435: }
                    436: 
                    437: # --------------------------------------------------------- Format lpml section
                    438: sub format_lpml {
                    439:     my (@tokeninfo)=@_;
                    440:     my $date=`date`; chop $date;
                    441:     if ($mode eq 'html') {
1.24      harris41  442: 	$lpml=<<END;
                    443: <html>
                    444: <head>
1.25      harris41  445: <title>LPML Description Page
                    446: (dist=$dist, categorytype=$categorytype, $date)</title>
1.24      harris41  447: </head>
                    448: <body>
                    449: END
                    450: 	$lpml .= "<br /><font size='+2'>LPML Description Page (dist=$dist, ".
1.25      harris41  451: 	    "categorytype=$categorytype, $date)".
1.23      harris41  452: 	    "</font>";
                    453: 	$lpml .=<<END;
                    454: <ul>
1.24      harris41  455: <li><a href='#about'>About this file</a></li>
                    456: <li><a href='#ownperms'>File Type Ownership and Permissions
                    457: Descriptions</a></li>
                    458: <li><a href='#package'>Software Package Description</a></li>
                    459: <li><a href='#directories'>Directory Structure</a></li>
1.26      harris41  460: <li><a href='#files'>Files</a></li>
1.29      harris41  461: <li><a href='#summary'>Summary of Source Repository</a></li>
1.23      harris41  462: </ul>
                    463: END
                    464:         $lpml .=<<END;
1.24      harris41  465: <br />&nbsp;<br /><a name='about' />
1.23      harris41  466: <font size='+2'>About this file</font>
                    467: <p>
                    468: This file is generated dynamically by <tt>lpml_parse.pl</tt> as
1.28      harris41  469: part of a development compilation process.</p>
                    470: <p>LPML written by Scott Harrison (harris41\@msu.edu).
1.23      harris41  471: </p>
                    472: END
                    473:     }
                    474:     elsif ($mode eq 'text') {
                    475: 	$lpml = "LPML Description Page (dist=$dist, $date)";
                    476: 	$lpml .=<<END;
                    477: 
                    478: * About this file
                    479: * Software Package Description
                    480: * Directory Structure
                    481: * File Type Ownership and Permissions
1.26      harris41  482: * Files
1.23      harris41  483: END
                    484:         $lpml .=<<END;
                    485: 
                    486: About this file
                    487: 
                    488: This file is generated dynamically by lpml_parse.pl as
                    489: part of a development compilation process.  Author: Scott
                    490: Harrison (harris41\@msu.edu).
                    491: 
                    492: END
1.3       harris41  493:     }
1.4       harris41  494:     elsif ($mode eq 'install') {
                    495: 	print '# LPML install targets. Linux Packaging Markup Language,';
                    496: 	print ' by Scott Harrison 2001'."\n";
                    497: 	print '# This file was automatically generated on '.`date`;
1.5       harris41  498: 	print "\n".$invocation;
1.14      harris41  499: 	$lpml .= "SHELL=\"/bin/bash\"\n\n";
1.4       harris41  500:     }
1.16      harris41  501:     elsif ($mode eq 'configinstall') {
1.17      harris41  502: 	print '# LPML configuration file targets (configinstall).'."\n";
                    503: 	print '# Linux Packaging Markup Language,';
1.16      harris41  504: 	print ' by Scott Harrison 2001'."\n";
                    505: 	print '# This file was automatically generated on '.`date`;
                    506: 	print "\n".$invocation;
                    507: 	$lpml .= "SHELL=\"/bin/bash\"\n\n";
                    508:     }
1.11      harris41  509:     elsif ($mode eq 'build') {
1.14      harris41  510: 	$lpml = "# LPML build targets. Linux Packaging Markup Language,";
                    511: 	$lpml .= ' by Scott Harrison 2001'."\n";
1.11      harris41  512: 	$lpml .= '# This file was automatically generated on '.`date`;
1.17      harris41  513: 	$lpml .= "\n".$invocation;
1.11      harris41  514: 	$lpml .= "SHELL=\"/bin/sh\"\n\n";
                    515:     }
1.4       harris41  516:     else {
                    517: 	return '';
                    518:     }
1.3       harris41  519: }
                    520: # --------------------------------------------------- Format targetroot section
                    521: sub format_targetroot {
                    522:     my $text=&trim($parser->get_text('/targetroot'));
                    523:     $text=$targetroot if $targetroot;
                    524:     $parser->get_tag('/targetroot');
                    525:     if ($mode eq 'html') {
1.10      harris41  526: 	return $targetroot="\n<br />TARGETROOT: $text";
1.3       harris41  527:     }
1.17      harris41  528:     elsif ($mode eq 'install' or $mode eq 'build' or
                    529: 	   $mode eq 'configinstall') {
1.11      harris41  530: 	return '# TARGET INSTALL LOCATION is "'.$targetroot."\"\n";
                    531:     }
1.3       harris41  532:     else {
                    533: 	return '';
                    534:     }
                    535: }
                    536: # --------------------------------------------------- Format sourceroot section
                    537: sub format_sourceroot {
                    538:     my $text=&trim($parser->get_text('/sourceroot'));
                    539:     $text=$sourceroot if $sourceroot;
                    540:     $parser->get_tag('/sourceroot');
                    541:     if ($mode eq 'html') {
1.10      harris41  542: 	return $sourceroot="\n<br />SOURCEROOT: $text";
1.3       harris41  543:     }
1.17      harris41  544:     elsif ($mode eq 'install' or $mode eq 'build' or
                    545: 	   $mode eq 'configinstall') {
1.11      harris41  546: 	return '# SOURCE CODE LOCATION IS "'.$sourceroot."\"\n";;
                    547:     }
1.3       harris41  548:     else {
                    549: 	return '';
                    550:     }
                    551: }
                    552: # --------------------------------------------------- Format categories section
                    553: sub format_categories {
                    554:     my $text=&trim($parser->get_text('/categories'));
                    555:     $parser->get_tag('/categories');
                    556:     if ($mode eq 'html') {
1.24      harris41  557: 	return $categories="\n<br />&nbsp;<br />".
                    558: 	    "\n<a name='ownperms'>".
                    559: 	    "\n<font size='+2'>File Type Ownership and Permissions".
                    560: 	    " Descriptions</font>".
1.25      harris41  561: 	    "\n<p>This table shows what permissions and ownership settings ".
                    562: 	    "correspond to each category.</p>".
                    563: 	    "\n<table border='1' cellpadding='5' width='60%'>\n".
                    564: 	    "<tr>".
                    565: 	    "<th align='left' bgcolor='#ffffff'>Icon</th>".
                    566: 	    "<th align='left' bgcolor='#ffffff'>Category Name</th>".
                    567: 	    "<th align='left' bgcolor='#ffffff'>Permissions ".
                    568: 	    "($categorytype)</th>".
                    569: 	    "</tr>".
                    570: 	    "\n$text\n".
1.24      harris41  571: 	    "</table>\n";
                    572:     }
                    573:     elsif ($mode eq 'text') {
                    574: 	return $categories="\n".
                    575: 	    "\nFile Type Ownership and Permissions".
                    576: 	    " Descriptions".
1.25      harris41  577: 	    "\n$text".
1.24      harris41  578: 	    "\n";
1.3       harris41  579:     }
                    580:     else {
                    581: 	return '';
                    582:     }
                    583: }
                    584: # --------------------------------------------------- Format categories section
                    585: sub format_category {
                    586:     my (@tokeninfo)=@_;
                    587:     $category_att_name=$tokeninfo[2]->{'name'};
                    588:     $category_att_type=$tokeninfo[2]->{'type'};
1.25      harris41  589:     $abbreviation=''; $chmod='';$chown='';
1.3       harris41  590:     $parser->get_text('/category');
                    591:     $parser->get_tag('/category');
1.26      harris41  592:     $fab{$category_att_name}=$abbreviation;
1.3       harris41  593:     if ($mode eq 'html') {
1.25      harris41  594: 	if ($category_att_type eq $categorytype) {
1.29      harris41  595: 	    push @categorynamelist,$category_att_name;
1.27      harris41  596: 	    $categoryhash{$category_att_name}="$chmod $chown";
1.25      harris41  597: 	    return $category="<tr>".
                    598: 		"<td><img src='$abbreviation.gif' ".
                    599:    	        "alt='${category_att_name}' /></td>\n".
                    600: 		"<td>${category_att_name}</td>\n".
                    601: 		"<td>$chmod $chown</td>\n".
                    602: 		"</tr>".
                    603: 		"\n";
                    604: #	return $category="\n<br />CATEGORY $category_att_name ".
                    605: #	    "$category_att_type $chmod $chown";
                    606: 	}
1.3       harris41  607:     }
                    608:     else {
1.4       harris41  609: 	if ($category_att_type eq $categorytype) {
                    610: 	    my ($user,$group)=split(/\:/,$chown);
                    611: 	    $categoryhash{$category_att_name}='-o '.$user.' -g '.$group.
                    612: 		' -m '.$chmod;
                    613: 	}
1.3       harris41  614: 	return '';
                    615:     }
                    616: }
1.25      harris41  617: # --------------------------------------------------- Format categories section
                    618: sub format_abbreviation {
                    619:     my @tokeninfo=@_;
                    620:     $abbreviation='';
                    621:     my $text=&trim($parser->get_text('/abbreviation'));
                    622:     if ($text) {
                    623: 	$parser->get_tag('/abbreviation');
                    624: 	$abbreviation=$text;
                    625:     }
                    626:     return '';
                    627: }
1.3       harris41  628: # -------------------------------------------------------- Format chown section
                    629: sub format_chown {
                    630:     my @tokeninfo=@_;
                    631:     $chown='';
                    632:     my $text=&trim($parser->get_text('/chown'));
                    633:     if ($text) {
                    634: 	$parser->get_tag('/chown');
                    635: 	$chown=$text;
                    636:     }
                    637:     return '';
                    638: }
                    639: # -------------------------------------------------------- Format chmod section
                    640: sub format_chmod {
                    641:     my @tokeninfo=@_;
                    642:     $chmod='';
                    643:     my $text=&trim($parser->get_text('/chmod'));
                    644:     if ($text) {
                    645: 	$parser->get_tag('/chmod');
                    646: 	$chmod=$text;
                    647:     }
                    648:     return '';
                    649: }
                    650: # ---------------------------------------------------------- Format rpm section
                    651: sub format_rpm {
                    652:     my $text=&trim($parser->get_text('/rpm'));
                    653:     $parser->get_tag('/rpm');
                    654:     if ($mode eq 'html') {
1.23      harris41  655: 	return $rpm=<<END;
1.24      harris41  656: <br />&nbsp;<br />
                    657: <a name='package' />
1.23      harris41  658: <font size='+2'>Software Package Description</font>
                    659: <p>
                    660: <table bgcolor='#ffffff' border='0' cellpadding='10' cellspacing='0'>
                    661: <tr><td><pre>
                    662: $text
                    663: </pre></td></tr>
                    664: </table>
                    665: END
                    666:     }
                    667:     elsif ($mode eq 'text') {
                    668: 	return $rpm=<<END;
                    669: Software Package Description
                    670: 
                    671: $text
                    672: END
1.3       harris41  673:     }
                    674:     else {
                    675: 	return '';
                    676:     }
                    677: }
                    678: # --------------------------------------------------- Format rpmSummary section
                    679: sub format_rpmSummary {
                    680:     my $text=&trim($parser->get_text('/rpmSummary'));
                    681:     $parser->get_tag('/rpmSummary');
                    682:     if ($mode eq 'html') {
1.23      harris41  683: 	return $rpmSummary="\nSummary     : $text";
                    684:     }
                    685:     elsif ($mode eq 'text') {
                    686: 	return $rpmSummary="\nSummary     : $text";
1.3       harris41  687:     }
                    688:     else {
                    689: 	return '';
                    690:     }
                    691: }
                    692: # ------------------------------------------------------ Format rpmName section
                    693: sub format_rpmName {
                    694:     my $text=&trim($parser->get_text('/rpmName'));
                    695:     $parser->get_tag('/rpmName');
                    696:     if ($mode eq 'html') {
1.24      harris41  697: 	return $rpmName="\nName        : $text";
                    698:     }
                    699:     elsif ($mode eq 'text') {
                    700: 	return $rpmName="\nName        : $text";
1.3       harris41  701:     }
                    702:     else {
                    703: 	return '';
                    704:     }
                    705: }
                    706: # --------------------------------------------------- Format rpmVersion section
                    707: sub format_rpmVersion {
                    708:     my $text=$parser->get_text('/rpmVersion');
                    709:     $parser->get_tag('/rpmVersion');
                    710:     if ($mode eq 'html') {
1.24      harris41  711: 	return $rpmVersion="\nVersion     : $text";
                    712:     }
                    713:     elsif ($mode eq 'text') {
                    714: 	return $rpmVersion="\nVersion     : $text";
1.3       harris41  715:     }
                    716:     else {
                    717: 	return '';
                    718:     }
                    719: }
                    720: # --------------------------------------------------- Format rpmRelease section
                    721: sub format_rpmRelease {
                    722:     my $text=$parser->get_text('/rpmRelease');
                    723:     $parser->get_tag('/rpmRelease');
                    724:     if ($mode eq 'html') {
1.24      harris41  725: 	return $rpmRelease="\nRelease     : $text";
                    726:     }
                    727:     elsif ($mode eq 'text') {
                    728: 	return $rpmRelease="\nRelease     : $text";
1.3       harris41  729:     }
                    730:     else {
                    731: 	return '';
                    732:     }
                    733: }
                    734: # ---------------------------------------------------- Format rpmVendor section
                    735: sub format_rpmVendor {
                    736:     my $text=$parser->get_text('/rpmVendor');
                    737:     $parser->get_tag('/rpmVendor');
                    738:     if ($mode eq 'html') {
1.24      harris41  739: 	return $rpmVendor="\nVendor      : $text";
                    740:     }
                    741:     elsif ($mode eq 'text') {
                    742: 	return $rpmVendor="\nVendor      : $text";
1.3       harris41  743:     }
                    744:     else {
                    745: 	return '';
                    746:     }
                    747: }
                    748: # ------------------------------------------------- Format rpmBuildRoot section
                    749: sub format_rpmBuildRoot {
                    750:     my $text=$parser->get_text('/rpmBuildRoot');
                    751:     $parser->get_tag('/rpmBuildRoot');
                    752:     if ($mode eq 'html') {
1.24      harris41  753: 	return $rpmBuildRoot="\nBuild Root  : $text";
                    754:     }
                    755:     elsif ($mode eq 'text') {
                    756: 	return $rpmBuildRoot="\nBuild Root  : $text";
1.3       harris41  757:     }
                    758:     else {
                    759: 	return '';
                    760:     }
                    761: }
                    762: # ------------------------------------------------- Format rpmCopyright section
                    763: sub format_rpmCopyright {
                    764:     my $text=$parser->get_text('/rpmCopyright');
                    765:     $parser->get_tag('/rpmCopyright');
                    766:     if ($mode eq 'html') {
1.24      harris41  767: 	return $rpmCopyright="\nLicense     : $text";
                    768:     }
                    769:     elsif ($mode eq 'text') {
                    770: 	return $rpmCopyright="\nLicense     : $text";
1.3       harris41  771:     }
                    772:     else {
                    773: 	return '';
                    774:     }
                    775: }
                    776: # ----------------------------------------------------- Format rpmGroup section
                    777: sub format_rpmGroup {
                    778:     my $text=$parser->get_text('/rpmGroup');
                    779:     $parser->get_tag('/rpmGroup');
                    780:     if ($mode eq 'html') {
1.24      harris41  781: 	return $rpmGroup="\nGroup       : $text";
                    782:     }
                    783:     elsif ($mode eq 'text') {
                    784: 	return $rpmGroup="\nGroup       : $text";
1.3       harris41  785:     }
                    786:     else {
                    787: 	return '';
                    788:     }
                    789: }
                    790: # ---------------------------------------------------- Format rpmSource section
                    791: sub format_rpmSource {
                    792:     my $text=$parser->get_text('/rpmSource');
                    793:     $parser->get_tag('/rpmSource');
                    794:     if ($mode eq 'html') {
1.24      harris41  795: 	return $rpmSource="\nSource      : $text";
                    796:     }
                    797:     elsif ($mode eq 'text') {
                    798: 	return $rpmSource="\nSource      : $text";
1.3       harris41  799:     }
                    800:     else {
                    801: 	return '';
                    802:     }
                    803: }
                    804: # ----------------------------------------------- Format rpmAutoReqProv section
                    805: sub format_rpmAutoReqProv {
                    806:     my $text=$parser->get_text('/rpmAutoReqProv');
                    807:     $parser->get_tag('/rpmAutoReqProv');
                    808:     if ($mode eq 'html') {
1.24      harris41  809: 	return $rpmAutoReqProv="\nAutoReqProv : $text";
                    810:     }
                    811:     if ($mode eq 'text') {
                    812: 	return $rpmAutoReqProv="\nAutoReqProv : $text";
1.3       harris41  813:     }
                    814:     else {
                    815: 	return '';
                    816:     }
                    817: }
                    818: # ----------------------------------------------- Format rpmdescription section
                    819: sub format_rpmdescription {
                    820:     my $text=$parser->get_text('/rpmdescription');
                    821:     $parser->get_tag('/rpmdescription');
                    822:     if ($mode eq 'html') {
1.25      harris41  823: 	$text=~s/\n//g;
                    824: 	$text=~s/\\n/\n/g;
1.24      harris41  825: 	return $rpmdescription="\nDescription : $text";
                    826:     }
                    827:     elsif ($mode eq 'text') {
1.25      harris41  828: 	$text=~s/\n//g;
                    829: 	$text=~s/\\n/\n/g;
1.24      harris41  830: 	return $rpmdescription="\nDescription : $text";
1.3       harris41  831:     }
                    832:     else {
                    833: 	return '';
                    834:     }
                    835: }
                    836: # ------------------------------------------------------- Format rpmpre section
                    837: sub format_rpmpre {
                    838:     my $text=$parser->get_text('/rpmpre');
                    839:     $parser->get_tag('/rpmpre');
                    840:     if ($mode eq 'html') {
1.24      harris41  841: #	return $rpmpre="\n<br />RPMPRE $text";
                    842: 	return '';
1.3       harris41  843:     }
                    844:     else {
                    845: 	return '';
                    846:     }
                    847: }
                    848: # -------------------------------------------------- Format directories section
                    849: sub format_directories {
1.4       harris41  850:     my $text=$parser->get_text('/directories');
1.3       harris41  851:     $parser->get_tag('/directories');
                    852:     if ($mode eq 'html') {
1.26      harris41  853: 	$text=~s/\[\{\{\{\{\{DPATHLENGTH\}\}\}\}\}\]/$dpathlength/g;
1.24      harris41  854: 	return $directories="\n<br />&nbsp;<br />".
                    855: 	    "<a name='directories' />".
                    856: 	    "<font size='+2'>Directory Structure</font>".
1.26      harris41  857: 	    "\n<br />&nbsp;<br />".
                    858: 	    "<table border='1' cellpadding='3' cellspacing='0'>\n".
                    859: 	    "<tr><th bgcolor='#ffffff'>Category</th>".
                    860: 	    "<th bgcolor='#ffffff'>Status</th>\n".
                    861: 	    "<th bgcolor='#ffffff'>Expected Permissions & Ownership</th>\n".
                    862: 	    "<th bgcolor='#ffffff' colspan='$dpathlength'>Target Directory ".
                    863: 	    "Path</th></tr>\n".
                    864:  	    "\n$text\n</table><br />"."\n";
1.24      harris41  865:     }
                    866:     elsif ($mode eq 'text') {
                    867: 	return $directories="\nDirectory Structure\n$text\n".
                    868: 	    "\n";
1.3       harris41  869:     }
1.4       harris41  870:     elsif ($mode eq 'install') {
                    871: 	return "\n".'directories:'."\n".$text;
                    872:    }
1.3       harris41  873:     else {
                    874: 	return '';
                    875:     }
                    876: }
                    877: # ---------------------------------------------------- Format directory section
                    878: sub format_directory {
                    879:     my (@tokeninfo)=@_;
                    880:     $targetdir='';$categoryname='';$description='';
                    881:     $parser->get_text('/directory');
                    882:     $parser->get_tag('/directory');
1.29      harris41  883:     $directory_count++;
                    884:     $categorycount{$categoryname}++;
1.3       harris41  885:     if ($mode eq 'html') {
1.26      harris41  886: 	my @a;
                    887: 	@a=($targetdir=~/\//g);
                    888: 	my $d=scalar(@a)+1;
                    889: 	$dpathlength=$d if $d>$dpathlength;
                    890: 	my $thtml=$targetdir;
                    891: 	$thtml=~s/\//\<\/td\>\<td bgcolor='#ffffff'\>/g;
1.28      harris41  892: 	my ($chmod,$chown)=split(/\s/,$categoryhash{$categoryname});
1.26      harris41  893: 	return $directory="\n<tr><td rowspan='2' bgcolor='#ffffff'>".
                    894: 	    "$categoryname</td>".
1.32      harris41  895: 	    "<td rowspan='2' bgcolor='#ffffff'><!-- POSTEVAL [$categoryname] verify.pl directory /$targetdir $categoryhash{$categoryname} -->&nbsp;</td>".
1.26      harris41  896: 	    "<td rowspan='2' bgcolor='#ffffff'>$chmod<br />$chown</td>".
                    897: 	    "<td bgcolor='#ffffff'>$thtml</td></tr>".
                    898: 	    "<tr><td bgcolor='#ffffff' colspan='[{{{{{DPATHLENGTH}}}}}]'>".
                    899: 	    "$description</td></tr>";
                    900:     }
                    901:     if ($mode eq 'text') {
                    902: 	return $directory="\nDIRECTORY $targetdir $categoryname ".
1.10      harris41  903: 	    "$description";
1.3       harris41  904:     }
1.4       harris41  905:     elsif ($mode eq 'install') {
1.8       harris41  906: 	return "\t".'install '.$categoryhash{$categoryname}.' -d '.
                    907: 	    $targetroot.'/'.$targetdir."\n";
1.4       harris41  908:     }
1.3       harris41  909:     else {
                    910: 	return '';
                    911:     }
                    912: }
                    913: # ---------------------------------------------------- Format targetdir section
                    914: sub format_targetdir {
                    915:     my @tokeninfo=@_;
                    916:     $targetdir='';
                    917:     my $text=&trim($parser->get_text('/targetdir'));
                    918:     if ($text) {
                    919: 	$parser->get_tag('/targetdir');
                    920: 	$targetdir=$text;
                    921:     }
                    922:     return '';
                    923: }
                    924: # ------------------------------------------------- Format categoryname section
                    925: sub format_categoryname {
                    926:     my @tokeninfo=@_;
                    927:     $categoryname='';
                    928:     my $text=&trim($parser->get_text('/categoryname'));
                    929:     if ($text) {
                    930: 	$parser->get_tag('/categoryname');
                    931: 	$categoryname=$text;
                    932:     }
                    933:     return '';
                    934: }
                    935: # -------------------------------------------------- Format description section
                    936: sub format_description {
                    937:     my @tokeninfo=@_;
                    938:     $description='';
1.10      harris41  939:     my $text=&htmlsafe(&trim($parser->get_text('/description')));
1.3       harris41  940:     if ($text) {
                    941: 	$parser->get_tag('/description');
                    942: 	$description=$text;
                    943:     }
                    944:     return '';
                    945: }
                    946: # -------------------------------------------------------- Format files section
                    947: sub format_files {
1.4       harris41  948:     my $text=$parser->get_text('/files');
1.3       harris41  949:     $parser->get_tag('/files');
                    950:     if ($mode eq 'html') {
1.24      harris41  951: 	return $directories="\n<br />&nbsp;<br />".
                    952: 	    "<a name='files' />".
1.26      harris41  953: 	    "<font size='+2'>Files</font><br />&nbsp;<br />".
                    954: 	    "<p>All source and target locations are relative to the ".
                    955: 	    "sourceroot and targetroot values at the beginning of this ".
                    956: 	    "document.</p>".
                    957: 	    "\n<table border='1' cellpadding='5'>".
                    958: 	    "<tr><th>Status</th><th colspan='2'>Category</th>".
                    959: 	    "<th>Name/Location</th>".
                    960: 	    "<th>Description</th><th>Notes</th></tr>".
                    961: 	    "$text</table>\n".
1.24      harris41  962: 	    "\n";
                    963:     }
                    964:     elsif ($mode eq 'text') {
                    965: 	return $directories="\n".
                    966: 	    "File and Directory Structure".
                    967: 	    "\n$text\n".
                    968: 	    "\n";
1.3       harris41  969:     }
1.4       harris41  970:     elsif ($mode eq 'install') {
                    971: 	return "\n".'files:'."\n".$text.
                    972: 	    "\n".'links:'."\n".join('',@links);
                    973:     }
1.12      harris41  974:     elsif ($mode eq 'configinstall') {
                    975: 	return "\n".'configfiles: '.
                    976: 	join(' ',@configall).
1.14      harris41  977: 	"\n\n".$text.
                    978: 	"\n\nalwaysrun:\n\n";
1.12      harris41  979:     }
1.11      harris41  980:     elsif ($mode eq 'build') {
                    981: 	my $binfo;
                    982: 	my $tword;
                    983: 	my $command2;
                    984: 	my @deps;
                    985: 	foreach my $bi (@buildinfo) {
1.14      harris41  986: 	    my ($target,$source,$command,$trigger,@deps)=split(/\;/,$bi);
1.11      harris41  987: 	    $tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
1.33      harris41  988: 	    if ($command!~/\s/) {
                    989: 		$command=~s/\/([^\/]*)$//;
                    990: 		$command2="cd $command; sh ./$1;\\";
                    991: 	    }
                    992: 	    else {
                    993: 		$command=~s/(.*?\/)([^\/]+\s+.*)$/$1/;
                    994: 		$command2="cd $command; sh ./$2;\\";
                    995: 	    }
1.11      harris41  996: 	    my $depstring;
1.14      harris41  997: 	    my $depstring2="\t\t\@echo '';\\\n";
                    998: 	    my $olddep;
1.11      harris41  999: 	    foreach my $dep (@deps) {
1.14      harris41 1000: 		unless ($olddep) {
                   1001: 		    $olddep=$deps[$#deps];
                   1002: 		}
1.11      harris41 1003: 		$depstring.="\telif !(test -r $command/$dep);\\\n";
                   1004: 		$depstring.="\t\tthen echo ".
1.14      harris41 1005: 		"\"**** WARNING **** missing the file: ".
1.19      harris41 1006:  	        "$command/$dep\"$logcmd;\\\n";
1.14      harris41 1007: 		$depstring.="\t\ttest -e $source || test -e $target || echo ".
                   1008: 		    "'**** ERROR **** neither source=$source nor target=".
1.19      harris41 1009: 		    "$target exist and they cannot be built'$logcmd;\\\n";
1.14      harris41 1010: 		$depstring.="\t\tmake -f Makefile.build ${source}___DEPS;\\\n";
                   1011: 		if ($olddep) {
                   1012: 		    $depstring2.="\t\tECODE=0;\\\n";
                   1013: 		    $depstring2.="\t\t! test -e $source && test -r $command/$olddep &&".
1.19      harris41 1014: 			" { 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";
1.14      harris41 1015: 		}
                   1016: 		$olddep=$dep;
1.11      harris41 1017: 	    }
                   1018: 	    $binfo.="$source: $tword\n".
                   1019: 		"\t\@if !(echo \"\");\\\n\t\tthen echo ".
1.14      harris41 1020: 		"\"**** WARNING **** Strange shell. ".
1.19      harris41 1021:  	        "Check your path settings.\"$logcmd;\\\n".
1.11      harris41 1022: 		$depstring.
                   1023: 		"\telse \\\n\t\t$command2\n\tfi\n\n";
1.14      harris41 1024: 	    $binfo.="${source}___DEPS:\n".$depstring2."\t\tECODE=0;\n\n";
1.11      harris41 1025: 	}
                   1026: 	return 'all: '.join(' ',@buildall)."\n\n".
                   1027:   	        $text.
                   1028: 		$binfo."\n".
                   1029: 		"alwaysrun:\n\n";
                   1030:     }
1.3       harris41 1031:     else {
                   1032: 	return '';
                   1033:     }
                   1034: }
                   1035: # ---------------------------------------------------- Format fileglobs section
                   1036: sub format_fileglobs {
                   1037: 
                   1038: }
                   1039: # -------------------------------------------------------- Format links section
1.4       harris41 1040: # deprecated.. currently <link></link>'s are included in <files></files>
1.3       harris41 1041: sub format_links {
1.4       harris41 1042:     my $text=$parser->get_text('/links');
                   1043:     $parser->get_tag('/links');
                   1044:     if ($mode eq 'html') {
1.10      harris41 1045: 	return $links="\n<br />BEGIN LINKS\n$text\n<br />END LINKS\n";
1.4       harris41 1046:     }
                   1047:     elsif ($mode eq 'install') {
                   1048: 	return "\n".'links:'."\n\t".$text;
                   1049:     }
                   1050:     else {
                   1051: 	return '';
                   1052:     }
1.1       harris41 1053: }
1.3       harris41 1054: # --------------------------------------------------------- Format file section
                   1055: sub format_file {
                   1056:     my @tokeninfo=@_;
                   1057:     $file=''; $source=''; $target=''; $categoryname=''; $description='';
                   1058:     $note=''; $build=''; $status=''; $dependencies='';
                   1059:     my $text=&trim($parser->get_text('/file'));
1.14      harris41 1060:     my $buildtest;
1.29      harris41 1061:     $file_count++;
                   1062:     $categorycount{$categoryname}++;
                   1063:     # START TEMP WAY
                   1064: #    if (-T "$sourcerootarg/$source") {
                   1065: #	$linecount{$categoryname}+=`wc -l $sourcerootarg/$source`;
                   1066: #    }
                   1067: #    my $bytesize=(-s "$sourcerootarg/$source");
                   1068: #    $bytecount{$categoryname}+=$bytesize;
                   1069:     # END TEMP WAY
1.3       harris41 1070:     if ($source) {
                   1071: 	$parser->get_tag('/file');
                   1072: 	if ($mode eq 'html') {
1.26      harris41 1073: 	    return ($file="\n<!-- FILESORT:$target -->".
                   1074: 		    "<tr>".
1.32      harris41 1075: 		    "<td><!-- POSTEVAL [$categoryname] verify.pl file '$sourcerootarg' ".
1.28      harris41 1076: 		    "'$targetrootarg' ".
                   1077: 		    "'$source' '$target' ".
                   1078: 		    "$categoryhash{$categoryname} -->&nbsp;</td><td>".
1.27      harris41 1079: 		    "<img src='$fab{$categoryname}.gif' ".
1.26      harris41 1080: 		    "alt='$categoryname icon' /></td>".
1.27      harris41 1081: 		    "<td>$categoryname<br /><font size='-1'>".
                   1082: 		    $categoryhash{$categoryname}."</font></td>".
1.26      harris41 1083: 		    "<td>SOURCE: $source<br />TARGET: $target</td>".
                   1084: 		    "<td>$description</td>".
                   1085: 		    "<td>$note</td>".
                   1086: 		    "</tr>");
                   1087: #	    return ($file="\n<br />BEGIN FILE\n".
                   1088: #		"$source $target $categoryname $description $note " .
                   1089: #		"$build $status $dependencies" .
                   1090: #		"\nEND FILE");
1.3       harris41 1091: 	}
1.5       harris41 1092: 	elsif ($mode eq 'install' && $categoryname ne 'conf') {
1.14      harris41 1093: 	    if ($build) {
                   1094: 		my $bi=$sourceroot.'/'.$source.';'.$build.';'.
                   1095: 		    $dependencies;
                   1096: 		my ($source2,$command,$trigger,@deps)=split(/\;/,$bi);
                   1097: 		$tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
                   1098: 		$command=~s/\/([^\/]*)$//;
                   1099: 		$command2="cd $command; sh ./$1;\\";
                   1100: 		my $depstring;
                   1101: 		foreach my $dep (@deps) {
                   1102: 		    $depstring.=<<END;
                   1103: 		ECODE=0; DEP=''; \\
1.34    ! harris41 1104: 		test -e $dep || (echo '**** WARNING **** cannot evaluate status of dependency $dep (for building ${sourceroot}/${source} with)'$logcmd); DEP="1"; \\
        !          1105: 		[ -n DEP ] && { perl filecompare.pl -b2 $dep ${targetroot}/${target} || ECODE=\$\$?; } || DEP="1"; \\
1.14      harris41 1106: 		case "\$\$ECODE" in \\
1.34    ! harris41 1107: 			2) echo "**** WARNING **** dependency $dep is newer than target file ${targetroot}/${target}; you may want to run make build"$logcmd;; \\
1.14      harris41 1108: 		esac; \\
                   1109: END
                   1110: 		}
                   1111:                 chomp $depstring;
                   1112: 		$buildtest=<<END;
                   1113: 	\@if !(test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then \\
1.19      harris41 1114: 		echo "**** ERROR **** ${sourceroot}/${source} is missing and is also not present at target location ${targetroot}/${target}; you must run make build"$logcmd; exit; \\
1.14      harris41 1115: END
                   1116:                 $buildtest.=<<END if $depstring;
                   1117: 	elif !(test -e "${sourceroot}/${source}"); then \\
                   1118: $depstring
                   1119: END
                   1120:                 $buildtest.=<<END;
                   1121: 	fi
                   1122: END
                   1123: 	    }
1.18      harris41 1124:             my $bflag='-b1';
                   1125:             $bflag='-b3' if $dependencies or $buildlink;
1.14      harris41 1126: 	    return <<END;
1.19      harris41 1127: $buildtest	\@if !(test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then \\
                   1128: 		echo "**** ERROR **** CVS source file does not exist: ${sourceroot}/${source} and neither does target: ${targetroot}/${target}"$logcmd; \\
                   1129: 	elif !(test -e "${sourceroot}/${source}"); then \\
                   1130: 		echo "**** WARNING **** CVS source file does not exist: ${sourceroot}/${source}"$logcmd; \\
1.21      harris41 1131: 		perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\
1.14      harris41 1132: 	else \\
                   1133: 		ECODE=0; \\
                   1134: 		perl filecompare.pl $bflag ${sourceroot}/${source} ${targetroot}/${target} || ECODE=\$\$?; \\
                   1135: 		case "\$\$ECODE" in \\
                   1136: 			1) echo "${targetroot}/${target} is unchanged";; \\
1.21      harris41 1137: 			2) echo "**** WARNING **** target file ${targetroot}/${target} is newer than CVS source; saving current (old) target file to ${targetroot}/${target}.lpmlsave and then overwriting"$logcmd && install -o www -g www -m 0600 ${targetroot}/${target} ${targetroot}/${target}.lpmlsave && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\
1.27      harris41 1138: 			0) echo "install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target}" && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\
1.14      harris41 1139: 		esac; \\
1.21      harris41 1140: 		perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\
1.14      harris41 1141: 	fi
                   1142: END
1.12      harris41 1143: 	}
                   1144: 	elsif ($mode eq 'configinstall' && $categoryname eq 'conf') {
                   1145: 	    push @configall,$targetroot.'/'.$target;
1.14      harris41 1146: 	    return $targetroot.'/'.$target.': alwaysrun'."\n".
1.20      harris41 1147: 		"\t".'@echo -n ""; ECODE=0 && { perl filecompare.pl -b4 '.
                   1148: 		$sourceroot.'/'.$source.' '.$targetroot.'/'.$target.
                   1149: 		' || ECODE=$$?; } && '.
                   1150: 		'{ [ $$ECODE != "2" ] || (install '.
                   1151:                 $categoryhash{$categoryname}.' '.
1.12      harris41 1152: 		$sourceroot.'/'.$source.' '.
1.21      harris41 1153: 		$targetroot.'/'.$target.'.lpmlnew'.
1.19      harris41 1154: 		' && echo "**** NOTE: CONFIGURATION FILE CHANGE ****"'.
                   1155: 		$logcmd.' && echo "'.
1.14      harris41 1156: 		'You likely need to compare contents of '.
                   1157: 		''.$targetroot.'/'.$target.' with the new '.
1.21      harris41 1158:                 ''.$targetroot.'/'.$target.'.lpmlnew"'.
1.20      harris41 1159: 		"$logcmd); } && ".
                   1160: 		'{ [ $$ECODE != "3" ] || (install '.
                   1161:                 $categoryhash{$categoryname}.' '.
                   1162: 		$sourceroot.'/'.$source.' '.
                   1163: 		$targetroot.'/'.$target.''.
                   1164: 		' && echo "**** WARNING: NEW CONFIGURATION FILE ADDED ****"'.
                   1165: 		$logcmd.' && echo "'.
                   1166: 		'You likely need to review the contents of '.
                   1167: 		''.$targetroot.'/'.$target.' to make sure its '.
                   1168:                 'settings are compatible with your overall system"'.
                   1169: 		"$logcmd); } && ".
                   1170: 		'{ [ $$ECODE != "1" ] || ('.
                   1171: 		'echo "**** ERROR ****"'.
                   1172: 		$logcmd.' && echo "'.
                   1173: 		'Configuration source file does not exist '.
                   1174: 		''.$sourceroot.'/'.$source.'"'.
1.22      harris41 1175: 		"$logcmd); } && perl verifymodown.pl ${targetroot}/${target} \"$categoryhash{$categoryname}\"$logcmd;\n\n";
1.4       harris41 1176: 	}
1.11      harris41 1177: 	elsif ($mode eq 'build' && $build) {
                   1178: 	    push @buildall,$sourceroot.'/'.$source;
1.14      harris41 1179: 	    push @buildinfo,$targetroot.'/'.$target.';'.$sourceroot.'/'.
                   1180: 		$source.';'.$build.';'.
1.11      harris41 1181: 		$dependencies;
                   1182: #	    return '# need to build '.$source.";
                   1183: 	}
1.3       harris41 1184: 	else {
                   1185: 	    return '';
                   1186: 	}
                   1187:     }
                   1188:     return '';
                   1189: }
                   1190: # --------------------------------------------------------- Format link section
                   1191: sub format_link {
                   1192:     my @tokeninfo=@_;
1.27      harris41 1193:     $link=''; $linkto=''; $source=''; $target=''; $categoryname=''; 
                   1194:     $description=''; $note=''; $build=''; $status=''; $dependencies='';
1.3       harris41 1195:     my $text=&trim($parser->get_text('/link'));
1.29      harris41 1196:     my @links;
1.3       harris41 1197:     if ($linkto) {
                   1198: 	$parser->get_tag('/link');
                   1199: 	if ($mode eq 'html') {
1.27      harris41 1200: 	    my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target);
1.29      harris41 1201: 	    $link_count+=scalar(@targets);
1.27      harris41 1202: 	    foreach my $tgt (@targets) {
1.29      harris41 1203: 		$categorycount{$categoryname}++;
1.27      harris41 1204: 		push @links,("\n<!-- FILESORT:$tgt -->".
                   1205: 		    "<tr>".
1.32      harris41 1206: 		    "<td><!-- POSTEVAL [$categoryname] verify.pl link ".
1.28      harris41 1207: 		    "'/$targetrootarg$linkto' '/$targetrootarg$tgt' ".
                   1208: 		    "$categoryhash{$categoryname} -->&nbsp;</td><td>".
1.27      harris41 1209: 		    "<img src='$fab{$categoryname}.gif' ".
                   1210: 		    "alt='$categoryname icon' /></td>".
                   1211: 		    "<td><font size='-1'>$categoryname</font></td>".
                   1212: 		    "<td>LINKTO: $linkto<br />TARGET: $tgt</td>".
                   1213: 		    "<td>$description</td>".
                   1214: 		    "<td>$note</td>".
                   1215: 		    "</tr>");
                   1216: #		push @links,"\t".'ln -fs /'.$linkto.' /'.$targetroot.$tgt.
                   1217: #		    "\n";
                   1218: 	    }
                   1219: 	    return join('',@links);
                   1220: #	    return ($link="\n<!-- FILESORT:$target -->".
                   1221: #		    "<tr>".
                   1222: #		    "<td>&nbsp;</td><td><img src='$fab{$categoryname}.gif' ".
                   1223: #		    "alt='$categoryname icon' /></td>".
                   1224: #		    "<td>$categoryname</td>".
                   1225: #		    "<td>LINKTO: $linkto<br />TARGET: $target</td>".
                   1226: #		    "<td>$description</td>".
                   1227: #		    "<td>$note</td>".
                   1228: #		    "</tr>");
                   1229: #	    return $link="\n<tr><td colspan='6'>BEGIN LINK\n".
                   1230: #		"$linkto $target $categoryname $description $note " .
                   1231: #		"$build $status $dependencies" .
                   1232: #		    "\nEND LINK</td></tr>";
1.4       harris41 1233: 	}
                   1234: 	elsif ($mode eq 'install') {
1.10      harris41 1235: 	    my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target);
1.5       harris41 1236: 	    foreach my $tgt (@targets) {
                   1237: 		push @links,"\t".'ln -fs /'.$linkto.' /'.$targetroot.$tgt.
                   1238: 		    "\n";
                   1239: 	    }
1.4       harris41 1240: 	    return '';
1.3       harris41 1241: 	}
                   1242: 	else {
                   1243: 	    return '';
                   1244: 	}
                   1245:     }
                   1246:     return '';
                   1247: }
                   1248: # ----------------------------------------------------- Format fileglob section
                   1249: sub format_fileglob {
                   1250:     my @tokeninfo=@_;
                   1251:     $fileglob=''; $glob=''; $sourcedir='';
                   1252:     $targetdir=''; $categoryname=''; $description='';
                   1253:     $note=''; $build=''; $status=''; $dependencies='';
                   1254:     $filenames='';
                   1255:     my $text=&trim($parser->get_text('/fileglob'));
1.27      harris41 1256:     my $filenames2=$filenames;$filenames2=~s/\s//g;
1.29      harris41 1257:     $fileglob_count++;
                   1258:     my @semi=($filenames2=~/(\;)/g);
                   1259:     $fileglobnames_count+=scalar(@semi)+1;
                   1260:     $categorycount{$categoryname}+=scalar(@semi)+1;
                   1261:     # START TEMP WAY
                   1262: #    for my $f (split(/\;/,$filenames2)) {
                   1263: #	if (-T "$sourcerootarg/$sourcedir/$f") {
                   1264: #	    $linecount{$categoryname}+=`wc -l $sourcerootarg/$sourcedir/$f`;
                   1265: #	    open OUT,">>/tmp/junk123";
                   1266: #	    print OUT "$linecount{$categoryname} $categoryname $sourcerootarg/$sourcedir/$f\n";
                   1267: #	    close OUT;
                   1268: #	}
                   1269: #	my $bytesize=(-s "$sourcerootarg/$sourcedir/$f");
                   1270: #	$bytecount{$categoryname}+=$bytesize;
                   1271: #    }
                   1272:     # END TEMP WAY
1.3       harris41 1273:     if ($sourcedir) {
                   1274: 	$parser->get_tag('/fileglob');
                   1275: 	if ($mode eq 'html') {
1.27      harris41 1276: 	    return $fileglob="\n<tr>".
1.32      harris41 1277: 		"<td><!-- POSTEVAL [$categoryname] verify.pl fileglob '$sourcerootarg' ".
1.27      harris41 1278: 		"'$targetrootarg' ".
                   1279: 		"'$glob' '$sourcedir' '$filenames2' '$targetdir' ".
                   1280: 		"$categoryhash{$categoryname} -->&nbsp;</td>".
                   1281: 		"<td>"."<img src='$fab{$categoryname}.gif' ".
                   1282: 	        "alt='$categoryname icon' /></td>".
                   1283: 		"<td>$categoryname<br />".
                   1284: 		"<font size='-1'>".$categoryhash{$categoryname}."</font></td>".
                   1285: 		"<td>SOURCEDIR: $sourcedir<br />".
                   1286: 		"TARGETDIR: $targetdir<br />".
                   1287:                 "GLOB: $glob<br />".
                   1288:                 "FILENAMES: $filenames".
                   1289: 		"</td>".
                   1290: 		"<td>$description</td>".
                   1291: 		"<td>$note</td>".
                   1292: 		"</tr>";
                   1293: #	    return $fileglob="\n<tr><td colspan='6'>BEGIN FILEGLOB\n".
                   1294: #		"$glob sourcedir $targetdir $categoryname $description $note ".
                   1295: #		"$build $status $dependencies $filenames" .
                   1296: #		"\nEND FILEGLOB</td></tr>";
1.3       harris41 1297: 	}
1.5       harris41 1298: 	elsif ($mode eq 'install') {
1.30      harris41 1299: 	    my $eglob=$glob;
                   1300: 	    if ($glob eq '*') {
                   1301: 		$eglob='[^C][^V][^S]'.$glob;
                   1302: 	    }
1.5       harris41 1303: 	    return "\t".'install '.
                   1304: 		$categoryhash{$categoryname}.' '.
1.30      harris41 1305: 		$sourceroot.'/'.$sourcedir.$eglob.' '.
1.5       harris41 1306: 		$targetroot.'/'.$targetdir.'.'."\n";
                   1307: 	}
1.3       harris41 1308: 	else {
                   1309: 	    return '';
                   1310: 	}
                   1311:     }
                   1312:     return '';
                   1313: }
                   1314: # ---------------------------------------------------- Format sourcedir section
                   1315: sub format_sourcedir {
                   1316:     my @tokeninfo=@_;
                   1317:     $sourcedir='';
                   1318:     my $text=&trim($parser->get_text('/sourcedir'));
                   1319:     if ($text) {
                   1320: 	$parser->get_tag('/sourcedir');
                   1321: 	$sourcedir=$text;
                   1322:     }
                   1323:     return '';
                   1324: }
                   1325: # ------------------------------------------------------- Format target section
                   1326: sub format_target {
                   1327:     my @tokeninfo=@_;
                   1328:     $target='';
                   1329:     my $text=&trim($parser->get_text('/target'));
                   1330:     if ($text) {
                   1331: 	$parser->get_tag('/target');
                   1332: 	$target=$text;
                   1333:     }
                   1334:     return '';
                   1335: }
                   1336: # ------------------------------------------------------- Format source section
                   1337: sub format_source {
                   1338:     my @tokeninfo=@_;
                   1339:     $source='';
                   1340:     my $text=&trim($parser->get_text('/source'));
                   1341:     if ($text) {
                   1342: 	$parser->get_tag('/source');
                   1343: 	$source=$text;
                   1344:     }
                   1345:     return '';
                   1346: }
                   1347: # --------------------------------------------------------- Format note section
                   1348: sub format_note {
                   1349:     my @tokeninfo=@_;
                   1350:     $note='';
1.26      harris41 1351: #    my $text=&trim($parser->get_text('/note'));
                   1352:     my $aref;
                   1353:     my $text;
                   1354:     while ($aref=$parser->get_token()) {
                   1355: 	if ($aref->[0] eq 'E' && $aref->[1] eq 'note') {
                   1356: 	    last;
                   1357: 	}
                   1358: 	elsif ($aref->[0] eq 'S') {
                   1359: 	    $text.=$aref->[4];
                   1360: 	}
                   1361: 	elsif ($aref->[0] eq 'E') {
                   1362: 	    $text.=$aref->[2];
                   1363: 	}
                   1364: 	else {
                   1365: 	    $text.=$aref->[1];
                   1366: 	}
                   1367:     }
1.3       harris41 1368:     if ($text) {
1.26      harris41 1369: #	$parser->get_tag('/note');
1.3       harris41 1370: 	$note=$text;
                   1371:     }
                   1372:     return '';
                   1373: 
                   1374: }
                   1375: # -------------------------------------------------------- Format build section
                   1376: sub format_build {
                   1377:     my @tokeninfo=@_;
                   1378:     $build='';
                   1379:     my $text=&trim($parser->get_text('/build'));
                   1380:     if ($text) {
                   1381: 	$parser->get_tag('/build');
1.11      harris41 1382: 	$build=$sourceroot.'/'.$text.';'.$tokeninfo[2]{'trigger'};
1.3       harris41 1383:     }
                   1384:     return '';
                   1385: }
1.14      harris41 1386: # -------------------------------------------------------- Format build section
                   1387: sub format_buildlink {
                   1388:     my @tokeninfo=@_;
                   1389:     $buildlink='';
                   1390:     my $text=&trim($parser->get_text('/buildlink'));
                   1391:     if ($text) {
                   1392: 	$parser->get_tag('/buildlink');
                   1393: 	$buildlink=$sourceroot.'/'.$text;
                   1394:     }
                   1395:     return '';
                   1396: }
1.3       harris41 1397: # ------------------------------------------------------- Format status section
                   1398: sub format_status {
                   1399:     my @tokeninfo=@_;
                   1400:     $status='';
                   1401:     my $text=&trim($parser->get_text('/status'));
                   1402:     if ($text) {
                   1403: 	$parser->get_tag('/status');
                   1404: 	$status=$text;
                   1405:     }
                   1406:     return '';
                   1407: }
                   1408: # ------------------------------------------------- Format dependencies section
                   1409: sub format_dependencies {
                   1410:     my @tokeninfo=@_;
                   1411:     $dependencies='';
                   1412:     my $text=&trim($parser->get_text('/dependencies'));
                   1413:     if ($text) {
                   1414: 	$parser->get_tag('/dependencies');
1.11      harris41 1415: 	$dependencies=join(';',
                   1416: 			      (map {s/^\s*//;s/\s$//;$_} split(/\;/,$text)));
1.3       harris41 1417:     }
                   1418:     return '';
                   1419: }
                   1420: # --------------------------------------------------------- Format glob section
                   1421: sub format_glob {
                   1422:     my @tokeninfo=@_;
                   1423:     $glob='';
                   1424:     my $text=&trim($parser->get_text('/glob'));
                   1425:     if ($text) {
                   1426: 	$parser->get_tag('/glob');
                   1427: 	$glob=$text;
                   1428:     }
                   1429:     return '';
                   1430: }
                   1431: # ---------------------------------------------------- Format filenames section
                   1432: sub format_filenames {
                   1433:     my @tokeninfo=@_;
                   1434:     my $text=&trim($parser->get_text('/filenames'));
                   1435:     if ($text) {
                   1436: 	$parser->get_tag('/filenames');
                   1437: 	$filenames=$text;
                   1438:     }
1.31      harris41 1439:     return '';
                   1440: }
                   1441: # ------------------------------------------------ Format specialnotice section
                   1442: sub format_specialnotices {
                   1443:     $parser->get_tag('/specialnotices');
                   1444:     return '';
                   1445: }
                   1446: # ------------------------------------------------ Format specialnotice section
                   1447: sub format_specialnotice {
                   1448:     $parser->get_tag('/specialnotice');
1.3       harris41 1449:     return '';
                   1450: }
                   1451: # ------------------------------------------------------- Format linkto section
                   1452: sub format_linkto {
                   1453:     my @tokeninfo=@_;
                   1454:     my $text=&trim($parser->get_text('/linkto'));
                   1455:     if ($text) {
                   1456: 	$parser->get_tag('/linkto');
                   1457: 	$linkto=$text;
                   1458:     }
                   1459:     return '';
1.10      harris41 1460: }
                   1461: # ------------------------------------- Render less-than and greater-than signs
                   1462: sub htmlsafe {
                   1463:     my $text=@_[0];
                   1464:     $text =~ s/</&lt;/g;
                   1465:     $text =~ s/>/&gt;/g;
                   1466:     return $text;
1.3       harris41 1467: }
                   1468: # --------------------------------------- remove starting and ending whitespace
                   1469: sub trim {
                   1470:     my ($s)=@_; $s=~s/^\s*//; $s=~s/\s*$//; return $s;
                   1471: } 
1.14      harris41 1472: 
                   1473: # ----------------------------------- POD (plain old documentation, CPAN style)
1.18      harris41 1474: 
                   1475: =head1 NAME
                   1476: 
                   1477: lpml_parse.pl - This is meant to parse files meeting the lpml document type.
                   1478: See lpml.dtd.  LPML=Linux Packaging Markup Language.
                   1479: 
                   1480: =head1 SYNOPSIS
                   1481: 
                   1482: Usage is for lpml file to come in through standard input.
                   1483: 
                   1484: =over 4
                   1485: 
                   1486: =item *
                   1487: 
                   1488: 1st argument is the mode of parsing.
                   1489: 
                   1490: =item * 
                   1491: 
                   1492: 2nd argument is the category permissions to use (runtime or development)
                   1493: 
                   1494: =item *
                   1495: 
                   1496: 3rd argument is the distribution
                   1497: (default,redhat6.2,debian2.2,redhat7.1,etc).
                   1498: 
                   1499: =item *
                   1500: 
                   1501: 4th argument is to manually specify a sourceroot.
                   1502: 
                   1503: =item *
                   1504: 
                   1505: 5th argument is to manually specify a targetroot.
                   1506: 
                   1507: =back
                   1508: 
                   1509: Only the 1st argument is mandatory for the program to run.
                   1510: 
                   1511: Example:
                   1512: 
                   1513: cat ../../doc/loncapafiles.lpml |\\
                   1514: perl lpml_parse.pl html default /home/sherbert/loncapa /tmp/install
                   1515: 
                   1516: =head1 DESCRIPTION
                   1517: 
                   1518: I am using a multiple pass-through approach to parsing
                   1519: the lpml file.  This saves memory and makes sure the server
                   1520: will never be overloaded.
                   1521: 
                   1522: =head1 README
                   1523: 
                   1524: I am using a multiple pass-through approach to parsing
                   1525: the lpml file.  This saves memory and makes sure the server
                   1526: will never be overloaded.
                   1527: 
                   1528: =head1 PREREQUISITES
                   1529: 
                   1530: HTML::TokeParser
                   1531: 
                   1532: =head1 COREQUISITES
                   1533: 
                   1534: =head1 OSNAMES
                   1535: 
                   1536: linux
                   1537: 
                   1538: =head1 SCRIPT CATEGORIES
                   1539: 
                   1540: Packaging/Administrative
                   1541: 
                   1542: =cut

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>