--- loncom/build/Attic/parse.pl 2000/12/08 20:28:57 1.4 +++ loncom/build/Attic/parse.pl 2000/12/09 19:29:16 1.6 @@ -12,17 +12,30 @@ my ($file,$mode)=@ARGV; open IN,"<$file"; my @lines=; close IN; -my $info=join('',@lines); -my $info2=$info; # value to allow for meta data group retrieval +my $info1=join('',@lines); +my $info2=$info1; # value to allow for meta data group retrieval # ------------------------------------------------------- Make default settings my $distribution="redhat6.2"; my $date=`date +'%B %e, %Y'`; chop $date; my $buildhost=`hostname`; chop $buildhost; +# file category mappings +my %fcm=( + 'conf' => 'configurable', + 'graphic file' => 'graphicfile', + 'handler' => 'handler', + 'interface file' => 'interfacefile', + 'symbolic link' => 'link', + 'root script' => 'rootscript', + 'script' => 'script', + 'setuid script' => 'setuid', + 'static conf' => 'static', + 'system file' => 'systemfile', + ); # ---------------------------------------------------- Parse the marked up data my %info; # big data storage object -while ($info=~/\/isg) { +while ($info1=~/\/isg) { my $keystring=$1; # In the parsing of LON-CAPA tags, remove boundary white-space, # and handle quotation commands. @@ -31,7 +44,6 @@ while ($info=~/\/isg) $value=~s/"$//; (uc($key),$value);} split(/\s+(?=\w+\s*\=)/,$keystring); - # Handle the different types of commands if (uc($hash{'TYPE'}) eq "OWNERSHIP") { $info{$hash{'TYPE'}}{$hash{'CATEGORY'}}{'CHMOD'}=$hash{'CHMOD'}; @@ -52,12 +64,11 @@ while ($info=~/\/isg) $hash{'DESCRIPTION'} if $hash{'DESCRIPTION'}; } elsif (uc($hash{'TYPE'}) eq "LOCATION") { - $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'CATEGORY'}= - $hash{'CATEGORY'}; - $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'SOURCE'}= - $hash{'SOURCE'}; + $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'CATEGORY'}= $hash{'CATEGORY'}; + $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'SOURCE'}= $hash{'SOURCE'}; # get surrounding metagroup information my $ckeystring=$keystring; $ckeystring=~s/(SOURCE\=\"[^"]*)\*/$1\\\*/g; + $ckeystring=~s/(TARGET\=\"[^"]*)\*/$1\\\*/g; $info2=~/.*\<(?:metagroup|metasupergroup)\>(.*?)\(.*?)\<\/(?:metagroup|metasupergroup)\>/is; my $data=$1.$2; my @meta=('description','build','dependencies','files','note'); @@ -83,6 +94,8 @@ if ($mode eq "ALL" || $mode eq "HTML") { @directories=&determine_directory_structure; $a=&make_directory_structure_description_block(\@directories); print $a; + $a=&make_file_type_ownership_and_permissions_description_block; + print $a; $a=&make_directory_and_file_structure_description_block(\@directories); print $a; $a=&end_description_page; @@ -122,7 +135,7 @@ END sub end_description_page { my $description=< -LON-CAPA Software Development Team +LON-CAPA Software Development Team END @@ -210,17 +223,61 @@ END return $description; } +# ------------------- Make file type ownership and permissions description block +sub make_file_type_ownership_and_permissions_description_block { + my $description=<File Type Ownership and Permissions Descriptions, $date +

+This table shows what permissions and ownership settings correspond +to each kind of file type. +

+

+ + + + + + + +END + foreach my $type (keys %{$info{'OWNERSHIP'}}) { + if (defined($fcm{$type})) { + my $chmod=$info{'OWNERSHIP'}{$type}{'CHMOD'}; + my $chown=$info{'OWNERSHIP'}{$type}{'CHOWN'}; + my $devchmod=$info{'DEVOWNERSHIP'}{$type}{'CHMOD'}; + my $devchown=$info{'DEVOWNERSHIP'}{$type}{'CHOWN'}; + $description.=< + + + + + +END + } + } + $description.=< +

+END +} + # ------------------------- Make directory and file structure description block sub make_directory_and_file_structure_description_block { my ($dirs)=@_; my $description=<Directory and File Structure Description, $date

-

IconTypePermissionsDevelopment Permissions
$type$type$chmod $chown$devchmod $devchown
+The icons on the left column correspond to the file type +specified in the second column. The last column "Notes" shows compilation, +dependency, and configuration information. +

+

+

END my $counter=0; my @colorindex=("#80FF80","#80FFFF","#FFFF80"); - my @allfiles=keys %{$info{'LOCATION'}{$distribution}{'TARGET'}}; + my @allfiles=keys %{$info{'LOCATION'}{$distribution}}; foreach my $d (@$dirs) { # set color my $color=$colorindex[$counter%3]; @@ -230,43 +287,59 @@ END # find subdirectories that are contained in this directory my @subdirs; foreach my $d2 (@$dirs) { - if ($d2=~/$d\/([^\/]+)/) { + if ($d2=~/^$d\/([^\/]+)$/) { push @subdirs,$1; } } # find files that are contained in this directory my @files; + my @filesfull; foreach my $f (@allfiles) { - if ($file=~/$d\/(.+)/) { + if ($f=~/^$d\/([^\/]+)$/) { push @files,$1; + push @filesfull,$f; } } # render starting HTML formatting elements if (@subdirs || @files) { my $subdirstring="
* Relevant subdirectories: " . join(", ",@subdirs) if @subdirs; $description.=< END } else { $description.=< + END } if (@files) { $description.=< - - - - + + + + + END - } - $description.=< + + + + + + END + } + } $counter++; } $description.=<
directoryDIRECTORY -- $d $dirdescription -$subdirstring +
directoryDIRECTORY -- $d $dirdescription +$subdirstring
empty directoryEMPTY DIRECTORY - $d $dirdescription
empty directoryEMPTY DIRECTORY - $d $dirdescription
TypeFile NameFunctionNotesTypeFile NameFunctionCVS LocationNotes
$category$category$files[$i]$fdescription $source$notes