--- loncom/build/lpml_parse.pl 2001/12/05 01:39:08 1.26 +++ loncom/build/lpml_parse.pl 2001/12/06 23:14:33 1.28 @@ -1,14 +1,42 @@ #!/usr/bin/perl -# Scott Harrison +# The LearningOnline Network with CAPA +# lpml_parse.pl - Linux Packaging Markup Language parser +# +# $Id: lpml_parse.pl,v 1.28 2001/12/06 23:14:33 harris41 Exp $ +# +# Written by Scott Harrison, harris41@msu.edu +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# # YEAR=2001 # May 2001 # 06/19/2001,06/20,06/24 - Scott Harrison # 9/5/2001,9/6,9/7,9/8 - Scott Harrison # 9/17,9/18 - Scott Harrison # 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison +# 12/2,12/3,12/4,12/5,12/6 - Scott Harrison # -# $Id: lpml_parse.pl,v 1.26 2001/12/05 01:39:08 harris41 Exp $ ### ############################################################################### @@ -77,6 +105,8 @@ if (@ARGV) { my $targetroot; my $sourceroot; +my $targetrootarg; +my $sourcerootarg; if (@ARGV) { $sourceroot = shift @ARGV; } @@ -85,6 +115,8 @@ if (@ARGV) { } $sourceroot=~s/\/$//; $targetroot=~s/\/$//; +$sourcerootarg=$sourceroot; +$targetrootarg=$targetroot; my $logcmd='| tee -a WARNINGS'; @@ -367,8 +399,8 @@ END About this file

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

+

LPML written by Scott Harrison (harris41\@msu.edu).

END } @@ -493,6 +525,7 @@ sub format_category { $fab{$category_att_name}=$abbreviation; if ($mode eq 'html') { if ($category_att_type eq $categorytype) { + $categoryhash{$category_att_name}="$chmod $chown"; return $category="". "\n". @@ -786,9 +819,10 @@ sub format_directory { $dpathlength=$d if $d>$dpathlength; my $thtml=$targetdir; $thtml=~s/\//\<\/td\>\/g; + my ($chmod,$chown)=split(/\s/,$categoryhash{$categoryname}); return $directory="\n". "$categoryname". - " ". + " ". "$chmod
$chown". "$thtml". "". @@ -953,9 +987,14 @@ sub format_file { if ($mode eq 'html') { return ($file="\n". "". - "  ". + "". - "$categoryname". + "$categoryname
". + $categoryhash{$categoryname}."". "SOURCE: $source
TARGET: $target". "$description". "$note". @@ -1011,7 +1050,7 @@ $buildtest \@if !(test -e "${sourceroot} case "\$\$ECODE" in \\ 1) echo "${targetroot}/${target} is unchanged";; \\ 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};; \\ - 0) echo "install $categoryhash{$categorname} ${sourceroot}/${source} ${targetroot}/${target}" && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\ + 0) echo "install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target}" && install $categoryhash{$categoryname} ${sourceroot}/${source} ${targetroot}/${target};; \\ esac; \\ perl verifymodown.pl ${targetroot}/${target} "$categoryhash{$categoryname}"$logcmd; \\ fi @@ -1066,16 +1105,43 @@ END # --------------------------------------------------------- Format link section sub format_link { my @tokeninfo=@_; - $link=''; $linkto=''; $target=''; $categoryname=''; $description=''; - $note=''; $build=''; $status=''; $dependencies=''; + $link=''; $linkto=''; $source=''; $target=''; $categoryname=''; + $description=''; $note=''; $build=''; $status=''; $dependencies=''; my $text=&trim($parser->get_text('/link')); if ($linkto) { $parser->get_tag('/link'); if ($mode eq 'html') { - return $link="\nBEGIN LINK\n". - "$linkto $target $categoryname $description $note " . - "$build $status $dependencies" . - "\nEND LINK"; + my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target); + foreach my $tgt (@targets) { + push @links,("\n". + "". + " ". + "". + "$categoryname". + "LINKTO: $linkto
TARGET: $tgt". + "$description". + "$note". + ""); +# push @links,"\t".'ln -fs /'.$linkto.' /'.$targetroot.$tgt. +# "\n"; + } + return join('',@links); +# return ($link="\n". +# "". +# " ". +# "$categoryname". +# "LINKTO: $linkto
TARGET: $target". +# "$description". +# "$note". +# ""); +# return $link="\nBEGIN LINK\n". +# "$linkto $target $categoryname $description $note " . +# "$build $status $dependencies" . +# "\nEND LINK"; } elsif ($mode eq 'install') { my @targets=map {s/^\s*//;s/\s$//;$_} split(/\;/,$target); @@ -1099,13 +1165,31 @@ sub format_fileglob { $note=''; $build=''; $status=''; $dependencies=''; $filenames=''; my $text=&trim($parser->get_text('/fileglob')); + my $filenames2=$filenames;$filenames2=~s/\s//g; if ($sourcedir) { $parser->get_tag('/fileglob'); if ($mode eq 'html') { - return $fileglob="\nBEGIN FILEGLOB\n". - "$glob sourcedir $targetdir $categoryname $description $note ". - "$build $status $dependencies $filenames" . - "\nEND FILEGLOB"; + return $fileglob="\n". + " ". + ""."". + "$categoryname
". + "".$categoryhash{$categoryname}."". + "SOURCEDIR: $sourcedir
". + "TARGETDIR: $targetdir
". + "GLOB: $glob
". + "FILENAMES: $filenames". + "". + "$description". + "$note". + ""; +# return $fileglob="\nBEGIN FILEGLOB\n". +# "$glob sourcedir $targetdir $categoryname $description $note ". +# "$build $status $dependencies $filenames" . +# "\nEND FILEGLOB"; } elsif ($mode eq 'install') { return "\t".'install '.