File:  [LON-CAPA] / loncom / build / lpml_parse.pl
Revision 1.24: download - view: text, annotated - select for diffs
Thu Nov 29 19:00:56 2001 UTC (22 years, 6 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
implementing html and text modes necessary for filesystem monitoring -Scott

    1: #!/usr/bin/perl
    2: 
    3: # Scott Harrison
    4: # YEAR=2001
    5: # May 2001
    6: # 06/19/2001,06/20,06/24 - Scott Harrison
    7: # 9/5/2001,9/6,9/7,9/8 - Scott Harrison
    8: # 9/17,9/18 - Scott Harrison
    9: # 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison
   10: #
   11: # $Id: lpml_parse.pl,v 1.24 2001/11/29 19:00:56 harris41 Exp $
   12: ###
   13: 
   14: ###############################################################################
   15: ##                                                                           ##
   16: ## ORGANIZATION OF THIS PERL SCRIPT                                          ##
   17: ## 1. Notes                                                                  ##
   18: ## 2. Get command line arguments                                             ##
   19: ## 3. First pass through (grab distribution-specific information)            ##
   20: ## 4. Second pass through (parse out what is not necessary)                  ##
   21: ## 5. Third pass through (translate markup according to specified mode)      ##
   22: ## 6. Functions (most all just format contents of different markup tags)     ##
   23: ## 7. POD (plain old documentation, CPAN style)                              ##
   24: ##                                                                           ##
   25: ###############################################################################
   26: 
   27: # ----------------------------------------------------------------------- Notes
   28: #
   29: # I am using a multiple pass-through approach to parsing
   30: # the lpml file.  This saves memory and makes sure the server
   31: # will never be overloaded.
   32: #
   33: # This is meant to parse files meeting the lpml document type.
   34: # See lpml.dtd.  LPML=Linux Packaging Markup Language.
   35: 
   36: use HTML::TokeParser;
   37: 
   38: my $usage=<<END;
   39: **** ERROR ERROR ERROR ERROR ****
   40: Usage is for lpml file to come in through standard input.
   41: 1st argument is the mode of parsing.
   42: 2nd argument is the category permissions to use (runtime or development)
   43: 3rd argument is the distribution (default,redhat6.2,debian2.2,redhat7.1,etc).
   44: 4th argument is to manually specify a sourceroot.
   45: 5th argument is to manually specify a targetroot.
   46: 
   47: Only the 1st argument is mandatory for the program to run.
   48: 
   49: Example:
   50: 
   51: cat ../../doc/loncapafiles.lpml |\\
   52: perl lpml_parse.pl html default /home/sherbert/loncapa /tmp/install
   53: END
   54: 
   55: # ------------------------------------------------- Grab command line arguments
   56: 
   57: my $mode;
   58: if (@ARGV==5) {
   59:     $mode = shift @ARGV;
   60: }
   61: else {
   62:     @ARGV=();shift @ARGV;
   63:     while(<>){} # throw away the input to avoid broken pipes
   64:     print $usage;
   65:     exit -1; # exit with error status
   66: }
   67: 
   68: my $categorytype;
   69: if (@ARGV) {
   70:     $categorytype = shift @ARGV;
   71: }
   72: 
   73: my $dist;
   74: if (@ARGV) {
   75:     $dist = shift @ARGV;
   76: }
   77: 
   78: my $targetroot;
   79: my $sourceroot;
   80: if (@ARGV) {
   81:     $sourceroot = shift @ARGV;
   82: }
   83: if (@ARGV) {
   84:     $targetroot = shift @ARGV;
   85: }
   86: $sourceroot=~s/\/$//;
   87: $targetroot=~s/\/$//;
   88: 
   89: my $logcmd='| tee -a WARNINGS';
   90: 
   91: my $invocation;
   92: # --------------------------------------------------- Record program invocation
   93: if ($mode eq 'install' or $mode eq 'configinstall' or $mode eq 'build') {
   94:     $invocation=(<<END);
   95: # Invocation: STDINPUT | lpml_parse.pl
   96: #             1st argument (mode) is: $mode
   97: #             2nd argument (category type) is: $categorytype
   98: #             3rd argument (distribution) is: $dist
   99: #             4th argument (targetroot) is: described below
  100: #             5th argument (sourceroot) is: described below
  101: END
  102: }
  103: 
  104: # ---------------------------------------------------- Start first pass through
  105: my @parsecontents = <>;
  106: my $parsestring = join('',@parsecontents);
  107: my $outstring;
  108: 
  109: # Need to make a pass through and figure out what defaults are
  110: # overrided.  Top-down overriding strategy (leaves don't know
  111: # about distant leaves).
  112: 
  113: my @hierarchy;
  114: $hierarchy[0]=0;
  115: my $hloc=0;
  116: my $token;
  117: $parser = HTML::TokeParser->new(\$parsestring) or
  118:     die('can\'t create TokeParser object');
  119: $parser->xml_mode('1');
  120: my %hash;
  121: my $key;
  122: while ($token = $parser->get_token()) {
  123:     if ($token->[0] eq 'S') {
  124: 	$hloc++;
  125: 	$hierarchy[$hloc]++;
  126: 	$key=$token->[1].join(',',@hierarchy[0..($hloc-1)]);
  127: 	my $thisdist=' '.$token->[2]{'dist'}.' ';
  128: 	if ($thisdist eq ' default ') {
  129: 	    $hash{$key}=1; # there is a default setting for this key
  130: 	}
  131: 	elsif ($dist && $hash{$key}==1 && $thisdist=~/\s$dist\s/) {
  132: 	    $hash{$key}=2; # disregard default setting for this key if
  133: 	                   # there is a directly requested distribution match
  134: 	}
  135:     }
  136:     if ($token->[0] eq 'E') {
  137: 	$hloc--;
  138:     }
  139: }
  140: 
  141: # --------------------------------------------------- Start second pass through
  142: undef $hloc;
  143: undef @hierarchy;
  144: undef $parser;
  145: $hierarchy[0]=0;
  146: $parser = HTML::TokeParser->new(\$parsestring) or
  147:     die('can\'t create TokeParser object');
  148: $parser->xml_mode('1');
  149: my $cleanstring;
  150: while ($token = $parser->get_token()) {
  151:     if ($token->[0] eq 'S') {
  152: 	$hloc++;
  153: 	$hierarchy[$hloc]++;
  154: 	$key=$token->[1].join(',',@hierarchy[0..($hloc-1)]);
  155: 	my $thisdist=' '.$token->[2]{'dist'}.' ';
  156: 	# This conditional clause is set up to ignore two sets
  157: 	# of invalid conditions before accepting entry into
  158: 	# the cleanstring.
  159: 	if ($hash{$key}==2 and
  160: 	    !($thisdist eq '  ' or $thisdist =~/\s$dist\s/)) {
  161: 	    if ($token->[4]!~/\/>$/) {
  162: 		$parser->get_tag('/'.$token->[1]);
  163: 		$hloc--;
  164: 	    }
  165: 	}
  166: 	elsif ($thisdist ne '  ' and $thisdist!~/\s$dist\s/ and
  167: 	       !($thisdist eq ' default ' and $hash{$key}!=2)) {
  168: 	    if ($token->[4]!~/\/>$/) {
  169: 		$parser->get_tag('/'.$token->[1]);
  170: 		$hloc--;
  171: 	    }
  172: 	}
  173: 	else {
  174: 	    $cleanstring.=$token->[4];
  175: 	}
  176: 	if ($token->[4]=~/\/>$/) {
  177: 	    $hloc--;
  178: 	}
  179:     }
  180:     if ($token->[0] eq 'E') {
  181: 	$cleanstring.=$token->[2];
  182: 	$hloc--;
  183:     }
  184:     if ($token->[0] eq 'T') {
  185: 	$cleanstring.=$token->[1];
  186:     }
  187: }
  188: $cleanstring=&trim($cleanstring);
  189: $cleanstring=~s/\>\s*\n\s*\</\>\</g;
  190: 
  191: # ---------------------------------------------------- Start final pass through
  192: 
  193: # storage variables
  194: my $lpml;
  195: my $categories;
  196: my $category;
  197: my $category_att_name;
  198: my $category_att_type;
  199: my $chown;
  200: my $chmod;
  201: my $rpm;
  202: my $rpmSummary;
  203: my $rpmName;
  204: my $rpmVersion;
  205: my $rpmRelease;
  206: my $rpmVendor;
  207: my $rpmBuildRoot;
  208: my $rpmCopyright;
  209: my $rpmGroup;
  210: my $rpmSource;
  211: my $rpmAutoReqProv;
  212: my $rpmdescription;
  213: my $rpmpre;
  214: my $directories;
  215: my $directory;
  216: my $targetdirs;
  217: my $targetdir;
  218: my $categoryname;
  219: my $description;
  220: my $files;
  221: my $fileglobs;
  222: my $links;
  223: my $file;
  224: my $link;
  225: my $fileglob;
  226: my $sourcedir;
  227: my $targets;
  228: my $target;
  229: my $source;
  230: my $note;
  231: my $build;
  232: my $buildlink;
  233: my $commands;
  234: my $command;
  235: my $status;
  236: my $dependencies;
  237: my $dependency;
  238: my @links;
  239: my %categoryhash;
  240: 
  241: my @buildall;
  242: my @buildinfo;
  243: 
  244: my @configall;
  245: 
  246: # Make new parser with distribution specific input
  247: undef $parser;
  248: $parser = HTML::TokeParser->new(\$cleanstring) or
  249:     die('can\'t create TokeParser object');
  250: $parser->xml_mode('1');
  251: 
  252: # Define handling methods for mode-dependent text rendering
  253: $parser->{textify}={
  254:     targetroot => \&format_targetroot,
  255:     sourceroot => \&format_sourceroot,
  256:     categories => \&format_categories,
  257:     category => \&format_category,
  258:     targetdir => \&format_targetdir,
  259:     chown => \&format_chown,
  260:     chmod => \&format_chmod,
  261:     rpm => \&format_rpm,
  262:     rpmSummary => \&format_rpmSummary,
  263:     rpmName => \&format_rpmName,
  264:     rpmVersion => \&format_rpmVersion,
  265:     rpmRelease => \&format_rpmRelease,
  266:     rpmVendor => \&format_rpmVendor,
  267:     rpmBuildRoot => \&format_rpmBuildRoot,
  268:     rpmCopyright => \&format_rpmCopyright,
  269:     rpmGroup => \&format_rpmGroup,
  270:     rpmSource => \&format_rpmSource,
  271:     rpmAutoReqProv => \&format_rpmAutoReqProv,
  272:     rpmdescription => \&format_rpmdescription,
  273:     rpmpre => \&format_rpmpre,
  274:     directories => \&format_directories,
  275:     directory => \&format_directory,
  276:     categoryname => \&format_categoryname,
  277:     description => \&format_description,
  278:     files => \&format_files,
  279:     file => \&format_file,
  280:     fileglob => \&format_fileglob,
  281:     links => \&format_links,
  282:     link => \&format_link,
  283:     linkto => \&format_linkto,
  284:     source => \&format_source,
  285:     target => \&format_target,
  286:     note => \&format_note,
  287:     build => \&format_build,
  288:     status => \&format_status,
  289:     dependencies => \&format_dependencies,
  290:     buildlink => \&format_buildlink,
  291:     glob => \&format_glob,
  292:     sourcedir => \&format_sourcedir,
  293:     filenames => \&format_filenames,
  294:     };
  295: 
  296: my $text;
  297: my $token;
  298: undef $hloc;
  299: undef @hierarchy;
  300: my $hloc;
  301: my @hierarchy2;
  302: while ($token = $parser->get_tag('lpml')) {
  303:     &format_lpml(@{$token});
  304:     $text = &trim($parser->get_text('/lpml'));
  305:     $token = $parser->get_tag('/lpml');
  306:     print $lpml; 
  307:     print "\n";
  308: #    $text=~s/\s*\n\s*\n\s*/\n/g;
  309:     print $text;
  310:     print "\n";
  311:     print &end();
  312: }
  313: exit;
  314: 
  315: # ---------- Functions (most all just format contents of different markup tags)
  316: 
  317: # ------------------------ Final output at end of markup parsing and formatting
  318: sub end {
  319:     if ($mode eq 'html') {
  320: 	return "</body></html>\n";
  321:     }
  322:     if ($mode eq 'install') {
  323: 	return '';
  324:     }
  325: }
  326: 
  327: # ----------------------- Take in string to parse and the separation expression
  328: sub extract_array {
  329:     my ($stringtoparse,$sepexp) = @_;
  330:     my @a=split(/$sepexp/,$stringtoparse);
  331:     return \@a;
  332: }
  333: 
  334: # --------------------------------------------------------- Format lpml section
  335: sub format_lpml {
  336:     my (@tokeninfo)=@_;
  337:     my $date=`date`; chop $date;
  338:     if ($mode eq 'html') {
  339: 	$lpml=<<END;
  340: <html>
  341: <head>
  342: <title>LPML Description Page (dist=$dist, $date)</title>
  343: </head>
  344: <body>
  345: END
  346: 	$lpml .= "<br /><font size='+2'>LPML Description Page (dist=$dist, ".
  347: 	    "$date)".
  348: 	    "</font>";
  349: 	$lpml .=<<END;
  350: <ul>
  351: <li><a href='#about'>About this file</a></li>
  352: <li><a href='#ownperms'>File Type Ownership and Permissions
  353: Descriptions</a></li>
  354: <li><a href='#package'>Software Package Description</a></li>
  355: <li><a href='#directories'>Directory Structure</a></li>
  356: <li><a href='#files'>File and Directory Structure</a></li>
  357: </ul>
  358: END
  359:         $lpml .=<<END;
  360: <br />&nbsp;<br /><a name='about' />
  361: <font size='+2'>About this file</font>
  362: <p>
  363: This file is generated dynamically by <tt>lpml_parse.pl</tt> as
  364: part of a development compilation process.  Author: Scott
  365: Harrison (harris41\@msu.edu).
  366: </p>
  367: END
  368:     }
  369:     elsif ($mode eq 'text') {
  370: 	$lpml = "LPML Description Page (dist=$dist, $date)";
  371: 	$lpml .=<<END;
  372: 
  373: * About this file
  374: * Software Package Description
  375: * Directory Structure
  376: * File Type Ownership and Permissions
  377: * File and Directory Structure
  378: END
  379:         $lpml .=<<END;
  380: 
  381: About this file
  382: 
  383: This file is generated dynamically by lpml_parse.pl as
  384: part of a development compilation process.  Author: Scott
  385: Harrison (harris41\@msu.edu).
  386: 
  387: END
  388:     }
  389:     elsif ($mode eq 'install') {
  390: 	print '# LPML install targets. Linux Packaging Markup Language,';
  391: 	print ' by Scott Harrison 2001'."\n";
  392: 	print '# This file was automatically generated on '.`date`;
  393: 	print "\n".$invocation;
  394: 	$lpml .= "SHELL=\"/bin/bash\"\n\n";
  395:     }
  396:     elsif ($mode eq 'configinstall') {
  397: 	print '# LPML configuration file targets (configinstall).'."\n";
  398: 	print '# Linux Packaging Markup Language,';
  399: 	print ' by Scott Harrison 2001'."\n";
  400: 	print '# This file was automatically generated on '.`date`;
  401: 	print "\n".$invocation;
  402: 	$lpml .= "SHELL=\"/bin/bash\"\n\n";
  403:     }
  404:     elsif ($mode eq 'build') {
  405: 	$lpml = "# LPML build targets. Linux Packaging Markup Language,";
  406: 	$lpml .= ' by Scott Harrison 2001'."\n";
  407: 	$lpml .= '# This file was automatically generated on '.`date`;
  408: 	$lpml .= "\n".$invocation;
  409: 	$lpml .= "SHELL=\"/bin/sh\"\n\n";
  410:     }
  411:     else {
  412: 	return '';
  413:     }
  414: }
  415: # --------------------------------------------------- Format targetroot section
  416: sub format_targetroot {
  417:     my $text=&trim($parser->get_text('/targetroot'));
  418:     $text=$targetroot if $targetroot;
  419:     $parser->get_tag('/targetroot');
  420:     if ($mode eq 'html') {
  421: 	return $targetroot="\n<br />TARGETROOT: $text";
  422:     }
  423:     elsif ($mode eq 'install' or $mode eq 'build' or
  424: 	   $mode eq 'configinstall') {
  425: 	return '# TARGET INSTALL LOCATION is "'.$targetroot."\"\n";
  426:     }
  427:     else {
  428: 	return '';
  429:     }
  430: }
  431: # --------------------------------------------------- Format sourceroot section
  432: sub format_sourceroot {
  433:     my $text=&trim($parser->get_text('/sourceroot'));
  434:     $text=$sourceroot if $sourceroot;
  435:     $parser->get_tag('/sourceroot');
  436:     if ($mode eq 'html') {
  437: 	return $sourceroot="\n<br />SOURCEROOT: $text";
  438:     }
  439:     elsif ($mode eq 'install' or $mode eq 'build' or
  440: 	   $mode eq 'configinstall') {
  441: 	return '# SOURCE CODE LOCATION IS "'.$sourceroot."\"\n";;
  442:     }
  443:     else {
  444: 	return '';
  445:     }
  446: }
  447: # --------------------------------------------------- Format categories section
  448: sub format_categories {
  449:     my $text=&trim($parser->get_text('/categories'));
  450:     $parser->get_tag('/categories');
  451:     if ($mode eq 'html') {
  452: 	return $categories="\n<br />&nbsp;<br />".
  453: 	    "\n<a name='ownperms'>".
  454: 	    "\n<font size='+2'>File Type Ownership and Permissions".
  455: 	    " Descriptions</font>".
  456: 	    "\n<table>\n".
  457: 	    "<br />\n$text\n".
  458: 	    "</table>\n";
  459:     }
  460:     elsif ($mode eq 'text') {
  461: 	return $categories="\n".
  462: 	    "\nFile Type Ownership and Permissions".
  463: 	    " Descriptions".
  464: 	    "\n";
  465:     }
  466:     else {
  467: 	return '';
  468:     }
  469: }
  470: # --------------------------------------------------- Format categories section
  471: sub format_category {
  472:     my (@tokeninfo)=@_;
  473:     $category_att_name=$tokeninfo[2]->{'name'};
  474:     $category_att_type=$tokeninfo[2]->{'type'};
  475:     $chmod='';$chown='';
  476:     $parser->get_text('/category');
  477:     $parser->get_tag('/category');
  478:     if ($mode eq 'html') {
  479: 	return $category="\n<br />CATEGORY $category_att_name ".
  480: 	    "$category_att_type $chmod $chown";
  481:     }
  482:     else {
  483: 	if ($category_att_type eq $categorytype) {
  484: 	    my ($user,$group)=split(/\:/,$chown);
  485: 	    $categoryhash{$category_att_name}='-o '.$user.' -g '.$group.
  486: 		' -m '.$chmod;
  487: 	}
  488: 	return '';
  489:     }
  490: }
  491: # -------------------------------------------------------- Format chown section
  492: sub format_chown {
  493:     my @tokeninfo=@_;
  494:     $chown='';
  495:     my $text=&trim($parser->get_text('/chown'));
  496:     if ($text) {
  497: 	$parser->get_tag('/chown');
  498: 	$chown=$text;
  499:     }
  500:     return '';
  501: }
  502: # -------------------------------------------------------- Format chmod section
  503: sub format_chmod {
  504:     my @tokeninfo=@_;
  505:     $chmod='';
  506:     my $text=&trim($parser->get_text('/chmod'));
  507:     if ($text) {
  508: 	$parser->get_tag('/chmod');
  509: 	$chmod=$text;
  510:     }
  511:     return '';
  512: }
  513: # ---------------------------------------------------------- Format rpm section
  514: sub format_rpm {
  515:     my $text=&trim($parser->get_text('/rpm'));
  516:     $parser->get_tag('/rpm');
  517:     if ($mode eq 'html') {
  518: 	return $rpm=<<END;
  519: <br />&nbsp;<br />
  520: <a name='package' />
  521: <font size='+2'>Software Package Description</font>
  522: <p>
  523: <table bgcolor='#ffffff' border='0' cellpadding='10' cellspacing='0'>
  524: <tr><td><pre>
  525: $text
  526: </pre></td></tr>
  527: </table>
  528: END
  529:     }
  530:     elsif ($mode eq 'text') {
  531: 	return $rpm=<<END;
  532: Software Package Description
  533: 
  534: $text
  535: END
  536:     }
  537:     else {
  538: 	return '';
  539:     }
  540: }
  541: # --------------------------------------------------- Format rpmSummary section
  542: sub format_rpmSummary {
  543:     my $text=&trim($parser->get_text('/rpmSummary'));
  544:     $parser->get_tag('/rpmSummary');
  545:     if ($mode eq 'html') {
  546: 	return $rpmSummary="\nSummary     : $text";
  547:     }
  548:     elsif ($mode eq 'text') {
  549: 	return $rpmSummary="\nSummary     : $text";
  550:     }
  551:     else {
  552: 	return '';
  553:     }
  554: }
  555: # ------------------------------------------------------ Format rpmName section
  556: sub format_rpmName {
  557:     my $text=&trim($parser->get_text('/rpmName'));
  558:     $parser->get_tag('/rpmName');
  559:     if ($mode eq 'html') {
  560: 	return $rpmName="\nName        : $text";
  561:     }
  562:     elsif ($mode eq 'text') {
  563: 	return $rpmName="\nName        : $text";
  564:     }
  565:     else {
  566: 	return '';
  567:     }
  568: }
  569: # --------------------------------------------------- Format rpmVersion section
  570: sub format_rpmVersion {
  571:     my $text=$parser->get_text('/rpmVersion');
  572:     $parser->get_tag('/rpmVersion');
  573:     if ($mode eq 'html') {
  574: 	return $rpmVersion="\nVersion     : $text";
  575:     }
  576:     elsif ($mode eq 'text') {
  577: 	return $rpmVersion="\nVersion     : $text";
  578:     }
  579:     else {
  580: 	return '';
  581:     }
  582: }
  583: # --------------------------------------------------- Format rpmRelease section
  584: sub format_rpmRelease {
  585:     my $text=$parser->get_text('/rpmRelease');
  586:     $parser->get_tag('/rpmRelease');
  587:     if ($mode eq 'html') {
  588: 	return $rpmRelease="\nRelease     : $text";
  589:     }
  590:     elsif ($mode eq 'text') {
  591: 	return $rpmRelease="\nRelease     : $text";
  592:     }
  593:     else {
  594: 	return '';
  595:     }
  596: }
  597: # ---------------------------------------------------- Format rpmVendor section
  598: sub format_rpmVendor {
  599:     my $text=$parser->get_text('/rpmVendor');
  600:     $parser->get_tag('/rpmVendor');
  601:     if ($mode eq 'html') {
  602: 	return $rpmVendor="\nVendor      : $text";
  603:     }
  604:     elsif ($mode eq 'text') {
  605: 	return $rpmVendor="\nVendor      : $text";
  606:     }
  607:     else {
  608: 	return '';
  609:     }
  610: }
  611: # ------------------------------------------------- Format rpmBuildRoot section
  612: sub format_rpmBuildRoot {
  613:     my $text=$parser->get_text('/rpmBuildRoot');
  614:     $parser->get_tag('/rpmBuildRoot');
  615:     if ($mode eq 'html') {
  616: 	return $rpmBuildRoot="\nBuild Root  : $text";
  617:     }
  618:     elsif ($mode eq 'text') {
  619: 	return $rpmBuildRoot="\nBuild Root  : $text";
  620:     }
  621:     else {
  622: 	return '';
  623:     }
  624: }
  625: # ------------------------------------------------- Format rpmCopyright section
  626: sub format_rpmCopyright {
  627:     my $text=$parser->get_text('/rpmCopyright');
  628:     $parser->get_tag('/rpmCopyright');
  629:     if ($mode eq 'html') {
  630: 	return $rpmCopyright="\nLicense     : $text";
  631:     }
  632:     elsif ($mode eq 'text') {
  633: 	return $rpmCopyright="\nLicense     : $text";
  634:     }
  635:     else {
  636: 	return '';
  637:     }
  638: }
  639: # ----------------------------------------------------- Format rpmGroup section
  640: sub format_rpmGroup {
  641:     my $text=$parser->get_text('/rpmGroup');
  642:     $parser->get_tag('/rpmGroup');
  643:     if ($mode eq 'html') {
  644: 	return $rpmGroup="\nGroup       : $text";
  645:     }
  646:     elsif ($mode eq 'text') {
  647: 	return $rpmGroup="\nGroup       : $text";
  648:     }
  649:     else {
  650: 	return '';
  651:     }
  652: }
  653: # ---------------------------------------------------- Format rpmSource section
  654: sub format_rpmSource {
  655:     my $text=$parser->get_text('/rpmSource');
  656:     $parser->get_tag('/rpmSource');
  657:     if ($mode eq 'html') {
  658: 	return $rpmSource="\nSource      : $text";
  659:     }
  660:     elsif ($mode eq 'text') {
  661: 	return $rpmSource="\nSource      : $text";
  662:     }
  663:     else {
  664: 	return '';
  665:     }
  666: }
  667: # ----------------------------------------------- Format rpmAutoReqProv section
  668: sub format_rpmAutoReqProv {
  669:     my $text=$parser->get_text('/rpmAutoReqProv');
  670:     $parser->get_tag('/rpmAutoReqProv');
  671:     if ($mode eq 'html') {
  672: 	return $rpmAutoReqProv="\nAutoReqProv : $text";
  673:     }
  674:     if ($mode eq 'text') {
  675: 	return $rpmAutoReqProv="\nAutoReqProv : $text";
  676:     }
  677:     else {
  678: 	return '';
  679:     }
  680: }
  681: # ----------------------------------------------- Format rpmdescription section
  682: sub format_rpmdescription {
  683:     my $text=$parser->get_text('/rpmdescription');
  684:     $parser->get_tag('/rpmdescription');
  685:     $text=~s/\n//g;
  686:     $text=~s/\\n/\n/g;
  687:     if ($mode eq 'html') {
  688: 	return $rpmdescription="\nDescription : $text";
  689:     }
  690:     elsif ($mode eq 'text') {
  691: 	return $rpmdescription="\nDescription : $text";
  692:     }
  693:     else {
  694: 	return '';
  695:     }
  696: }
  697: # ------------------------------------------------------- Format rpmpre section
  698: sub format_rpmpre {
  699:     my $text=$parser->get_text('/rpmpre');
  700:     $parser->get_tag('/rpmpre');
  701:     if ($mode eq 'html') {
  702: #	return $rpmpre="\n<br />RPMPRE $text";
  703: 	return '';
  704:     }
  705:     else {
  706: 	return '';
  707:     }
  708: }
  709: # -------------------------------------------------- Format directories section
  710: sub format_directories {
  711:     my $text=$parser->get_text('/directories');
  712:     $parser->get_tag('/directories');
  713:     if ($mode eq 'html') {
  714: 	return $directories="\n<br />&nbsp;<br />".
  715: 	    "<a name='directories' />".
  716: 	    "<font size='+2'>Directory Structure</font>".
  717: 	    "\n$text\n<br />".
  718: 	    "\n";
  719:     }
  720:     elsif ($mode eq 'text') {
  721: 	return $directories="\nDirectory Structure\n$text\n".
  722: 	    "\n";
  723:     }
  724:     elsif ($mode eq 'install') {
  725: 	return "\n".'directories:'."\n".$text;
  726:    }
  727:     else {
  728: 	return '';
  729:     }
  730: }
  731: # ---------------------------------------------------- Format directory section
  732: sub format_directory {
  733:     my (@tokeninfo)=@_;
  734:     $targetdir='';$categoryname='';$description='';
  735:     $parser->get_text('/directory');
  736:     $parser->get_tag('/directory');
  737:     if ($mode eq 'html') {
  738: 	return $directory="\n<br />DIRECTORY $targetdir $categoryname ".
  739: 	    "$description";
  740:     }
  741:     elsif ($mode eq 'install') {
  742: 	return "\t".'install '.$categoryhash{$categoryname}.' -d '.
  743: 	    $targetroot.'/'.$targetdir."\n";
  744:     }
  745:     else {
  746: 	return '';
  747:     }
  748: }
  749: # ---------------------------------------------------- Format targetdir section
  750: sub format_targetdir {
  751:     my @tokeninfo=@_;
  752:     $targetdir='';
  753:     my $text=&trim($parser->get_text('/targetdir'));
  754:     if ($text) {
  755: 	$parser->get_tag('/targetdir');
  756: 	$targetdir=$text;
  757:     }
  758:     return '';
  759: }
  760: # ------------------------------------------------- Format categoryname section
  761: sub format_categoryname {
  762:     my @tokeninfo=@_;
  763:     $categoryname='';
  764:     my $text=&trim($parser->get_text('/categoryname'));
  765:     if ($text) {
  766: 	$parser->get_tag('/categoryname');
  767: 	$categoryname=$text;
  768:     }
  769:     return '';
  770: }
  771: # -------------------------------------------------- Format description section
  772: sub format_description {
  773:     my @tokeninfo=@_;
  774:     $description='';
  775:     my $text=&htmlsafe(&trim($parser->get_text('/description')));
  776:     if ($text) {
  777: 	$parser->get_tag('/description');
  778: 	$description=$text;
  779:     }
  780:     return '';
  781: }
  782: # -------------------------------------------------------- Format files section
  783: sub format_files {
  784:     my $text=$parser->get_text('/files');
  785:     $parser->get_tag('/files');
  786:     if ($mode eq 'html') {
  787: 	return $directories="\n<br />&nbsp;<br />".
  788: 	    "<a name='files' />".
  789: 	    "<font size='+2'>File and Directory Structure</font>".
  790: 	    "\n$text\n<br />".
  791: 	    "\n";
  792:     }
  793:     elsif ($mode eq 'text') {
  794: 	return $directories="\n".
  795: 	    "File and Directory Structure".
  796: 	    "\n$text\n".
  797: 	    "\n";
  798:     }
  799:     elsif ($mode eq 'install') {
  800: 	return "\n".'files:'."\n".$text.
  801: 	    "\n".'links:'."\n".join('',@links);
  802:     }
  803:     elsif ($mode eq 'configinstall') {
  804: 	return "\n".'configfiles: '.
  805: 	join(' ',@configall).
  806: 	"\n\n".$text.
  807: 	"\n\nalwaysrun:\n\n";
  808:     }
  809:     elsif ($mode eq 'build') {
  810: 	my $binfo;
  811: 	my $tword;
  812: 	my $command2;
  813: 	my @deps;
  814: 	foreach my $bi (@buildinfo) {
  815: 	    my ($target,$source,$command,$trigger,@deps)=split(/\;/,$bi);
  816: 	    $tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
  817: 	    $command=~s/\/([^\/]*)$//;
  818: 	    $command2="cd $command; sh ./$1;\\";
  819: 	    my $depstring;
  820: 	    my $depstring2="\t\t\@echo '';\\\n";
  821: 	    my $olddep;
  822: 	    foreach my $dep (@deps) {
  823: 		unless ($olddep) {
  824: 		    $olddep=$deps[$#deps];
  825: 		}
  826: 		$depstring.="\telif !(test -r $command/$dep);\\\n";
  827: 		$depstring.="\t\tthen echo ".
  828: 		"\"**** WARNING **** missing the file: ".
  829:  	        "$command/$dep\"$logcmd;\\\n";
  830: 		$depstring.="\t\ttest -e $source || test -e $target || echo ".
  831: 		    "'**** ERROR **** neither source=$source nor target=".
  832: 		    "$target exist and they cannot be built'$logcmd;\\\n";
  833: 		$depstring.="\t\tmake -f Makefile.build ${source}___DEPS;\\\n";
  834: 		if ($olddep) {
  835: 		    $depstring2.="\t\tECODE=0;\\\n";
  836: 		    $depstring2.="\t\t! test -e $source && test -r $command/$olddep &&".
  837: 			" { 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";
  838: 		}
  839: 		$olddep=$dep;
  840: 	    }
  841: 	    $binfo.="$source: $tword\n".
  842: 		"\t\@if !(echo \"\");\\\n\t\tthen echo ".
  843: 		"\"**** WARNING **** Strange shell. ".
  844:  	        "Check your path settings.\"$logcmd;\\\n".
  845: 		$depstring.
  846: 		"\telse \\\n\t\t$command2\n\tfi\n\n";
  847: 	    $binfo.="${source}___DEPS:\n".$depstring2."\t\tECODE=0;\n\n";
  848: 	}
  849: 	return 'all: '.join(' ',@buildall)."\n\n".
  850:   	        $text.
  851: 		$binfo."\n".
  852: 		"alwaysrun:\n\n";
  853:     }
  854:     else {
  855: 	return '';
  856:     }
  857: }
  858: # ---------------------------------------------------- Format fileglobs section
  859: sub format_fileglobs {
  860: 
  861: }
  862: # -------------------------------------------------------- Format links section
  863: # deprecated.. currently <link></link>'s are included in <files></files>
  864: sub format_links {
  865:     my $text=$parser->get_text('/links');
  866:     $parser->get_tag('/links');
  867:     if ($mode eq 'html') {
  868: 	return $links="\n<br />BEGIN LINKS\n$text\n<br />END LINKS\n";
  869:     }
  870:     elsif ($mode eq 'install') {
  871: 	return "\n".'links:'."\n\t".$text;
  872:     }
  873:     else {
  874: 	return '';
  875:     }
  876: }
  877: # --------------------------------------------------------- Format file section
  878: sub format_file {
  879:     my @tokeninfo=@_;
  880:     $file=''; $source=''; $target=''; $categoryname=''; $description='';
  881:     $note=''; $build=''; $status=''; $dependencies='';
  882:     my $text=&trim($parser->get_text('/file'));
  883:     my $buildtest;
  884:     if ($source) {
  885: 	$parser->get_tag('/file');
  886: 	if ($mode eq 'html') {
  887: 	    return ($file="\n<br />BEGIN FILE\n".
  888: 		"$source $target $categoryname $description $note " .
  889: 		"$build $status $dependencies" .
  890: 		"\nEND FILE");
  891: 	}
  892: 	elsif ($mode eq 'install' && $categoryname ne 'conf') {
  893: 	    if ($build) {
  894: 		my $bi=$sourceroot.'/'.$source.';'.$build.';'.
  895: 		    $dependencies;
  896: 		my ($source2,$command,$trigger,@deps)=split(/\;/,$bi);
  897: 		$tword=''; $tword=' alwaysrun' if $trigger eq 'always run'; 
  898: 		$command=~s/\/([^\/]*)$//;
  899: 		$command2="cd $command; sh ./$1;\\";
  900: 		my $depstring;
  901: 		foreach my $dep (@deps) {
  902: 		    $depstring.=<<END;
  903: 		ECODE=0; DEP=''; \\
  904: 		test -e $command/$dep || (echo '**** WARNING **** cannot evaluate status of dependency $command/$dep (for building ${sourceroot}/${source} with)'$logcmd); DEP="1"; \\
  905: 		[ -n DEP ] && { perl filecompare.pl -b2 $command/$dep ${targetroot}/${target} || ECODE=\$\$?; } || DEP="1"; \\
  906: 		case "\$\$ECODE" in \\
  907: 			2) echo "**** WARNING **** dependency $command/$dep is newer than target file ${targetroot}/${target}; you may want to run make build"$logcmd;; \\
  908: 		esac; \\
  909: END
  910: 		}
  911:                 chomp $depstring;
  912: 		$buildtest=<<END;
  913: 	\@if !(test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then \\
  914: 		echo "**** ERROR **** ${sourceroot}/${source} is missing and is also not present at target location ${targetroot}/${target}; you must run make build"$logcmd; exit; \\
  915: END
  916:                 $buildtest.=<<END if $depstring;
  917: 	elif !(test -e "${sourceroot}/${source}"); then \\
  918: $depstring
  919: END
  920:                 $buildtest.=<<END;
  921: 	fi
  922: END
  923: 	    }
  924:             my $bflag='-b1';
  925:             $bflag='-b3' if $dependencies or $buildlink;
  926: 	    return <<END;
  927: $buildtest	\@if !(test -e "${sourceroot}/${source}") && !(test -e "${targetroot}/${target}"); then \\
  928: 		echo "**** ERROR **** CVS source file does not exist: ${sourceroot}/${source} and neither does target: ${targetroot}/${target}"$logcmd; \\
  929: 	elif !(test -e "${sourceroot}/${source}"); then \\
  930: 		echo "**** WARNING **** CVS source file does not exist: ${sourceroot}/${source}"$logcmd; \\
  931: 		perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\
  932: 	else \\
  933: 		ECODE=0; \\
  934: 		perl filecompare.pl $bflag ${sourceroot}/${source} ${targetroot}/${target} || ECODE=\$\$?; \\
  935: 		case "\$\$ECODE" in \\
  936: 			1) echo "${targetroot}/${target} is unchanged";; \\
  937: 			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};; \\
  938: 			0) echo "install $categoryhash{$categorname} ${sourceroot}/${source} ${targetroot}/${target}" && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\
  939: 		esac; \\
  940: 		perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\
  941: 	fi
  942: END
  943: #	    return "\t".'@test -e '.$sourceroot.'/'.$source.
  944: #		' && perl filecompare.pl -b '.$sourceroot.'/'.$source.' '.
  945: #		$targetroot.'/'.$target.
  946: #		' && install '.
  947: #		$categoryhash{$categoryname}.' '.
  948: #		$sourceroot.'/'.$source.' '.
  949: #		$targetroot.'/'.$target.
  950: #		' || echo "**** WARNING '.
  951: #		'**** CVS source file does not exist: '.$sourceroot.'/'.
  952: #		$source.'"'."\n";
  953: 	}
  954: 	elsif ($mode eq 'configinstall' && $categoryname eq 'conf') {
  955: 	    push @configall,$targetroot.'/'.$target;
  956: 	    return $targetroot.'/'.$target.': alwaysrun'."\n".
  957: 		"\t".'@echo -n ""; ECODE=0 && { perl filecompare.pl -b4 '.
  958: 		$sourceroot.'/'.$source.' '.$targetroot.'/'.$target.
  959: 		' || ECODE=$$?; } && '.
  960: 		'{ [ $$ECODE != "2" ] || (install '.
  961:                 $categoryhash{$categoryname}.' '.
  962: 		$sourceroot.'/'.$source.' '.
  963: 		$targetroot.'/'.$target.'.lpmlnew'.
  964: 		' && echo "**** NOTE: CONFIGURATION FILE CHANGE ****"'.
  965: 		$logcmd.' && echo "'.
  966: 		'You likely need to compare contents of '.
  967: 		''.$targetroot.'/'.$target.' with the new '.
  968:                 ''.$targetroot.'/'.$target.'.lpmlnew"'.
  969: 		"$logcmd); } && ".
  970: 		'{ [ $$ECODE != "3" ] || (install '.
  971:                 $categoryhash{$categoryname}.' '.
  972: 		$sourceroot.'/'.$source.' '.
  973: 		$targetroot.'/'.$target.''.
  974: 		' && echo "**** WARNING: NEW CONFIGURATION FILE ADDED ****"'.
  975: 		$logcmd.' && echo "'.
  976: 		'You likely need to review the contents of '.
  977: 		''.$targetroot.'/'.$target.' to make sure its '.
  978:                 'settings are compatible with your overall system"'.
  979: 		"$logcmd); } && ".
  980: 		'{ [ $$ECODE != "1" ] || ('.
  981: 		'echo "**** ERROR ****"'.
  982: 		$logcmd.' && echo "'.
  983: 		'Configuration source file does not exist '.
  984: 		''.$sourceroot.'/'.$source.'"'.
  985: 		"$logcmd); } && perl verifymodown.pl ${targetroot}/${target} \"$categoryhash{$categoryname}\"$logcmd;\n\n";
  986: 	}
  987: 	elsif ($mode eq 'build' && $build) {
  988: 	    push @buildall,$sourceroot.'/'.$source;
  989: 	    push @buildinfo,$targetroot.'/'.$target.';'.$sourceroot.'/'.
  990: 		$source.';'.$build.';'.
  991: 		$dependencies;
  992: #	    return '# need to build '.$source.";
  993: 	}
  994: 	else {
  995: 	    return '';
  996: 	}
  997:     }
  998:     return '';
  999: }
 1000: # --------------------------------------------------------- Format link section
 1001: sub format_link {
 1002:     my @tokeninfo=@_;
 1003:     $link=''; $linkto=''; $target=''; $categoryname=''; $description='';
 1004:     $note=''; $build=''; $status=''; $dependencies='';
 1005:     my $text=&trim($parser->get_text('/link'));
 1006:     if ($linkto) {
 1007: 	$parser->get_tag('/link');
 1008: 	if ($mode eq 'html') {
 1009: 	    return $link="\n<br />BEGIN LINK\n".
 1010: 		"$linkto $target $categoryname $description $note " .
 1011: 		"$build $status $dependencies" .
 1012: 		    "\nEND LINK";
 1013: 	}
 1014: 	elsif ($mode eq 'install') {
 1015: 	    my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target);
 1016: 	    foreach my $tgt (@targets) {
 1017: 		push @links,"\t".'ln -fs /'.$linkto.' /'.$targetroot.$tgt.
 1018: 		    "\n";
 1019: 	    }
 1020: 	    return '';
 1021: 	}
 1022: 	else {
 1023: 	    return '';
 1024: 	}
 1025:     }
 1026:     return '';
 1027: }
 1028: # ----------------------------------------------------- Format fileglob section
 1029: sub format_fileglob {
 1030:     my @tokeninfo=@_;
 1031:     $fileglob=''; $glob=''; $sourcedir='';
 1032:     $targetdir=''; $categoryname=''; $description='';
 1033:     $note=''; $build=''; $status=''; $dependencies='';
 1034:     $filenames='';
 1035:     my $text=&trim($parser->get_text('/fileglob'));
 1036:     if ($sourcedir) {
 1037: 	$parser->get_tag('/fileglob');
 1038: 	if ($mode eq 'html') {
 1039: 	    return $fileglob="\n<br />BEGIN FILEGLOB\n".
 1040: 		"$glob sourcedir $targetdir $categoryname $description $note ".
 1041: 		"$build $status $dependencies $filenames" .
 1042: 		    "\nEND FILEGLOB";
 1043: 	}
 1044: 	elsif ($mode eq 'install') {
 1045: 	    return "\t".'install '.
 1046: 		$categoryhash{$categoryname}.' '.
 1047: 		$sourceroot.'/'.$sourcedir.'[^C][^V][^S]'.$glob.' '.
 1048: 		$targetroot.'/'.$targetdir.'.'."\n";
 1049: 	}
 1050: 	else {
 1051: 	    return '';
 1052: 	}
 1053:     }
 1054:     return '';
 1055: }
 1056: # ---------------------------------------------------- Format sourcedir section
 1057: sub format_sourcedir {
 1058:     my @tokeninfo=@_;
 1059:     $sourcedir='';
 1060:     my $text=&trim($parser->get_text('/sourcedir'));
 1061:     if ($text) {
 1062: 	$parser->get_tag('/sourcedir');
 1063: 	$sourcedir=$text;
 1064:     }
 1065:     return '';
 1066: }
 1067: # ------------------------------------------------------- Format target section
 1068: sub format_target {
 1069:     my @tokeninfo=@_;
 1070:     $target='';
 1071:     my $text=&trim($parser->get_text('/target'));
 1072:     if ($text) {
 1073: 	$parser->get_tag('/target');
 1074: 	$target=$text;
 1075:     }
 1076:     return '';
 1077: }
 1078: # ------------------------------------------------------- Format source section
 1079: sub format_source {
 1080:     my @tokeninfo=@_;
 1081:     $source='';
 1082:     my $text=&trim($parser->get_text('/source'));
 1083:     if ($text) {
 1084: 	$parser->get_tag('/source');
 1085: 	$source=$text;
 1086:     }
 1087:     return '';
 1088: }
 1089: # --------------------------------------------------------- Format note section
 1090: sub format_note {
 1091:     my @tokeninfo=@_;
 1092:     $note='';
 1093:     my $text=&trim($parser->get_text('/note'));
 1094:     if ($text) {
 1095: 	$parser->get_tag('/note');
 1096: 	$note=$text;
 1097:     }
 1098:     return '';
 1099: 
 1100: }
 1101: # -------------------------------------------------------- Format build section
 1102: sub format_build {
 1103:     my @tokeninfo=@_;
 1104:     $build='';
 1105:     my $text=&trim($parser->get_text('/build'));
 1106:     if ($text) {
 1107: 	$parser->get_tag('/build');
 1108: 	$build=$sourceroot.'/'.$text.';'.$tokeninfo[2]{'trigger'};
 1109:     }
 1110:     return '';
 1111: }
 1112: # -------------------------------------------------------- Format build section
 1113: sub format_buildlink {
 1114:     my @tokeninfo=@_;
 1115:     $buildlink='';
 1116:     my $text=&trim($parser->get_text('/buildlink'));
 1117:     if ($text) {
 1118: 	$parser->get_tag('/buildlink');
 1119: 	$buildlink=$sourceroot.'/'.$text;
 1120:     }
 1121:     return '';
 1122: }
 1123: # ------------------------------------------------------- Format status section
 1124: sub format_status {
 1125:     my @tokeninfo=@_;
 1126:     $status='';
 1127:     my $text=&trim($parser->get_text('/status'));
 1128:     if ($text) {
 1129: 	$parser->get_tag('/status');
 1130: 	$status=$text;
 1131:     }
 1132:     return '';
 1133: }
 1134: # ------------------------------------------------- Format dependencies section
 1135: sub format_dependencies {
 1136:     my @tokeninfo=@_;
 1137:     $dependencies='';
 1138:     my $text=&trim($parser->get_text('/dependencies'));
 1139:     if ($text) {
 1140: 	$parser->get_tag('/dependencies');
 1141: 	$dependencies=join(';',
 1142: 			      (map {s/^\s*//;s/\s$//;$_} split(/\;/,$text)));
 1143:     }
 1144:     return '';
 1145: }
 1146: # --------------------------------------------------------- Format glob section
 1147: sub format_glob {
 1148:     my @tokeninfo=@_;
 1149:     $glob='';
 1150:     my $text=&trim($parser->get_text('/glob'));
 1151:     if ($text) {
 1152: 	$parser->get_tag('/glob');
 1153: 	$glob=$text;
 1154:     }
 1155:     return '';
 1156: }
 1157: # ---------------------------------------------------- Format filenames section
 1158: sub format_filenames {
 1159:     my @tokeninfo=@_;
 1160:     my $text=&trim($parser->get_text('/filenames'));
 1161:     if ($text) {
 1162: 	$parser->get_tag('/filenames');
 1163: 	$filenames=$text;
 1164:     }
 1165:     return '';
 1166: }
 1167: # ------------------------------------------------------- Format linkto section
 1168: sub format_linkto {
 1169:     my @tokeninfo=@_;
 1170:     my $text=&trim($parser->get_text('/linkto'));
 1171:     if ($text) {
 1172: 	$parser->get_tag('/linkto');
 1173: 	$linkto=$text;
 1174:     }
 1175:     return '';
 1176: }
 1177: # ------------------------------------- Render less-than and greater-than signs
 1178: sub htmlsafe {
 1179:     my $text=@_[0];
 1180:     $text =~ s/</&lt;/g;
 1181:     $text =~ s/>/&gt;/g;
 1182:     return $text;
 1183: }
 1184: # --------------------------------------- remove starting and ending whitespace
 1185: sub trim {
 1186:     my ($s)=@_; $s=~s/^\s*//; $s=~s/\s*$//; return $s;
 1187: } 
 1188: 
 1189: # ----------------------------------- POD (plain old documentation, CPAN style)
 1190: 
 1191: =head1 NAME
 1192: 
 1193: lpml_parse.pl - This is meant to parse files meeting the lpml document type.
 1194: See lpml.dtd.  LPML=Linux Packaging Markup Language.
 1195: 
 1196: =head1 SYNOPSIS
 1197: 
 1198: Usage is for lpml file to come in through standard input.
 1199: 
 1200: =over 4
 1201: 
 1202: =item *
 1203: 
 1204: 1st argument is the mode of parsing.
 1205: 
 1206: =item * 
 1207: 
 1208: 2nd argument is the category permissions to use (runtime or development)
 1209: 
 1210: =item *
 1211: 
 1212: 3rd argument is the distribution
 1213: (default,redhat6.2,debian2.2,redhat7.1,etc).
 1214: 
 1215: =item *
 1216: 
 1217: 4th argument is to manually specify a sourceroot.
 1218: 
 1219: =item *
 1220: 
 1221: 5th argument is to manually specify a targetroot.
 1222: 
 1223: =back
 1224: 
 1225: Only the 1st argument is mandatory for the program to run.
 1226: 
 1227: Example:
 1228: 
 1229: cat ../../doc/loncapafiles.lpml |\\
 1230: perl lpml_parse.pl html default /home/sherbert/loncapa /tmp/install
 1231: 
 1232: =head1 DESCRIPTION
 1233: 
 1234: I am using a multiple pass-through approach to parsing
 1235: the lpml file.  This saves memory and makes sure the server
 1236: will never be overloaded.
 1237: 
 1238: =head1 README
 1239: 
 1240: I am using a multiple pass-through approach to parsing
 1241: the lpml file.  This saves memory and makes sure the server
 1242: will never be overloaded.
 1243: 
 1244: =head1 PREREQUISITES
 1245: 
 1246: HTML::TokeParser
 1247: 
 1248: =head1 COREQUISITES
 1249: 
 1250: =head1 OSNAMES
 1251: 
 1252: linux
 1253: 
 1254: =head1 SCRIPT CATEGORIES
 1255: 
 1256: Packaging/Administrative
 1257: 
 1258: =cut

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