version 1.24, 2001/11/29 19:00:56
|
version 1.26, 2001/12/05 01:39:08
|
Line 49 Only the 1st argument is mandatory for t
|
Line 49 Only the 1st argument is mandatory for t
|
Example: |
Example: |
|
|
cat ../../doc/loncapafiles.lpml |\\ |
cat ../../doc/loncapafiles.lpml |\\ |
perl lpml_parse.pl html default /home/sherbert/loncapa /tmp/install |
perl lpml_parse.pl html development default /home/sherbert/loncapa /tmp/install |
END |
END |
|
|
# ------------------------------------------------- Grab command line arguments |
# ------------------------------------------------- Grab command line arguments |
Line 198 my $category_att_name;
|
Line 198 my $category_att_name;
|
my $category_att_type; |
my $category_att_type; |
my $chown; |
my $chown; |
my $chmod; |
my $chmod; |
|
my $abbreviation; # space-free abbreviation; esp. for image names |
my $rpm; |
my $rpm; |
my $rpmSummary; |
my $rpmSummary; |
my $rpmName; |
my $rpmName; |
Line 237 my $dependencies;
|
Line 238 my $dependencies;
|
my $dependency; |
my $dependency; |
my @links; |
my @links; |
my %categoryhash; |
my %categoryhash; |
|
my $dpathlength; |
|
my %fab; # file category abbreviation |
|
|
my @buildall; |
my @buildall; |
my @buildinfo; |
my @buildinfo; |
Line 250 $parser = HTML::TokeParser->new(\$cleans
|
Line 253 $parser = HTML::TokeParser->new(\$cleans
|
$parser->xml_mode('1'); |
$parser->xml_mode('1'); |
|
|
# Define handling methods for mode-dependent text rendering |
# Define handling methods for mode-dependent text rendering |
|
|
$parser->{textify}={ |
$parser->{textify}={ |
targetroot => \&format_targetroot, |
targetroot => \&format_targetroot, |
sourceroot => \&format_sourceroot, |
sourceroot => \&format_sourceroot, |
categories => \&format_categories, |
categories => \&format_categories, |
category => \&format_category, |
category => \&format_category, |
|
abbreviation => \&format_abbreviation, |
targetdir => \&format_targetdir, |
targetdir => \&format_targetdir, |
chown => \&format_chown, |
chown => \&format_chown, |
chmod => \&format_chmod, |
chmod => \&format_chmod, |
Line 339 sub format_lpml {
|
Line 344 sub format_lpml {
|
$lpml=<<END; |
$lpml=<<END; |
<html> |
<html> |
<head> |
<head> |
<title>LPML Description Page (dist=$dist, $date)</title> |
<title>LPML Description Page |
|
(dist=$dist, categorytype=$categorytype, $date)</title> |
</head> |
</head> |
<body> |
<body> |
END |
END |
$lpml .= "<br /><font size='+2'>LPML Description Page (dist=$dist, ". |
$lpml .= "<br /><font size='+2'>LPML Description Page (dist=$dist, ". |
"$date)". |
"categorytype=$categorytype, $date)". |
"</font>"; |
"</font>"; |
$lpml .=<<END; |
$lpml .=<<END; |
<ul> |
<ul> |
Line 353 END
|
Line 359 END
|
Descriptions</a></li> |
Descriptions</a></li> |
<li><a href='#package'>Software Package Description</a></li> |
<li><a href='#package'>Software Package Description</a></li> |
<li><a href='#directories'>Directory Structure</a></li> |
<li><a href='#directories'>Directory Structure</a></li> |
<li><a href='#files'>File and Directory Structure</a></li> |
<li><a href='#files'>Files</a></li> |
</ul> |
</ul> |
END |
END |
$lpml .=<<END; |
$lpml .=<<END; |
Line 374 END
|
Line 380 END
|
* Software Package Description |
* Software Package Description |
* Directory Structure |
* Directory Structure |
* File Type Ownership and Permissions |
* File Type Ownership and Permissions |
* File and Directory Structure |
* Files |
END |
END |
$lpml .=<<END; |
$lpml .=<<END; |
|
|
Line 453 sub format_categories {
|
Line 459 sub format_categories {
|
"\n<a name='ownperms'>". |
"\n<a name='ownperms'>". |
"\n<font size='+2'>File Type Ownership and Permissions". |
"\n<font size='+2'>File Type Ownership and Permissions". |
" Descriptions</font>". |
" Descriptions</font>". |
"\n<table>\n". |
"\n<p>This table shows what permissions and ownership settings ". |
"<br />\n$text\n". |
"correspond to each category.</p>". |
|
"\n<table border='1' cellpadding='5' width='60%'>\n". |
|
"<tr>". |
|
"<th align='left' bgcolor='#ffffff'>Icon</th>". |
|
"<th align='left' bgcolor='#ffffff'>Category Name</th>". |
|
"<th align='left' bgcolor='#ffffff'>Permissions ". |
|
"($categorytype)</th>". |
|
"</tr>". |
|
"\n$text\n". |
"</table>\n"; |
"</table>\n"; |
} |
} |
elsif ($mode eq 'text') { |
elsif ($mode eq 'text') { |
return $categories="\n". |
return $categories="\n". |
"\nFile Type Ownership and Permissions". |
"\nFile Type Ownership and Permissions". |
" Descriptions". |
" Descriptions". |
|
"\n$text". |
"\n"; |
"\n"; |
} |
} |
else { |
else { |
Line 472 sub format_category {
|
Line 487 sub format_category {
|
my (@tokeninfo)=@_; |
my (@tokeninfo)=@_; |
$category_att_name=$tokeninfo[2]->{'name'}; |
$category_att_name=$tokeninfo[2]->{'name'}; |
$category_att_type=$tokeninfo[2]->{'type'}; |
$category_att_type=$tokeninfo[2]->{'type'}; |
$chmod='';$chown=''; |
$abbreviation=''; $chmod='';$chown=''; |
$parser->get_text('/category'); |
$parser->get_text('/category'); |
$parser->get_tag('/category'); |
$parser->get_tag('/category'); |
|
$fab{$category_att_name}=$abbreviation; |
if ($mode eq 'html') { |
if ($mode eq 'html') { |
return $category="\n<br />CATEGORY $category_att_name ". |
if ($category_att_type eq $categorytype) { |
"$category_att_type $chmod $chown"; |
return $category="<tr>". |
|
"<td><img src='$abbreviation.gif' ". |
|
"alt='${category_att_name}' /></td>\n". |
|
"<td>${category_att_name}</td>\n". |
|
"<td>$chmod $chown</td>\n". |
|
"</tr>". |
|
"\n"; |
|
# return $category="\n<br />CATEGORY $category_att_name ". |
|
# "$category_att_type $chmod $chown"; |
|
} |
} |
} |
else { |
else { |
if ($category_att_type eq $categorytype) { |
if ($category_att_type eq $categorytype) { |
Line 488 sub format_category {
|
Line 513 sub format_category {
|
return ''; |
return ''; |
} |
} |
} |
} |
|
# --------------------------------------------------- Format categories section |
|
sub format_abbreviation { |
|
my @tokeninfo=@_; |
|
$abbreviation=''; |
|
my $text=&trim($parser->get_text('/abbreviation')); |
|
if ($text) { |
|
$parser->get_tag('/abbreviation'); |
|
$abbreviation=$text; |
|
} |
|
return ''; |
|
} |
# -------------------------------------------------------- Format chown section |
# -------------------------------------------------------- Format chown section |
sub format_chown { |
sub format_chown { |
my @tokeninfo=@_; |
my @tokeninfo=@_; |
Line 682 sub format_rpmAutoReqProv {
|
Line 718 sub format_rpmAutoReqProv {
|
sub format_rpmdescription { |
sub format_rpmdescription { |
my $text=$parser->get_text('/rpmdescription'); |
my $text=$parser->get_text('/rpmdescription'); |
$parser->get_tag('/rpmdescription'); |
$parser->get_tag('/rpmdescription'); |
$text=~s/\n//g; |
|
$text=~s/\\n/\n/g; |
|
if ($mode eq 'html') { |
if ($mode eq 'html') { |
|
$text=~s/\n//g; |
|
$text=~s/\\n/\n/g; |
return $rpmdescription="\nDescription : $text"; |
return $rpmdescription="\nDescription : $text"; |
} |
} |
elsif ($mode eq 'text') { |
elsif ($mode eq 'text') { |
|
$text=~s/\n//g; |
|
$text=~s/\\n/\n/g; |
return $rpmdescription="\nDescription : $text"; |
return $rpmdescription="\nDescription : $text"; |
} |
} |
else { |
else { |
Line 711 sub format_directories {
|
Line 749 sub format_directories {
|
my $text=$parser->get_text('/directories'); |
my $text=$parser->get_text('/directories'); |
$parser->get_tag('/directories'); |
$parser->get_tag('/directories'); |
if ($mode eq 'html') { |
if ($mode eq 'html') { |
|
$text=~s/\[\{\{\{\{\{DPATHLENGTH\}\}\}\}\}\]/$dpathlength/g; |
return $directories="\n<br /> <br />". |
return $directories="\n<br /> <br />". |
"<a name='directories' />". |
"<a name='directories' />". |
"<font size='+2'>Directory Structure</font>". |
"<font size='+2'>Directory Structure</font>". |
"\n$text\n<br />". |
"\n<br /> <br />". |
"\n"; |
"<table border='1' cellpadding='3' cellspacing='0'>\n". |
|
"<tr><th bgcolor='#ffffff'>Category</th>". |
|
"<th bgcolor='#ffffff'>Status</th>\n". |
|
"<th bgcolor='#ffffff'>Expected Permissions & Ownership</th>\n". |
|
"<th bgcolor='#ffffff' colspan='$dpathlength'>Target Directory ". |
|
"Path</th></tr>\n". |
|
"\n$text\n</table><br />"."\n"; |
} |
} |
elsif ($mode eq 'text') { |
elsif ($mode eq 'text') { |
return $directories="\nDirectory Structure\n$text\n". |
return $directories="\nDirectory Structure\n$text\n". |
Line 735 sub format_directory {
|
Line 780 sub format_directory {
|
$parser->get_text('/directory'); |
$parser->get_text('/directory'); |
$parser->get_tag('/directory'); |
$parser->get_tag('/directory'); |
if ($mode eq 'html') { |
if ($mode eq 'html') { |
return $directory="\n<br />DIRECTORY $targetdir $categoryname ". |
my @a; |
|
@a=($targetdir=~/\//g); |
|
my $d=scalar(@a)+1; |
|
$dpathlength=$d if $d>$dpathlength; |
|
my $thtml=$targetdir; |
|
$thtml=~s/\//\<\/td\>\<td bgcolor='#ffffff'\>/g; |
|
return $directory="\n<tr><td rowspan='2' bgcolor='#ffffff'>". |
|
"$categoryname</td>". |
|
"<td rowspan='2' bgcolor='#ffffff'><!-- POSTEVAL: --> </td>". |
|
"<td rowspan='2' bgcolor='#ffffff'>$chmod<br />$chown</td>". |
|
"<td bgcolor='#ffffff'>$thtml</td></tr>". |
|
"<tr><td bgcolor='#ffffff' colspan='[{{{{{DPATHLENGTH}}}}}]'>". |
|
"$description</td></tr>"; |
|
} |
|
if ($mode eq 'text') { |
|
return $directory="\nDIRECTORY $targetdir $categoryname ". |
"$description"; |
"$description"; |
} |
} |
elsif ($mode eq 'install') { |
elsif ($mode eq 'install') { |
Line 786 sub format_files {
|
Line 846 sub format_files {
|
if ($mode eq 'html') { |
if ($mode eq 'html') { |
return $directories="\n<br /> <br />". |
return $directories="\n<br /> <br />". |
"<a name='files' />". |
"<a name='files' />". |
"<font size='+2'>File and Directory Structure</font>". |
"<font size='+2'>Files</font><br /> <br />". |
"\n$text\n<br />". |
"<p>All source and target locations are relative to the ". |
|
"sourceroot and targetroot values at the beginning of this ". |
|
"document.</p>". |
|
"\n<table border='1' cellpadding='5'>". |
|
"<tr><th>Status</th><th colspan='2'>Category</th>". |
|
"<th>Name/Location</th>". |
|
"<th>Description</th><th>Notes</th></tr>". |
|
"$text</table>\n". |
"\n"; |
"\n"; |
} |
} |
elsif ($mode eq 'text') { |
elsif ($mode eq 'text') { |
Line 884 sub format_file {
|
Line 951 sub format_file {
|
if ($source) { |
if ($source) { |
$parser->get_tag('/file'); |
$parser->get_tag('/file'); |
if ($mode eq 'html') { |
if ($mode eq 'html') { |
return ($file="\n<br />BEGIN FILE\n". |
return ($file="\n<!-- FILESORT:$target -->". |
"$source $target $categoryname $description $note " . |
"<tr>". |
"$build $status $dependencies" . |
"<td> </td><td><img src='$fab{$categoryname}.gif' ". |
"\nEND FILE"); |
"alt='$categoryname icon' /></td>". |
|
"<td>$categoryname</td>". |
|
"<td>SOURCE: $source<br />TARGET: $target</td>". |
|
"<td>$description</td>". |
|
"<td>$note</td>". |
|
"</tr>"); |
|
# return ($file="\n<br />BEGIN FILE\n". |
|
# "$source $target $categoryname $description $note " . |
|
# "$build $status $dependencies" . |
|
# "\nEND FILE"); |
} |
} |
elsif ($mode eq 'install' && $categoryname ne 'conf') { |
elsif ($mode eq 'install' && $categoryname ne 'conf') { |
if ($build) { |
if ($build) { |
Line 940 $buildtest \@if !(test -e "${sourceroot}
|
Line 1016 $buildtest \@if !(test -e "${sourceroot}
|
perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\ |
perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\ |
fi |
fi |
END |
END |
# return "\t".'@test -e '.$sourceroot.'/'.$source. |
|
# ' && perl filecompare.pl -b '.$sourceroot.'/'.$source.' '. |
|
# $targetroot.'/'.$target. |
|
# ' && install '. |
|
# $categoryhash{$categoryname}.' '. |
|
# $sourceroot.'/'.$source.' '. |
|
# $targetroot.'/'.$target. |
|
# ' || echo "**** WARNING '. |
|
# '**** CVS source file does not exist: '.$sourceroot.'/'. |
|
# $source.'"'."\n"; |
|
} |
} |
elsif ($mode eq 'configinstall' && $categoryname eq 'conf') { |
elsif ($mode eq 'configinstall' && $categoryname eq 'conf') { |
push @configall,$targetroot.'/'.$target; |
push @configall,$targetroot.'/'.$target; |
Line 1006 sub format_link {
|
Line 1072 sub format_link {
|
if ($linkto) { |
if ($linkto) { |
$parser->get_tag('/link'); |
$parser->get_tag('/link'); |
if ($mode eq 'html') { |
if ($mode eq 'html') { |
return $link="\n<br />BEGIN LINK\n". |
return $link="\n<tr><td colspan='6'>BEGIN LINK\n". |
"$linkto $target $categoryname $description $note " . |
"$linkto $target $categoryname $description $note " . |
"$build $status $dependencies" . |
"$build $status $dependencies" . |
"\nEND LINK"; |
"\nEND LINK</td></tr>"; |
} |
} |
elsif ($mode eq 'install') { |
elsif ($mode eq 'install') { |
my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target); |
my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target); |
Line 1036 sub format_fileglob {
|
Line 1102 sub format_fileglob {
|
if ($sourcedir) { |
if ($sourcedir) { |
$parser->get_tag('/fileglob'); |
$parser->get_tag('/fileglob'); |
if ($mode eq 'html') { |
if ($mode eq 'html') { |
return $fileglob="\n<br />BEGIN FILEGLOB\n". |
return $fileglob="\n<tr><td colspan='6'>BEGIN FILEGLOB\n". |
"$glob sourcedir $targetdir $categoryname $description $note ". |
"$glob sourcedir $targetdir $categoryname $description $note ". |
"$build $status $dependencies $filenames" . |
"$build $status $dependencies $filenames" . |
"\nEND FILEGLOB"; |
"\nEND FILEGLOB</td></tr>"; |
} |
} |
elsif ($mode eq 'install') { |
elsif ($mode eq 'install') { |
return "\t".'install '. |
return "\t".'install '. |
Line 1090 sub format_source {
|
Line 1156 sub format_source {
|
sub format_note { |
sub format_note { |
my @tokeninfo=@_; |
my @tokeninfo=@_; |
$note=''; |
$note=''; |
my $text=&trim($parser->get_text('/note')); |
# my $text=&trim($parser->get_text('/note')); |
|
my $aref; |
|
my $text; |
|
while ($aref=$parser->get_token()) { |
|
if ($aref->[0] eq 'E' && $aref->[1] eq 'note') { |
|
last; |
|
} |
|
elsif ($aref->[0] eq 'S') { |
|
$text.=$aref->[4]; |
|
} |
|
elsif ($aref->[0] eq 'E') { |
|
$text.=$aref->[2]; |
|
} |
|
else { |
|
$text.=$aref->[1]; |
|
} |
|
} |
if ($text) { |
if ($text) { |
$parser->get_tag('/note'); |
# $parser->get_tag('/note'); |
$note=$text; |
$note=$text; |
} |
} |
return ''; |
return ''; |