Annotation of loncom/build/parse.pl, revision 1.20
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.19 harris41 184: $description.=<<END;
1.18 harris41 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'};
1.20 ! harris41 254: my ($owner,$group)=split(/\:/,$devchown);
1.11 harris41 255: my $own=$devchown; $own=~s/\:/\,/;
256: $description.=<<END;
1.20 ! harris41 257: \tinstall -o $owner -g $group -m $devchmod -d \$(TARGET)/$d
1.11 harris41 258: END
259: }
260: $description.=<<END;
261:
262: END
263: return $description;
264: }
265:
266: # --------------------------------------- Commands to make BinaryRoot files
267: sub make_files_binaryroot_segment {
268: my ($dirs)=@_;
269: my $description=<<END;
270: files:
271: END
272: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
273: foreach my $d (@$dirs) {
274: # set other values
275: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
276: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
277: # find files that are contained in this directory
278: my @files;
279: my @filesfull;
280: foreach my $f (@allfiles) {
281: if ($f=~/^$d\/([^\/]+)$/) {
282: push @files,$1;
283: push @filesfull,$f;
284: }
285: }
286: # render starting HTML formatting elements
287: if (@files) {
288: $description.=<<END;
289: \t# $d $dirdescription
290: END
291: }
292: if (@files) {
293: foreach my $i (0..$#files) {
294: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
295: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
296: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
297: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
298: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
299: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
300: my $rot=$filesfull[$i];
301: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
1.20 ! harris41 302: my ($owner,$group)=split(/\:/,$devchown);
1.11 harris41 303: $description.=<<END if $category ne 'symbolic link';
1.20 ! harris41 304: \tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
1.11 harris41 305: END
306: }
307: }
308: }
309: $description.=<<END;
310:
311: END
312: return $description;
313: }
314:
315: # ------------------------------ Commands to make BinaryRoot symbolic links
316: sub make_links_binaryroot_segment {
317: my ($dirs)=@_;
318: my $description=<<END;
319: links:
320: END
321: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
322: foreach my $d (@$dirs) {
323: # find files that are contained in this directory
324: my @files;
325: my @filesfull;
326: foreach my $f (@allfiles) {
327: if ($f=~/^$d\/([^\/]+)$/) {
328: push @files,$1;
329: push @filesfull,$f;
330: }
331: }
332: # render starting HTML formatting elements
333: if (@files) {
334: foreach my $i (0..$#files) {
335: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
336: my $linkto=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'LINKTO'};
337: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
338: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
339: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
340: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
341: $description.=<<END if $category eq 'symbolic link';
342: \tln -s /$linkto \$(TARGET)/$filesfull[$i]
343: END
344: }
345: }
346: }
347: $description.=<<END;
348:
349: END
350: return $description;
1.10 harris41 351: }
352:
1.14 harris41 353: # ------ Installation commands for a Makefile used only by a rpm -ba invocation
354: sub make_directory_LCMakefile_segment {
355: my ($dirs)=@_;
356: my $description=<<END;
357: directories:
358: END
359: foreach my $d (@$dirs) {
360: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
361: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
362: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
363: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
364: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
365: my $own=$devchown; $own=~s/\:/\,/;
366: $description.=<<END;
367: \tinstall -m $devchmod -d \$(SOURCE)/$d \$(ROOT)/$d
368: END
369: }
370: $description.=<<END;
371:
372: END
373: return $description;
374: }
375:
376: # ------ Installation commands for a Makefile used only by a rpm -ba invocation
377: sub make_files_LCMakefile_segment {
378: my ($dirs)=@_;
379: my $description=<<END;
380: files:
381: END
382: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
383: foreach my $d (@$dirs) {
384: # set other values
385: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
386: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
387: # find files that are contained in this directory
388: my @files;
389: my @filesfull;
390: foreach my $f (@allfiles) {
391: if ($f=~/^$d\/([^\/]+)$/) {
392: push @files,$1;
393: push @filesfull,$f;
394: }
395: }
396: # render starting HTML formatting elements
397: if (@files) {
398: $description.=<<END;
399: \t# $d $dirdescription
400: END
401: }
402: if (@files) {
403: foreach my $i (0..$#files) {
404: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
405: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
406: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
407: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
408: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
409: my $rot=$filesfull[$i];
410: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
411: $description.=<<END if $category ne 'symbolic link';
412: \tinstall -m $devchmod \$(SOURCE)/$filesfull[$i] \$(ROOT)/$rot
413: END
414: }
415: }
416: }
417: $description.=<<END;
418:
419: END
420: return $description;
421: }
422:
423: # ------ Installation commands for a Makefile used only by a rpm -ba invocation
424: sub make_links_LCMakefile_segment {
425: my ($dirs)=@_;
426: my $description=<<END;
427: links:
428: END
429: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
430: foreach my $d (@$dirs) {
431: # find files that are contained in this directory
432: my @files;
433: my @filesfull;
434: foreach my $f (@allfiles) {
435: if ($f=~/^$d\/([^\/]+)$/) {
436: push @files,$1;
437: push @filesfull,$f;
438: }
439: }
440: # render starting HTML formatting elements
441: if (@files) {
442: foreach my $i (0..$#files) {
443: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
444: my $linkto=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'LINKTO'};
445: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
446: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
447: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
448: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
449: $description.=<<END if $category eq 'symbolic link';
450: \tln -s /$linkto \$(ROOT)/$filesfull[$i]
451: END
452: }
453: }
454: }
455: $description.=<<END;
456:
457: END
458: return $description;
459: }
460:
1.10 harris41 461: # --------------------------------- Installation commands to install directories
462: sub make_directory_install_segment {
463: my ($dirs)=@_;
464: my $description=<<END;
465: directories:
466: END
467: foreach my $d (@$dirs) {
468: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
1.14 harris41 469: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
1.10 harris41 470: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
471: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
472: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
473: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
1.16 harris41 474: my ($owner,$group)=split(/\:/,$devchown);
1.10 harris41 475: my $own=$devchown; $own=~s/\:/\,/;
476: $description.=<<END;
1.16 harris41 477: \tinstall -o $owner -g $group -m $devchmod -d \$(TARGET)/$d
1.10 harris41 478: END
479: }
480: $description.=<<END;
481:
482: END
483: return $description;
484: }
485:
1.15 harris41 486: # ------------------------------------------------------ Commands to build files
487: sub make_files_build_segment {
488: my ($dirs)=@_;
489: my $description;
490: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
491: my $tab="\t";
492: my $sources="all: ";
493: foreach my $d (@$dirs) {
494: # set other values
495: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
496: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
497: # find files that are contained in this directory
498: my @files;
499: my @filesfull;
500: foreach my $f (@allfiles) {
501: if ($f=~/^$d\/([^\/]+)$/) {
502: push @files,$1;
503: push @filesfull,$f;
504: }
505: }
506: if (@files) {
507: foreach my $i (0..$#files) {
508: # if has build information, output appropriate something
509: my $build=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'BUILD'};
510: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
511: $build=~s/^\s+//; $build=~s/\s+$//;
512: if ($build) {
513: my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'};
514: my $source2=$source;
515: $source2=~s/^[^\/]+\///;
516: $source2="../" . $source2;
517: $sources.="$source2 ";
518: my $directory=$build;
519: $directory=~s/^[^\/]+\///;
520: $directory=~s/([^\/]+)$//;
521: $directory="../" . $directory;
522: my $buildfile=$1;
523: my $sdir=$source;
524: $sdir=~s/^[^\/]+\///;
525: $sdir=~s/([^\/]+)$//;
526: $sdir="../" . $sdir;
527: $dependencies=~s/\s+$//;
528: my $depstat="";
529: if ($dependencies=~s/\s+\[ALWAYS_RUN_BUILD_COMMAND\]//) {
530: $depstat=" alwaysrun";
531: }
532: $dependencies=~s/\s+/ $sdir/gs;
533: $description.=<<END;
534: $source2: $dependencies$depstat
535: ${tab}cd $directory; sh ./$buildfile
536:
537: END
538: }
539: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
540: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
541: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
542: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
543: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
544: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
545: my $rot=$filesfull[$i];
546: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
547: # $description.=<<END if $category ne 'symbolic link';
1.16 harris41 548: #\tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
1.15 harris41 549: #END
550: }
551: }
552: }
553: $description.=<<END;
554: alwaysrun:
555:
556: END
557: $sources.="\n\n";
558: return ($sources . $description);
559: }
560:
1.10 harris41 561: # --------------------------------------- Installation commands to install files
562: sub make_files_install_segment {
563: my ($dirs)=@_;
564: my $description=<<END;
565: files:
566: END
567: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
568: foreach my $d (@$dirs) {
569: # set other values
570: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
571: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
572: # find files that are contained in this directory
573: my @files;
574: my @filesfull;
575: foreach my $f (@allfiles) {
576: if ($f=~/^$d\/([^\/]+)$/) {
577: push @files,$1;
578: push @filesfull,$f;
579: }
580: }
581: # render starting HTML formatting elements
582: if (@files) {
583: $description.=<<END;
584: \t# $d $dirdescription
585: END
586: }
587: if (@files) {
588: foreach my $i (0..$#files) {
589: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
1.14 harris41 590: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
1.10 harris41 591: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
592: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
593: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
594: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
595: my $rot=$filesfull[$i];
596: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
1.16 harris41 597: my ($owner,$group)=split(/\:/,$devchown);
1.15 harris41 598: if ($category ne 'conf') {
599: $description.=<<END if $category ne 'symbolic link';
1.16 harris41 600: \tinstall -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
601: END
602: }
603: }
604: }
605: }
606: $description.=<<END;
607:
608: END
609: return $description;
610: }
611:
612: # ------ Installation commands to install configuration files (and make backups)
613: sub make_files_configinstall_segment {
614: my ($dirs)=@_;
615: my $description=<<END;
616: configfiles:
617: END
618: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
619: foreach my $d (@$dirs) {
620: # set other values
621: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
622: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
623: # find files that are contained in this directory
624: my @files;
625: my @filesfull;
626: foreach my $f (@allfiles) {
627: if ($f=~/^$d\/([^\/]+)$/) {
628: push @files,$1;
629: push @filesfull,$f;
630: }
631: }
632: # render starting HTML formatting elements
633: if (@files) {
634: $description.=<<END;
635: \t# $d $dirdescription
636: END
637: }
638: if (@files) {
639: foreach my $i (0..$#files) {
640: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
641: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
642: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
643: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
644: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
645: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
646: my $rot=$filesfull[$i];
647: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
648: my ($owner,$group)=split(/\:/,$devchown);
649: if ($category eq 'conf') {
650: $description.=<<END;
651: \tinstall -b -S `date +'.\%Y\%m\%d\%H\%M\%S'` -o $owner -g $group -m $devchmod \$(SOURCE)/$source \$(TARGET)/$rot
1.17 harris41 652: END
653: }
654: }
655: }
656: }
657: $description.=<<END;
658:
659: END
660: return $description;
661: }
662:
663: # ------ Commands to enforce configuration file permissions
664: sub make_files_configpermissions_segment {
665: my ($dirs)=@_;
666: my $description=<<END;
667: configpermissions:
668: END
669: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
670: foreach my $d (@$dirs) {
671: # set other values
672: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
673: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
674: # find files that are contained in this directory
675: my @files;
676: my @filesfull;
677: foreach my $f (@allfiles) {
678: if ($f=~/^$d\/([^\/]+)$/) {
679: push @files,$1;
680: push @filesfull,$f;
681: }
682: }
683: # render starting HTML formatting elements
684: if (@files) {
685: $description.=<<END;
686: \t# $d $dirdescription
687: END
688: }
689: if (@files) {
690: foreach my $i (0..$#files) {
691: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
692: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
693: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
694: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
695: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
696: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
697: my $rot=$filesfull[$i];
698: $rot=~s/[^\/]+$/\./ if $rot=~/\*/;
699: my ($owner,$group)=split(/\:/,$devchown);
700: if ($category eq 'conf') {
701: $description.=<<END;
702: \tchmod $devchmod \$(TARGET)/$rot
703: \tchown $devchown \$(TARGET)/$rot
1.10 harris41 704: END
1.15 harris41 705: }
1.10 harris41 706: }
707: }
708: }
709: $description.=<<END;
710:
711: END
712: return $description;
713: }
714:
715: # ------------------------------ Installation commands to install symbolic links
716: sub make_links_install_segment {
717: my ($dirs)=@_;
718: my $description=<<END;
719: links:
720: END
1.16 harris41 721: chop $description;
722: my $description2;
1.10 harris41 723: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
724: foreach my $d (@$dirs) {
725: # find files that are contained in this directory
726: my @files;
727: my @filesfull;
728: foreach my $f (@allfiles) {
729: if ($f=~/^$d\/([^\/]+)$/) {
730: push @files,$1;
731: push @filesfull,$f;
732: }
733: }
734: # render starting HTML formatting elements
735: if (@files) {
736: foreach my $i (0..$#files) {
737: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
738: my $linkto=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'LINKTO'};
739: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
740: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
741: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
742: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
1.16 harris41 743: if ($category eq 'symbolic link') {
744: $description.=" \$(TARGET)/$filesfull[$i]";
745: $description2.=<<END;
746: \$(TARGET)/$filesfull[$i]:
1.14 harris41 747: \tln -s /$linkto \$(TARGET)/$filesfull[$i]
1.16 harris41 748:
1.10 harris41 749: END
1.16 harris41 750: }
1.10 harris41 751: }
752: }
753: }
754: $description.=<<END;
1.4 harris41 755:
1.10 harris41 756: END
1.16 harris41 757: $description.=$description2;
1.10 harris41 758: return $description;
759: }
760:
761: # --------------------------------------------------------- Make RPM .spec block
762: sub make_rpm_spec_block {
763: my $pwd=`pwd`; chop $pwd;
764: my $buildroot="$pwd/LON-CAPA-BuildRoot";
765: my $source=$info{'RPM'}{'Name'} . "-" . $info{'RPM'}{'Version'} . '.tar.gz';
766: my $description=<<END;
767: Summary: $info{'RPM'}{'Summary'}
768: Name: $info{'RPM'}{'Name'}
769: Version: $info{'RPM'}{'Version'}
770: Release: $info{'RPM'}{'Release'}
771: Vendor: $info{'RPM'}{'Vendor'}
772: BuildRoot: $buildroot
773: Copyright: $info{'RPM'}{'Copyright'}
774: Group: $info{'RPM'}{'Group'}
775: Source: $source
776: AutoReqProv: $info{'RPM'}{'AutoReqProv'}
777: \%description
778: $info{'RPM'}{'description'}
779:
780: END
781: return $description;
782: }
783:
784: # --------------------------------------------------- Make RPM build .spec block
785: sub make_rpm_build_block {
786: my $pwd=`pwd`; chop $pwd;
787: my $buildroot="$pwd/LON-CAPA-BuildRoot";
788: my $sourceroot="$pwd/LON-CAPA-SourceRoot";
789: my $description=<<END;
790:
791: \%prep
792: \%setup
793:
794: \%build
795: rm -Rf "$buildroot"
796:
797: \%install
798: make -f LCMakefile ROOT="\$RPM_BUILD_ROOT" SOURCE="$sourceroot" directories
799: make -f LCMakefile ROOT="\$RPM_BUILD_ROOT" SOURCE="$sourceroot" files
800: make -f LCMakefile ROOT="\$RPM_BUILD_ROOT" SOURCE="$sourceroot" links
801:
802: \%pre
803: $info{'RPM'}{'pre'}
804:
805: \%post
806: \%postun
807:
808: \%files
809: # \%doc README COPYING ChangeLog LICENSE
810: END
811: return $description;
812: }
813:
814: # ------------------------------------- Make directory structure RPM .spec block
815: sub make_directory_structure_spec_block {
816: my ($dirs)=@_;
817: foreach my $d (@$dirs) {
818: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
819: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
820: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
821: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
822: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
823: my $own=$devchown; $own=~s/\:/\,/;
824: $description.=<<END;
825: \%dir \%attr($devchmod,$own) /$d
826: END
827: }
828: return $description;
829: }
830:
831: # ---------------------------- Make directory and file structure RPM .spec block
832: sub make_directory_and_file_structure_spec_block {
833: my ($dirs)=@_;
834: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
835: foreach my $d (@$dirs) {
836: # set other values
837: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
838: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
839: # find files that are contained in this directory
840: my @files;
841: my @filesfull;
842: foreach my $f (@allfiles) {
843: if ($f=~/^$d\/([^\/]+)$/) {
844: push @files,$1;
845: push @filesfull,$f;
846: }
847: }
848: # render starting HTML formatting elements
849: if (@files) {
850: $description.=<<END;
851: # $d $dirdescription
852: END
853: }
854: if (@files) {
855: foreach my $i (0..$#files) {
856: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
857: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
858: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
859: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
860: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
861: my $own=$devchown; $own=~s/\:/\,/;
862: my $config="";
863: $config="\%config " if $category eq 'conf';
864: $devchmod='-' if $category eq 'symbolic link';
865: $description.=<<END;
866: $config\%attr($devchmod,$own) /$filesfull[$i]
867: END
868: }
869: }
870: }
871: return $description;
872: }
873:
874: # ----------------------------------------------------------- End RPM .spec page
875: sub end_spec_page {
876: }
877:
878: # ------------------------------------------------------- Begin description page
1.4 harris41 879: sub begin_description_page {
880: my $description=<<END;
881: <HTML>
882: <HEAD>
883: <TITLE>LON-CAPA Software Description Page ($distribution, $date)</TITLE>
884: </HEAD>
885: <BODY>
886: <FONT SIZE=+2>LON-CAPA Software Description Page ($distribution, $date)</FONT>
887: <BR>Michigan State University
888: <BR>Learning Online with CAPA
889: <BR>Contact korte\@lon-capa.org
890: <UL>
891: <LI>About this file
892: <LI>Software Package Description
893: <LI>Directory Structure
1.7 harris41 894: <LI>File Type Ownership and Permissions
1.4 harris41 895: <LI>File and Directory Structure
896: </UL>
897: <FONT SIZE=+2>About this file</FONT>
898: <P>
899: This file is generated dynamically by <TT>parse.pl</TT> as
900: part of a development compilation process. See
901: http://install.lon-capa.org/compile/index.html for more
902: information.
903: </P>
904: END
905: return $description;
906: }
907:
908: # ------------------------------------------------- End description page
909: sub end_description_page {
910: my $description=<<END;
911: <HR>
1.5 harris41 912: <FONT SIZE=-1>LON-CAPA Software Development Team</FONT>
1.4 harris41 913: </BODY>
914: </HTML>
915: END
916: return $description;
917: }
918:
919: # ------------------------------------------------- Make RPM description block
920: sub make_rpm_description_block {
921: my $description=<<END;
922: <FONT SIZE=+2>Rolled in a RedHat 6.2 RPM, $date</FONT>
923: <P>
924: <TABLE BGCOLOR=#FFFFFF BORDER=0 CELLPADDING=10 CELLSPACING=0>
925: <TR><TD>
926: <PRE>
927: Name : $info{'RPM'}{'Name'}
928: Version : $info{'RPM'}{'Version'}
929: Vendor : $info{'RPM'}{'Vendor'}
930: Release : $info{'RPM'}{'Release'}
931: Build Host : $buildhost
932: Group : $info{'RPM'}{'Group'}
933: License : $info{'RPM'}{'Copyright'}
934: Summary : $info{'RPM'}{'Summary'}
935: Description :
936: $info{'RPM'}{'description'}
937: </PRE>
938: </TD></TR>
939: </TABLE>
940: </P>
941: END
942: return $description;
943: }
944:
945: # ----------------------------------------------- Determine directory structure
946: sub determine_directory_structure {
947: my @directories=keys %{$info{'DIRECTORY'}{$distribution}};
948: return (sort @directories);
949: }
1.1 harris41 950:
1.4 harris41 951:
952: # ---------------------------------- Make directory structure description block
953: sub make_directory_structure_description_block {
954: my ($dirs)=@_;
955: my $description=<<END;
956: <FONT SIZE=+2>Directory Structure Description, $date</FONT>
957: <P>
1.9 harris41 958: The directory structure description below shows only those
959: directories which either contain LON-CAPA specific files
960: or normally do not exist on a RedHat Linux system (and
961: must be generated to allow proper placement of files
962: during LON-CAPA run-time operation).
963: </P>
964: <P>
1.4 harris41 965: <TABLE BORDER=1 CELLPADDING=3 CELLSPACING=0>
966: END
967: my $maxcount=0;
1.8 harris41 968: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
969: my %diraccount; # hash to track which directories are accounted for
970: foreach my $file (@allfiles) {
971: $file=~/^(.*)\/([^\/]+)$/;
972: $diraccount{$1}=1;
973: }
1.4 harris41 974: foreach my $d (@$dirs) {
975: my (@matches)=($d=~/\//g);
976: my $count=scalar(@matches);
977: $maxcount=$count if $count>$maxcount;
1.8 harris41 978: delete $diraccount{$d};
1.4 harris41 979: }
980: $description.=<<END;
981: <TR>
982: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Category</TH>
983: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Permissions</TH>
984: <TH ALIGN=LEFT BGCOLOR=#FFFFFF><FONT COLOR=#FF0000>Development<BR>Permissions</FONT></TH>
985: END
986: $description.="<TH ALIGN=LEFT BGCOLOR=#FFFFFF COLSPAN=".($maxcount+1).">Directory Path</TH>\n";
1.8 harris41 987: if (keys %diraccount) {
988: $description.= "<TR><TD ALIGN=LEFT BGCOLOR=#FFFFFF COLSPAN=".($maxcount+4)."><I><PRE>Directories that are unaccounted for: \n";
989: foreach my $d (keys %diraccount) {
990: $description.="$d\n";
991: }
992: $description.="</PRE></I></TH></TR>\n";
993: }
1.4 harris41 994: foreach my $d (@$dirs) {
995: my $dtable=$d;
996: $dtable=~s/\//\<\/TD\>\<TD\>/g;
997: my $category=$info{'DIRECTORY'}{$distribution}{$d}{'CATEGORY'};
998: my $chown=$info{'OWNERSHIP'}{$category}{'CHOWN'};
999: my $chmod=$info{'OWNERSHIP'}{$category}{'CHMOD'};
1000: my $devchown=$info{'DEVOWNERSHIP'}{$category}{'CHOWN'};
1001: my $devchmod=$info{'DEVOWNERSHIP'}{$category}{'CHMOD'};
1002: $description.=<<END;
1003: <TR>
1004: <TD BGCOLOR=#FFFFFF>$category</TD>
1005: <TD BGCOLOR=#FFFFFF><TT>$chmod $chown</TT></TD>
1006: <TD BGCOLOR=#FFFFFF><FONT COLOR=#FF0000><TT>$devchmod $devchown</TT></FONT></TD>
1007: <TD>
1008: $dtable
1009: </TD>
1010: </TR>
1011: END
1012: }
1013: $description.=<<END;
1014: </TABLE>
1015: </P>
1016: END
1017: return $description;
1018: }
1019:
1.6 harris41 1020: # ------------------- Make file type ownership and permissions description block
1021: sub make_file_type_ownership_and_permissions_description_block {
1022: my $description=<<END;
1023: <FONT SIZE=+2>File Type Ownership and Permissions Descriptions, $date</FONT>
1024: <P>
1025: This table shows what permissions and ownership settings correspond
1026: to each kind of file type.
1027: </P>
1028: <P>
1029: <TABLE BORDER=1 CELLPADDING=5 WIDTH=60%>
1030: <TR>
1031: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Icon</TH>
1032: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Type</TH>
1033: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Permissions</TH>
1034: <TH ALIGN=LEFT BGCOLOR=#FFFFFF>Development Permissions</TH>
1035: </TR>
1036: END
1037: foreach my $type (keys %{$info{'OWNERSHIP'}}) {
1038: if (defined($fcm{$type})) {
1039: my $chmod=$info{'OWNERSHIP'}{$type}{'CHMOD'};
1040: my $chown=$info{'OWNERSHIP'}{$type}{'CHOWN'};
1041: my $devchmod=$info{'DEVOWNERSHIP'}{$type}{'CHMOD'};
1042: my $devchown=$info{'DEVOWNERSHIP'}{$type}{'CHOWN'};
1043: $description.=<<END;
1044: <TR>
1045: <TD><IMG SRC="$fcm{$type}.gif" ALT="$type"></TD>
1046: <TD>$type</TD>
1047: <TD><TT>$chmod $chown</TT></TD>
1048: <TD><TT>$devchmod $devchown</TT></TD>
1049: </TR>
1050: END
1051: }
1052: }
1053: $description.=<<END;
1054: </TABLE>
1055: </P>
1056: END
1057: }
1058:
1.4 harris41 1059: # ------------------------- Make directory and file structure description block
1060: sub make_directory_and_file_structure_description_block {
1061: my ($dirs)=@_;
1062: my $description=<<END;
1063: <FONT SIZE=+2>Directory and File Structure Description, $date</FONT>
1.6 harris41 1064: <P>
1065: The icons on the left column correspond to the file type
1066: specified in the second column. The last column "Notes" shows compilation,
1.7 harris41 1067: dependency, and configuration information. The CVS location
1068: shows the location of the binary source file (if applicable) needed to
1069: be copied to the target. If the binary source file is not at
1070: the specified location, then the text is shown in
1071: <FONT COLOR=#FF0000>red</FONT>.
1.6 harris41 1072: </P>
1.4 harris41 1073: <P>
1.9 harris41 1074: <TABLE BORDER=1 CELLPADDING=5 WIDTH=500>
1.4 harris41 1075: END
1076: my $counter=0;
1077: my @colorindex=("#80FF80","#80FFFF","#FFFF80");
1.5 harris41 1078: my @allfiles=keys %{$info{'LOCATION'}{$distribution}};
1.4 harris41 1079: foreach my $d (@$dirs) {
1080: # set color
1081: my $color=$colorindex[$counter%3];
1082: # set other values
1083: my $dirdescription=$info{'DIRECTORY'}{$distribution}{$d}{'DESCRIPTION'};
1084: $dirdescription="(" . $dirdescription . ")" if $dirdescription;
1085: # find subdirectories that are contained in this directory
1086: my @subdirs;
1087: foreach my $d2 (@$dirs) {
1.5 harris41 1088: if ($d2=~/^$d\/([^\/]+)$/) {
1.4 harris41 1089: push @subdirs,$1;
1090: }
1091: }
1092: # find files that are contained in this directory
1093: my @files;
1.5 harris41 1094: my @filesfull;
1.4 harris41 1095: foreach my $f (@allfiles) {
1.5 harris41 1096: if ($f=~/^$d\/([^\/]+)$/) {
1.4 harris41 1097: push @files,$1;
1.5 harris41 1098: push @filesfull,$f;
1.4 harris41 1099: }
1100: }
1101: # render starting HTML formatting elements
1102: if (@subdirs || @files) {
1103: my $subdirstring="<BR>* Relevant subdirectories: " . join(", ",@subdirs) if @subdirs;
1104: $description.=<<END;
1.5 harris41 1105: <TR><TD BGCOLOR=#000000 COLSPAN=6><FONT COLOR=$color><IMG SRC="directory.gif" ALT="directory">DIRECTORY -- $d $dirdescription
1106: $subdirstring</FONT></TD></TR>
1.4 harris41 1107: END
1108: }
1109: else {
1110: $description.=<<END;
1.5 harris41 1111: <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 1112: END
1113: }
1114: if (@files) {
1115: $description.=<<END;
1116: <TR>
1.5 harris41 1117: <TH BGCOLOR=$color ALIGN=LEFT COLSPAN=2>Type</TH>
1118: <TH BGCOLOR=$color ALIGN=LEFT>File Name</TH>
1119: <TH BGCOLOR=$color ALIGN=LEFT>Function</TH>
1120: <TH BGCOLOR=$color ALIGN=LEFT>CVS Location</TH>
1121: <TH BGCOLOR=$color ALIGN=LEFT>Notes</TH>
1.4 harris41 1122: </TR>
1123: END
1.5 harris41 1124: foreach my $i (0..$#files) {
1125: my $category=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'CATEGORY'};
1126: my $fdescription=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DESCRIPTION'};
1127: my $source=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'SOURCE'};
1.9 harris41 1128: my $note=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'NOTE'};
1129: $note.="<BR>" if $note;
1130: my $listing=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'FILES'};
1131: my @E=split(/\s+/,$listing);
1132: $source=~/(.*)\/[^\/]+$/;
1133: my $sd=$1;
1134: my $eflag=0;
1135: foreach my $e (@E) {
1136: unless (-e "../../$sd/$e") {
1137: $e="<FONT COLOR=#FF0000>$e</FONT>";
1138: $eflag=1;
1139: }
1140: }
1141: $listing=join("\n",@E);
1142: $listing="<B>listing</B><BR><FONT SIZE=-2>$listing</FONT>" if $listing;
1143: $listing.="<BR>" if $listing;
1144: my $build=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'BUILD'};
1145: $build="<B>build</B><BR>$build" if $build;
1146: $build.="<BR>" if $build;
1147: my $dependencies=$info{'LOCATION'}{$distribution}{$filesfull[$i]}{'DEPENDENCIES'};
1148: $dependencies="<B>dependencies</B><BR>$dependencies" if $dependencies;
1149: $dependencies.="<BR>" if $dependencies;
1.7 harris41 1150: unless (-e "../../$source") {
1151: $source=~/([^\/]+)$/;
1152: my $s=$1;
1.9 harris41 1153: if ($source!~/\*/) {
1154: $source="<FONT COLOR=#FF0000>$source</FONT>";
1155: }
1156: elsif ($eflag) {
1157: $source="<FONT COLOR=#FF0000>$source</FONT>";
1158: }
1.7 harris41 1159: }
1.5 harris41 1160: $description.=<<END;
1161: <TR>
1162: <TD BGCOLOR=#A0A0A0><IMG SRC="$fcm{$category}.gif" ALT="$category"></TD>
1163: <TD BGCOLOR=$color>$category</TD>
1164: <TD BGCOLOR=$color>$files[$i]</TD>
1165: <TD BGCOLOR=$color>$fdescription </TD>
1166: <TD BGCOLOR=$color>$source</TD>
1.9 harris41 1167: <TD BGCOLOR=$color>$note$listing$build$dependencies </TD>
1.4 harris41 1168: </TR>
1169: END
1.5 harris41 1170: }
1171: }
1.4 harris41 1172: $counter++;
1173: }
1174: $description.=<<END;
1175: </TABLE>
1176: </P>
1177: END
1178: return $description;
1179: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>