Annotation of loncom/build/parse.pl, revision 1.18
1.1 harris41 1: #!/usr/bin/perl
2:
3: # Scott Harrison
4: # November 2000
5:
1.2 harris41 6: # Read in loncapa tags and metagroup tags
1.1 harris41 7:
1.4 harris41 8: # ---------------------------------------------- Read in command line arguments
1.1 harris41 9: my ($file,$mode)=@ARGV;
1.2 harris41 10:
1.4 harris41 11: # ---------------------------------------------------- Read in master data file
1.1 harris41 12: open IN,"<$file";
13: my @lines=<IN>;
14: close IN;
1.5 harris41 15: my $info1=join('',@lines);
16: my $info2=$info1; # value to allow for meta data group retrieval
1.1 harris41 17:
1.4 harris41 18: # ------------------------------------------------------- Make default settings
19: my $distribution="redhat6.2";
20: my $date=`date +'%B %e, %Y'`; chop $date;
21: my $buildhost=`hostname`; chop $buildhost;
1.5 harris41 22: # file category mappings
23: my %fcm=(
24: 'conf' => 'configurable',
25: 'graphic file' => 'graphicfile',
26: 'handler' => 'handler',
27: 'interface file' => 'interfacefile',
28: 'symbolic link' => 'link',
29: 'root script' => 'rootscript',
30: 'script' => 'script',
31: 'setuid script' => 'setuid',
32: 'static conf' => 'static',
33: 'system file' => 'systemfile',
34: );
1.4 harris41 35:
36: # ---------------------------------------------------- Parse the marked up data
37: my %info; # big data storage object
1.5 harris41 38: while ($info1=~/\<loncapa\s+(.*?)\>/isg) {
1.1 harris41 39: my $keystring=$1;
1.4 harris41 40: # In the parsing of LON-CAPA tags, remove boundary white-space,
41: # and handle quotation commands.
1.2 harris41 42: my %hash=map {my ($key,$value)=split(/\=(?!")|\=(?=\s*"[^"]*"[^"]*$)/);
43: $value=~s/^"//;
44: $value=~s/"$//;
45: (uc($key),$value);}
46: split(/\s+(?=\w+\s*\=)/,$keystring);
1.4 harris41 47: # Handle the different types of commands
1.1 harris41 48: if (uc($hash{'TYPE'}) eq "OWNERSHIP") {
49: $info{$hash{'TYPE'}}{$hash{'CATEGORY'}}{'CHMOD'}=$hash{'CHMOD'};
50: $info{$hash{'TYPE'}}{$hash{'CATEGORY'}}{'CHOWN'}=$hash{'CHOWN'};
51: }
52: elsif (uc($hash{'TYPE'}) eq "DEVOWNERSHIP") {
53: $info{$hash{'TYPE'}}{$hash{'CATEGORY'}}{'CHMOD'}=$hash{'CHMOD'};
54: $info{$hash{'TYPE'}}{$hash{'CATEGORY'}}{'CHOWN'}=$hash{'CHOWN'};
55: }
56: elsif (uc($hash{'TYPE'}) eq "RPM") {
57: $hash{'VALUE'}=~s/\\n/\n/g;
58: $info{$hash{'TYPE'}}{$hash{'NAME'}}=$hash{'VALUE'};
59: }
60: elsif (uc($hash{'TYPE'}) eq "DIRECTORY") {
1.4 harris41 61: $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'CATEGORY'}=
62: $hash{'CATEGORY'};
63: $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'DESCRIPTION'}=
64: $hash{'DESCRIPTION'} if $hash{'DESCRIPTION'};
1.1 harris41 65: }
66: elsif (uc($hash{'TYPE'}) eq "LOCATION") {
1.5 harris41 67: $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'CATEGORY'}= $hash{'CATEGORY'};
1.10 harris41 68: $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'LINKTO'}= $hash{'LINKTO'};
1.5 harris41 69: $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{'SOURCE'}= $hash{'SOURCE'};
1.1 harris41 70: # get surrounding metagroup information
71: my $ckeystring=$keystring; $ckeystring=~s/(SOURCE\=\"[^"]*)\*/$1\\\*/g;
1.5 harris41 72: $ckeystring=~s/(TARGET\=\"[^"]*)\*/$1\\\*/g;
1.1 harris41 73: $info2=~/.*\<(?:metagroup|metasupergroup)\>(.*?)\<loncapa\s+$ckeystring\>(.*?)\<\/(?:metagroup|metasupergroup)\>/is;
74: my $data=$1.$2;
75: my @meta=('description','build','dependencies','files','note');
76: foreach my $m (@meta) {
77: if ($data=~/\<($m)\>(.*?)\<\/$m\>/sgi) {
78: my ($key,$value)=($1,$2);
1.9 harris41 79: $info{$hash{'TYPE'}}{$hash{'DIST'}}{$hash{'TARGET'}}{uc($key)}=
1.4 harris41 80: $value;
1.1 harris41 81: }
82: }
83: }
84: else {
85: warn("WARNING: this tag text will be ignored since it cannot be understood\n---> $keystring\n");
86: }
87: }
88:
1.10 harris41 89: my $a;
90: my @directories;
91: if ($mode eq "HTML") {
1.4 harris41 92: $a=&begin_description_page;
93: print $a;
94: $a=&make_rpm_description_block;
95: print $a;
96: @directories=&determine_directory_structure;
97: $a=&make_directory_structure_description_block(\@directories);
98: print $a;
1.6 harris41 99: $a=&make_file_type_ownership_and_permissions_description_block;
100: print $a;
1.4 harris41 101: $a=&make_directory_and_file_structure_description_block(\@directories);
102: print $a;
103: $a=&end_description_page;
104: print $a;
105: }
1.10 harris41 106: elsif ($mode eq "SPEC") {
107: my $out=$info{'RPM'}{'Name'} . '-' . $info{'RPM'}{'Version'} . '.spec';
108: open OUT,">$out";
109: $a=&make_rpm_spec_block;
110: print OUT $a;
111: $a=&make_rpm_build_block;
112: print OUT $a;
113: @directories=&determine_directory_structure;
114: $a=&make_directory_structure_spec_block(\@directories);
115: print OUT $a;
116: $a=&make_directory_and_file_structure_spec_block(\@directories);
117: print OUT $a;
118: $a=&end_spec_page;
119: print OUT $a;
120: close OUT;
121: }
122: elsif ($mode eq "LCMakefile") {
123: @directories=&determine_directory_structure;
1.14 harris41 124: $a=&make_directory_LCMakefile_segment(\@directories);
1.10 harris41 125: print $a;
1.14 harris41 126: $a=&make_files_LCMakefile_segment(\@directories);
1.10 harris41 127: print $a;
1.14 harris41 128: $a=&make_links_LCMakefile_segment(\@directories);
1.10 harris41 129: print $a;
130: }
1.11 harris41 131: elsif ($mode eq "BinaryRoot") {
132: mkdir "BinaryRoot",0755;
133: open OUT,">Makefile.BinaryRoot";
134: @directories=&determine_directory_structure;
135: $a=&make_directory_binaryroot_segment(\@directories);
136: print OUT $a;
137: $a=&make_files_binaryroot_segment(\@directories);
138: print OUT $a;
139: $a=&make_links_binaryroot_segment(\@directories);
140: print OUT $a;
141: close OUT;
142: print `make -f Makefile.BinaryRoot TARGET='BinaryRoot' SOURCE='../..' directories`;
143: print `make -f Makefile.BinaryRoot TARGET='BinaryRoot' SOURCE='../..' files`;
144: print `make -f Makefile.BinaryRoot TARGET='BinaryRoot' SOURCE='../..' links`;
145: open OUT,">base_file_list.txt";
146: $a=&make_file_list(\@directories);
147: print OUT $a;
148: close OUT;
149:
150: }
1.10 harris41 151: elsif ($mode eq "status") {
152: }
153: elsif ($mode eq "update") {
154: }
1.16 harris41 155: elsif ($mode eq "configinstall") {
156: @directories=&determine_directory_structure;
157: $a=&make_files_configinstall_segment(\@directories);
158: print $a;
1.17 harris41 159: $a=&make_files_configpermissions_segment(\@directories);
160: print $a;
1.16 harris41 161: }
1.14 harris41 162: elsif ($mode eq "install") {
163: @directories=&determine_directory_structure;
164: $a=&make_directory_install_segment(\@directories);
165: print $a;
166: $a=&make_files_install_segment(\@directories);
167: print $a;
168: $a=&make_links_install_segment(\@directories);
169: print $a;
1.11 harris41 170: }
1.15 harris41 171: elsif ($mode eq "build") {
172: @directories=&determine_directory_structure;
173: $a=&make_files_build_segment(\@directories);
174: print $a;
175: }
1.11 harris41 176:
177: # ------------------------------------------------------ a list of file targets
178: sub make_file_list {
179: my ($dirs)=@_;
180: my $description;
181: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
182: foreach my $d (@$dirs) {
183: # set other values
1.18 ! harris41 184: $description.=<<END
! 185: BinaryRoot/$d
! 186: END
1.11 harris41 187: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
188: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
189: # find files that are contained in this directory
190: my @files;
191: my @filesfull;
192: foreach my $f (@allfiles) {
193: if ($f=~/^$d\/([^\/]+)$/) {
194: push @files,$1;
195: push @filesfull,$f;
196: }
197: }
198: # render starting HTML formatting elements
199: if (@files) {
200: }
1.12 harris41 201: my $pwd=`pwd`; chop $pwd;
1.11 harris41 202: if (@files) {
203: foreach my $i (0..$#files) {
204: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
205: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
206: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
207: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
208: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
209: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
210: my $rot="/".$filesfull[$i];
211: if ($rot=~/\*/) {
212: $rot=~s/[^\/]+$// if $rot=~/\*/;
213: my $listing=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'FILES'};
214: chop $listing;
215: my @list=split(/\s+/,$listing);
216: my $rot2;
217: foreach my $l (@list) {
218: $l=~s/^\s*//; $l=~s/\s*$//;
1.12 harris41 219: $rot2.="BinaryRoot$rot$l\n" if length($l);
1.11 harris41 220: }
221: chop $rot2;
222: $rot=$rot2;
1.12 harris41 223: }
224: else {
225: $rot="BinaryRoot$rot";
1.11 harris41 226: }
1.13 harris41 227: if ($category eq "conf") {
228: $rot.=" # config";
229: }
1.11 harris41 230: $description.=<<END;
231: $rot
232: END
233: }
234: }
235: }
236: $description.=<<END;
237:
238: END
239: return $description;
240: }
241:
242: # --------------------------------- Commands to make BinaryRoot directories
243: sub make_directory_binaryroot_segment {
244: my ($dirs)=@_;
245: my $description=<<END;
246: directories:
247: END
248: foreach my $d (@$dirs) {
249: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
250: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
251: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
252: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
253: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
254: my $own=$devchown; $own=~s/\:/\,/;
255: $description.=<<END;
256: \tinstall -m $devchmod -d \$(TARGET)/$d
257: END
258: }
259: $description.=<<END;
260:
261: END
262: return $description;
263: }
264:
265: # --------------------------------------- Commands to make BinaryRoot files
266: sub make_files_binaryroot_segment {
267: my ($dirs)=@_;
268: my $description=<<END;
269: files:
270: END
271: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
272: foreach my $d (@$dirs) {
273: # set other values
274: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
275: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
276: # find files that are contained in this directory
277: my @files;
278: my @filesfull;
279: foreach my $f (@allfiles) {
280: if ($f=~/^$d\/([^\/]+)$/) {
281: push @files,$1;
282: push @filesfull,$f;
283: }
284: }
285: # render starting HTML formatting elements
286: if (@files) {
287: $description.=<<END;
288: \t# $d $dirdescription
289: END
290: }
291: if (@files) {
292: foreach my $i (0..$#files) {
293: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
294: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
295: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
296: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
297: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
298: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
299: my $rot=$filesfull[$i];
300: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
301: $description.=<<END if $category ne 'symbolic link';
302: \tinstall -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
303: END
304: }
305: }
306: }
307: $description.=<<END;
308:
309: END
310: return $description;
311: }
312:
313: # ------------------------------ Commands to make BinaryRoot symbolic links
314: sub make_links_binaryroot_segment {
315: my ($dirs)=@_;
316: my $description=<<END;
317: links:
318: END
319: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
320: foreach my $d (@$dirs) {
321: # find files that are contained in this directory
322: my @files;
323: my @filesfull;
324: foreach my $f (@allfiles) {
325: if ($f=~/^$d\/([^\/]+)$/) {
326: push @files,$1;
327: push @filesfull,$f;
328: }
329: }
330: # render starting HTML formatting elements
331: if (@files) {
332: foreach my $i (0..$#files) {
333: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
334: my $linkto=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'LINKTO'};
335: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
336: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
337: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
338: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
339: $description.=<<END if $category eq 'symbolic link';
340: \tln -s /$linkto \$(TARGET)/$filesfull[$i]
341: END
342: }
343: }
344: }
345: $description.=<<END;
346:
347: END
348: return $description;
1.10 harris41 349: }
350:
1.14 harris41 351: # ------ Installation commands for a Makefile used only by a rpm -ba invocation
352: sub make_directory_LCMakefile_segment {
353: my ($dirs)=@_;
354: my $description=<<END;
355: directories:
356: END
357: foreach my $d (@$dirs) {
358: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
359: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
360: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
361: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
362: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
363: my $own=$devchown; $own=~s/\:/\,/;
364: $description.=<<END;
365: \tinstall -m $devchmod -d \$(SOURCE)/$d \$(ROOT)/$d
366: END
367: }
368: $description.=<<END;
369:
370: END
371: return $description;
372: }
373:
374: # ------ Installation commands for a Makefile used only by a rpm -ba invocation
375: sub make_files_LCMakefile_segment {
376: my ($dirs)=@_;
377: my $description=<<END;
378: files:
379: END
380: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
381: foreach my $d (@$dirs) {
382: # set other values
383: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
384: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
385: # find files that are contained in this directory
386: my @files;
387: my @filesfull;
388: foreach my $f (@allfiles) {
389: if ($f=~/^$d\/([^\/]+)$/) {
390: push @files,$1;
391: push @filesfull,$f;
392: }
393: }
394: # render starting HTML formatting elements
395: if (@files) {
396: $description.=<<END;
397: \t# $d $dirdescription
398: END
399: }
400: if (@files) {
401: foreach my $i (0..$#files) {
402: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
403: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
404: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
405: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
406: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
407: my $rot=$filesfull[$i];
408: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
409: $description.=<<END if $category ne 'symbolic link';
410: \tinstall -m $devchmod \$(SOURCE)/$filesfull[$i] \$(ROOT)/$rot
411: END
412: }
413: }
414: }
415: $description.=<<END;
416:
417: END
418: return $description;
419: }
420:
421: # ------ Installation commands for a Makefile used only by a rpm -ba invocation
422: sub make_links_LCMakefile_segment {
423: my ($dirs)=@_;
424: my $description=<<END;
425: links:
426: END
427: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
428: foreach my $d (@$dirs) {
429: # find files that are contained in this directory
430: my @files;
431: my @filesfull;
432: foreach my $f (@allfiles) {
433: if ($f=~/^$d\/([^\/]+)$/) {
434: push @files,$1;
435: push @filesfull,$f;
436: }
437: }
438: # render starting HTML formatting elements
439: if (@files) {
440: foreach my $i (0..$#files) {
441: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
442: my $linkto=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'LINKTO'};
443: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
444: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
445: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
446: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
447: $description.=<<END if $category eq 'symbolic link';
448: \tln -s /$linkto \$(ROOT)/$filesfull[$i]
449: END
450: }
451: }
452: }
453: $description.=<<END;
454:
455: END
456: return $description;
457: }
458:
1.10 harris41 459: # --------------------------------- Installation commands to install directories
460: sub make_directory_install_segment {
461: my ($dirs)=@_;
462: my $description=<<END;
463: directories:
464: END
465: foreach my $d (@$dirs) {
466: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
1.14 harris41 467: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
1.10 harris41 468: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
469: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
470: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
471: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
1.16 harris41 472: my ($owner,$group)=split(/\:/,$devchown);
1.10 harris41 473: my $own=$devchown; $own=~s/\:/\,/;
474: $description.=<<END;
1.16 harris41 475: \tinstall -o $owner -g $group -m $devchmod -d \$(TARGET)/$d
1.10 harris41 476: END
477: }
478: $description.=<<END;
479:
480: END
481: return $description;
482: }
483:
1.15 harris41 484: # ------------------------------------------------------ Commands to build files
485: sub make_files_build_segment {
486: my ($dirs)=@_;
487: my $description;
488: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
489: my $tab="\t";
490: my $sources="all: ";
491: foreach my $d (@$dirs) {
492: # set other values
493: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
494: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
495: # find files that are contained in this directory
496: my @files;
497: my @filesfull;
498: foreach my $f (@allfiles) {
499: if ($f=~/^$d\/([^\/]+)$/) {
500: push @files,$1;
501: push @filesfull,$f;
502: }
503: }
504: if (@files) {
505: foreach my $i (0..$#files) {
506: # if has build information, output appropriate something
507: my $build=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'BUILD'};
508: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
509: $build=~s/^\s+//; $build=~s/\s+$//;
510: if ($build) {
511: my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'};
512: my $source2=$source;
513: $source2=~s/^[^\/]+\///;
514: $source2="../" . $source2;
515: $sources.="$source2 ";
516: my $directory=$build;
517: $directory=~s/^[^\/]+\///;
518: $directory=~s/([^\/]+)$//;
519: $directory="../" . $directory;
520: my $buildfile=$1;
521: my $sdir=$source;
522: $sdir=~s/^[^\/]+\///;
523: $sdir=~s/([^\/]+)$//;
524: $sdir="../" . $sdir;
525: $dependencies=~s/\s+$//;
526: my $depstat="";
527: if ($dependencies=~s/\s+\[ALWAYS_RUN_BUILD_COMMAND\]//) {
528: $depstat=" alwaysrun";
529: }
530: $dependencies=~s/\s+/ $sdir/gs;
531: $description.=<<END;
532: $source2: $dependencies$depstat
533: ${tab}cd $directory; sh ./$buildfile
534:
535: END
536: }
537: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
538: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
539: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
540: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
541: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
542: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
543: my $rot=$filesfull[$i];
544: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
545: # $description.=<<END if $category ne 'symbolic link';
1.16 harris41 546: #\tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
1.15 harris41 547: #END
548: }
549: }
550: }
551: $description.=<<END;
552: alwaysrun:
553:
554: END
555: $sources.="\n\n";
556: return ($sources . $description);
557: }
558:
1.10 harris41 559: # --------------------------------------- Installation commands to install files
560: sub make_files_install_segment {
561: my ($dirs)=@_;
562: my $description=<<END;
563: files:
564: END
565: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
566: foreach my $d (@$dirs) {
567: # set other values
568: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
569: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
570: # find files that are contained in this directory
571: my @files;
572: my @filesfull;
573: foreach my $f (@allfiles) {
574: if ($f=~/^$d\/([^\/]+)$/) {
575: push @files,$1;
576: push @filesfull,$f;
577: }
578: }
579: # render starting HTML formatting elements
580: if (@files) {
581: $description.=<<END;
582: \t# $d $dirdescription
583: END
584: }
585: if (@files) {
586: foreach my $i (0..$#files) {
587: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
1.14 harris41 588: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
1.10 harris41 589: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
590: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
591: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
592: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
593: my $rot=$filesfull[$i];
594: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
1.16 harris41 595: my ($owner,$group)=split(/\:/,$devchown);
1.15 harris41 596: if ($category ne 'conf') {
597: $description.=<<END if $category ne 'symbolic link';
1.16 harris41 598: \tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
599: END
600: }
601: }
602: }
603: }
604: $description.=<<END;
605:
606: END
607: return $description;
608: }
609:
610: # ------ Installation commands to install configuration files (and make backups)
611: sub make_files_configinstall_segment {
612: my ($dirs)=@_;
613: my $description=<<END;
614: configfiles:
615: END
616: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
617: foreach my $d (@$dirs) {
618: # set other values
619: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
620: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
621: # find files that are contained in this directory
622: my @files;
623: my @filesfull;
624: foreach my $f (@allfiles) {
625: if ($f=~/^$d\/([^\/]+)$/) {
626: push @files,$1;
627: push @filesfull,$f;
628: }
629: }
630: # render starting HTML formatting elements
631: if (@files) {
632: $description.=<<END;
633: \t# $d $dirdescription
634: END
635: }
636: if (@files) {
637: foreach my $i (0..$#files) {
638: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
639: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
640: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
641: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
642: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
643: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
644: my $rot=$filesfull[$i];
645: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
646: my ($owner,$group)=split(/\:/,$devchown);
647: if ($category eq 'conf') {
648: $description.=<<END;
649: \tinstall -b -S `date +'.\%Y\%m\%d\%H\%M\%S'` -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
1.17 harris41 650: END
651: }
652: }
653: }
654: }
655: $description.=<<END;
656:
657: END
658: return $description;
659: }
660:
661: # ------ Commands to enforce configuration file permissions
662: sub make_files_configpermissions_segment {
663: my ($dirs)=@_;
664: my $description=<<END;
665: configpermissions:
666: END
667: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
668: foreach my $d (@$dirs) {
669: # set other values
670: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
671: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
672: # find files that are contained in this directory
673: my @files;
674: my @filesfull;
675: foreach my $f (@allfiles) {
676: if ($f=~/^$d\/([^\/]+)$/) {
677: push @files,$1;
678: push @filesfull,$f;
679: }
680: }
681: # render starting HTML formatting elements
682: if (@files) {
683: $description.=<<END;
684: \t# $d $dirdescription
685: END
686: }
687: if (@files) {
688: foreach my $i (0..$#files) {
689: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
690: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
691: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
692: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
693: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
694: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
695: my $rot=$filesfull[$i];
696: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
697: my ($owner,$group)=split(/\:/,$devchown);
698: if ($category eq 'conf') {
699: $description.=<<END;
700: \tchmod $devchmod \$(TARGET)/$rot
701: \tchown $devchown \$(TARGET)/$rot
1.10 harris41 702: END
1.15 harris41 703: }
1.10 harris41 704: }
705: }
706: }
707: $description.=<<END;
708:
709: END
710: return $description;
711: }
712:
713: # ------------------------------ Installation commands to install symbolic links
714: sub make_links_install_segment {
715: my ($dirs)=@_;
716: my $description=<<END;
717: links:
718: END
1.16 harris41 719: chop $description;
720: my $description2;
1.10 harris41 721: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
722: foreach my $d (@$dirs) {
723: # find files that are contained in this directory
724: my @files;
725: my @filesfull;
726: foreach my $f (@allfiles) {
727: if ($f=~/^$d\/([^\/]+)$/) {
728: push @files,$1;
729: push @filesfull,$f;
730: }
731: }
732: # render starting HTML formatting elements
733: if (@files) {
734: foreach my $i (0..$#files) {
735: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
736: my $linkto=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'LINKTO'};
737: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
738: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
739: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
740: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
1.16 harris41 741: if ($category eq 'symbolic link') {
742: $description.=" \$(TARGET)/$filesfull[$i]";
743: $description2.=<<END;
744: \$(TARGET)/$filesfull[$i]:
1.14 harris41 745: \tln -s /$linkto \$(TARGET)/$filesfull[$i]
1.16 harris41 746:
1.10 harris41 747: END
1.16 harris41 748: }
1.10 harris41 749: }
750: }
751: }
752: $description.=<<END;
1.4 harris41 753:
1.10 harris41 754: END
1.16 harris41 755: $description.=$description2;
1.10 harris41 756: return $description;
757: }
758:
759: # --------------------------------------------------------- Make RPM .spec block
760: sub make_rpm_spec_block {
761: my $pwd=`pwd`; chop $pwd;
762: my $buildroot="$pwd/LON-CAPA-BuildRoot";
763: my $source=$info{'RPM'}{'Name'} . "-" . $info{'RPM'}{'Version'} . '.tar.gz';
764: my $description=<<END;
765: Summary: $info{'RPM'}{'Summary'}
766: Name: $info{'RPM'}{'Name'}
767: Version: $info{'RPM'}{'Version'}
768: Release: $info{'RPM'}{'Release'}
769: Vendor: $info{'RPM'}{'Vendor'}
770: BuildRoot: $buildroot
771: Copyright: $info{'RPM'}{'Copyright'}
772: Group: $info{'RPM'}{'Group'}
773: Source: $source
774: AutoReqProv: $info{'RPM'}{'AutoReqProv'}
775: \%description
776: $info{'RPM'}{'description'}
777:
778: END
779: return $description;
780: }
781:
782: # --------------------------------------------------- Make RPM build .spec block
783: sub make_rpm_build_block {
784: my $pwd=`pwd`; chop $pwd;
785: my $buildroot="$pwd/LON-CAPA-BuildRoot";
786: my $sourceroot="$pwd/LON-CAPA-SourceRoot";
787: my $description=<<END;
788:
789: \%prep
790: \%setup
791:
792: \%build
793: rm -Rf "$buildroot"
794:
795: \%install
796: make -f LCMakefile ROOT="\$RPM_BUILD_ROOT" SOURCE="$sourceroot" directories
797: make -f LCMakefile ROOT="\$RPM_BUILD_ROOT" SOURCE="$sourceroot" files
798: make -f LCMakefile ROOT="\$RPM_BUILD_ROOT" SOURCE="$sourceroot" links
799:
800: \%pre
801: $info{'RPM'}{'pre'}
802:
803: \%post
804: \%postun
805:
806: \%files
807: # \%doc README COPYING ChangeLog LICENSE
808: END
809: return $description;
810: }
811:
812: # ------------------------------------- Make directory structure RPM .spec block
813: sub make_directory_structure_spec_block {
814: my ($dirs)=@_;
815: foreach my $d (@$dirs) {
816: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
817: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
818: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
819: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
820: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
821: my $own=$devchown; $own=~s/\:/\,/;
822: $description.=<<END;
823: \%dir \%attr($devchmod,$own) /$d
824: END
825: }
826: return $description;
827: }
828:
829: # ---------------------------- Make directory and file structure RPM .spec block
830: sub make_directory_and_file_structure_spec_block {
831: my ($dirs)=@_;
832: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
833: foreach my $d (@$dirs) {
834: # set other values
835: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
836: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
837: # find files that are contained in this directory
838: my @files;
839: my @filesfull;
840: foreach my $f (@allfiles) {
841: if ($f=~/^$d\/([^\/]+)$/) {
842: push @files,$1;
843: push @filesfull,$f;
844: }
845: }
846: # render starting HTML formatting elements
847: if (@files) {
848: $description.=<<END;
849: # $d $dirdescription
850: END
851: }
852: if (@files) {
853: foreach my $i (0..$#files) {
854: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
855: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
856: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
857: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
858: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
859: my $own=$devchown; $own=~s/\:/\,/;
860: my $config="";
861: $config="\%config " if $category eq 'conf';
862: $devchmod='-' if $category eq 'symbolic link';
863: $description.=<<END;
864: $config\%attr($devchmod,$own) /$filesfull[$i]
865: END
866: }
867: }
868: }
869: return $description;
870: }
871:
872: # ----------------------------------------------------------- End RPM .spec page
873: sub end_spec_page {
874: }
875:
876: # ------------------------------------------------------- Begin description page
1.4 harris41 877: sub begin_description_page {
878: my $description=<<END;
879: <HTML>
880: <HEAD>
881: <TITLE>LON-CAPA Software Description Page ($distribution, $date)</TITLE>
882: </HEAD>
883: <BODY>
884: <FONT SIZE=+2>LON-CAPA Software Description Page ($distribution, $date)</FONT>
885: <BR>Michigan State University
886: <BR>Learning Online with CAPA
887: <BR>Contact korte\@lon-capa.org
888: <UL>
889: <LI>About this file
890: <LI>Software Package Description
891: <LI>Directory Structure
1.7 harris41 892: <LI>File Type Ownership and Permissions
1.4 harris41 893: <LI>File and Directory Structure
894: </UL>
895: <FONT SIZE=+2>About this file</FONT>
896: <P>
897: This file is generated dynamically by <TT>parse.pl</TT> as
898: part of a development compilation process. See
899: http://install.lon-capa.org/compile/index.html for more
900: information.
901: </P>
902: END
903: return $description;
904: }
905:
906: # ------------------------------------------------- End description page
907: sub end_description_page {
908: my $description=<<END;
909: <HR>
1.5 harris41 910: <FONT SIZE=-1>LON-CAPA Software Development Team</FONT>
1.4 harris41 911: </BODY>
912: </HTML>
913: END
914: return $description;
915: }
916:
917: # ------------------------------------------------- Make RPM description block
918: sub make_rpm_description_block {
919: my $description=<<END;
920: <FONT SIZE=+2>Rolled in a RedHat 6.2 RPM, $date</FONT>
921: <P>
922: <TABLE BGCOLOR=#FFFFFF BORDER=0 CELLPADDING=10 CELLSPACING=0>
923: <TR><TD>
924: <PRE>
925: Name : $info{'RPM'}{'Name'}
926: Version : $info{'RPM'}{'Version'}
927: Vendor : $info{'RPM'}{'Vendor'}
928: Release : $info{'RPM'}{'Release'}
929: Build Host : $buildhost
930: Group : $info{'RPM'}{'Group'}
931: License : $info{'RPM'}{'Copyright'}
932: Summary : $info{'RPM'}{'Summary'}
933: Description :
934: $info{'RPM'}{'description'}
935: </PRE>
936: </TD></TR>
937: </TABLE>
938: </P>
939: END
940: return $description;
941: }
942:
943: # ----------------------------------------------- Determine directory structure
944: sub determine_directory_structure {
945: my @directories=keys %{$info{'DIRECTORY'}{$distribution}};
946: return (sort @directories);
947: }
1.1 harris41 948:
1.4 harris41 949:
950: # ---------------------------------- Make directory structure description block
951: sub make_directory_structure_description_block {
952: my ($dirs)=@_;
953: my $description=<<END;
954: <FONT SIZE=+2>Directory Structure Description, $date</FONT>
955: <P>
1.9 harris41 956: The directory structure description below shows only those
957: directories which either contain LON-CAPA specific files
958: or normally do not exist on a RedHat Linux system (and
959: must be generated to allow proper placement of files
960: during LON-CAPA run-time operation).
961: </P>
962: <P>
1.4 harris41 963: <TABLE BORDER=1 CELLPADDING=3 CELLSPACING=0>
964: END
965: my $maxcount=0;
1.8 harris41 966: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
967: my %diraccount; # hash to track which directories are accounted for
968: foreach my $file (@allfiles) {
969: $file=~/^(.*)\/([^\/]+)$/;
970: $diraccount{$1}=1;
971: }
1.4 harris41 972: foreach my $d (@$dirs) {
973: my (@matches)=($d=~/\//g);
974: my $count=scalar(@matches);
975: $maxcount=$count if $count>$maxcount;
1.8 harris41 976: delete $diraccount{$d};
1.4 harris41 977: }
978: $description.=<<END;
979: <TR>
980: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Category</TH>
981: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Permissions</TH>
982: <TH ALIGN=LEFT BGCOLOR=#FFFFFF><FONT COLOR=#FF0000>Development<BR>Permissions</FONT></TH>
983: END
984: $description.="<TH ALIGN=LEFT BGCOLOR=#FFFFFF COLSPAN=".($maxcount+1).">Directory Path</TH>\n";
1.8 harris41 985: if (keys %diraccount) {
986: $description.= "<TR><TD ALIGN=LEFT BGCOLOR=#FFFFFF COLSPAN=".($maxcount+4)."><I><PRE>Directories that are unaccounted for: \n";
987: foreach my $d (keys %diraccount) {
988: $description.="$d\n";
989: }
990: $description.="</PRE></I></TH></TR>\n";
991: }
1.4 harris41 992: foreach my $d (@$dirs) {
993: my $dtable=$d;
994: $dtable=~s/\//\<\/TD\>\<TD\>/g;
995: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
996: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
997: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
998: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
999: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
1000: $description.=<<END;
1001: <TR>
1002: <TD BGCOLOR=#FFFFFF>$category</TD>
1003: <TD BGCOLOR=#FFFFFF><TT>$chmod $chown</TT></TD>
1004: <TD BGCOLOR=#FFFFFF><FONT COLOR=#FF0000><TT>$devchmod $devchown</TT></FONT></TD>
1005: <TD>
1006: $dtable
1007: </TD>
1008: </TR>
1009: END
1010: }
1011: $description.=<<END;
1012: </TABLE>
1013: </P>
1014: END
1015: return $description;
1016: }
1017:
1.6 harris41 1018: # ------------------- Make file type ownership and permissions description block
1019: sub make_file_type_ownership_and_permissions_description_block {
1020: my $description=<<END;
1021: <FONT SIZE=+2>File Type Ownership and Permissions Descriptions, $date</FONT>
1022: <P>
1023: This table shows what permissions and ownership settings correspond
1024: to each kind of file type.
1025: </P>
1026: <P>
1027: <TABLE BORDER=1 CELLPADDING=5 WIDTH=60%>
1028: <TR>
1029: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Icon</TH>
1030: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Type</TH>
1031: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Permissions</TH>
1032: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Development Permissions</TH>
1033: </TR>
1034: END
1035: foreach my $type (keys %{$info{'OWNERSHIP'}}) {
1036: if (defined($fcm{$type})) {
1037: my $chmod=$info{'OWNERSHIP'}{$type}{'CHMOD'};
1038: my $chown=$info{'OWNERSHIP'}{$type}{'CHOWN'};
1039: my $devchmod=$info{'DEVOWNERSHIP'}{$type}{'CHMOD'};
1040: my $devchown=$info{'DEVOWNERSHIP'}{$type}{'CHOWN'};
1041: $description.=<<END;
1042: <TR>
1043: <TD><IMG SRC="$fcm{$type}.gif" ALT="$type"></TD>
1044: <TD>$type</TD>
1045: <TD><TT>$chmod $chown</TT></TD>
1046: <TD><TT>$devchmod $devchown</TT></TD>
1047: </TR>
1048: END
1049: }
1050: }
1051: $description.=<<END;
1052: </TABLE>
1053: </P>
1054: END
1055: }
1056:
1.4 harris41 1057: # ------------------------- Make directory and file structure description block
1058: sub make_directory_and_file_structure_description_block {
1059: my ($dirs)=@_;
1060: my $description=<<END;
1061: <FONT SIZE=+2>Directory and File Structure Description, $date</FONT>
1.6 harris41 1062: <P>
1063: The icons on the left column correspond to the file type
1064: specified in the second column. The last column "Notes" shows compilation,
1.7 harris41 1065: dependency, and configuration information. The CVS location
1066: shows the location of the binary source file (if applicable) needed to
1067: be copied to the target. If the binary source file is not at
1068: the specified location, then the text is shown in
1069: <FONT COLOR=#FF0000>red</FONT>.
1.6 harris41 1070: </P>
1.4 harris41 1071: <P>
1.9 harris41 1072: <TABLE BORDER=1 CELLPADDING=5 WIDTH=500>
1.4 harris41 1073: END
1074: my $counter=0;
1075: my @colorindex=("#80FF80","#80FFFF","#FFFF80");
1.5 harris41 1076: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
1.4 harris41 1077: foreach my $d (@$dirs) {
1078: # set color
1079: my $color=$colorindex[$counter%3];
1080: # set other values
1081: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
1082: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
1083: # find subdirectories that are contained in this directory
1084: my @subdirs;
1085: foreach my $d2 (@$dirs) {
1.5 harris41 1086: if ($d2=~/^$d\/([^\/]+)$/) {
1.4 harris41 1087: push @subdirs,$1;
1088: }
1089: }
1090: # find files that are contained in this directory
1091: my @files;
1.5 harris41 1092: my @filesfull;
1.4 harris41 1093: foreach my $f (@allfiles) {
1.5 harris41 1094: if ($f=~/^$d\/([^\/]+)$/) {
1.4 harris41 1095: push @files,$1;
1.5 harris41 1096: push @filesfull,$f;
1.4 harris41 1097: }
1098: }
1099: # render starting HTML formatting elements
1100: if (@subdirs || @files) {
1101: my $subdirstring="<BR>* Relevant subdirectories: " . join(", ",@subdirs) if @subdirs;
1102: $description.=<<END;
1.5 harris41 1103: <TR><TD BGCOLOR=#000000 COLSPAN=6><FONT COLOR=$color><IMG SRC="directory.gif" ALT="directory">DIRECTORY -- $d $dirdescription
1104: $subdirstring</FONT></TD></TR>
1.4 harris41 1105: END
1106: }
1107: else {
1108: $description.=<<END;
1.5 harris41 1109: <TR><TD BGCOLOR=#000000 COLSPAN=6><FONT COLOR=$color><IMG SRC="emptydirectory.gif" ALT="empty directory">EMPTY DIRECTORY - $d $dirdescription</FONT></TD></TR>
1.4 harris41 1110: END
1111: }
1112: if (@files) {
1113: $description.=<<END;
1114: <TR>
1.5 harris41 1115: <TH BGCOLOR=$color ALIGN=LEFT COLSPAN=2>Type</TH>
1116: <TH BGCOLOR=$color ALIGN=LEFT>File Name</TH>
1117: <TH BGCOLOR=$color ALIGN=LEFT>Function</TH>
1118: <TH BGCOLOR=$color ALIGN=LEFT>CVS Location</TH>
1119: <TH BGCOLOR=$color ALIGN=LEFT>Notes</TH>
1.4 harris41 1120: </TR>
1121: END
1.5 harris41 1122: foreach my $i (0..$#files) {
1123: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
1124: my $fdescription=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DESCRIPTION'};
1125: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
1.9 harris41 1126: my $note=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'NOTE'};
1127: $note.="<BR>" if $note;
1128: my $listing=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'FILES'};
1129: my @E=split(/\s+/,$listing);
1130: $source=~/(.*)\/[^\/]+$/;
1131: my $sd=$1;
1132: my $eflag=0;
1133: foreach my $e (@E) {
1134: unless (-e "../../$sd/$e") {
1135: $e="<FONT COLOR=#FF0000>$e</FONT>";
1136: $eflag=1;
1137: }
1138: }
1139: $listing=join("\n",@E);
1140: $listing="<B>listing</B><BR><FONT SIZE=-2>$listing</FONT>" if $listing;
1141: $listing.="<BR>" if $listing;
1142: my $build=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'BUILD'};
1143: $build="<B>build</B><BR>$build" if $build;
1144: $build.="<BR>" if $build;
1145: my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'};
1146: $dependencies="<B>dependencies</B><BR>$dependencies" if $dependencies;
1147: $dependencies.="<BR>" if $dependencies;
1.7 harris41 1148: unless (-e "../../$source") {
1149: $source=~/([^\/]+)$/;
1150: my $s=$1;
1.9 harris41 1151: if ($source!~/\*/) {
1152: $source="<FONT COLOR=#FF0000>$source</FONT>";
1153: }
1154: elsif ($eflag) {
1155: $source="<FONT COLOR=#FF0000>$source</FONT>";
1156: }
1.7 harris41 1157: }
1.5 harris41 1158: $description.=<<END;
1159: <TR>
1160: <TD BGCOLOR=#A0A0A0><IMG SRC="$fcm{$category}.gif" ALT="$category"></TD>
1161: <TD BGCOLOR=$color>$category</TD>
1162: <TD BGCOLOR=$color>$files[$i]</TD>
1163: <TD BGCOLOR=$color>$fdescription </TD>
1164: <TD BGCOLOR=$color>$source</TD>
1.9 harris41 1165: <TD BGCOLOR=$color>$note$listing$build$dependencies </TD>
1.4 harris41 1166: </TR>
1167: END
1.5 harris41 1168: }
1169: }
1.4 harris41 1170: $counter++;
1171: }
1172: $description.=<<END;
1173: </TABLE>
1174: </P>
1175: END
1176: return $description;
1177: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>