diff --git a/data/ports/Makefile b/data/ports/Makefile index 555f3d76d9..23ad0f6833 100644 --- a/data/ports/Makefile +++ b/data/ports/Makefile @@ -1,24 +1,27 @@ -# $Id: Makefile,v 1.8 1998-04-14 23:46:42 steve Exp $ +# $Id: Makefile,v 1.9 1998-06-10 15:52:30 wosch Exp $ PORTINDEX= perl ./portindex INDEX= ports/INDEX COOKIE= ${INDEX} Makefile.gen .if exists(Makefile.gen) .include "Makefile.gen" -CLEANFILES+= ${DOCS} Makefile.gen ${INDEX} +CLEANFILES+= ${DOCS} Makefile.gen ${INDEX} packages.exists .endif ${INDEX}: cvs -QR co ${INDEX} +packages.exists: + ./packages > ${.TARGET} + Makefile.gen: index.sgml .NOTMAIN echo DOCS= *.sgml > Makefile.gen ${MAKE} ${MAKEFLAGS} ${.IMPSRC} -index.sgml: ${INDEX} portindex ports.inc .NOTMAIN +index.sgml: ${INDEX} packages.exists portindex ports.inc .NOTMAIN rm -f *.sgml ${PORTINDEX} ${INDEX} .include "../web.mk" diff --git a/data/ports/portindex b/data/ports/portindex index 06e1c2c84f..035a9dff85 100755 --- a/data/ports/portindex +++ b/data/ports/portindex @@ -1,176 +1,201 @@ #!/usr/bin/perl # convert a ports INDEX file to HTML # # by John Fieber # Mon May 13 10:31:58 EST 1996 ############################################################ # This is the base of where we ftp stuff from $base = "ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current"; $baseHTTP = "http://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current"; $urlcgi = 'http://www.freebsd.org/cgi/url.cgi'; +$packagesURL = 'ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable/All/'; # better layout and link to the sources if ($urlcgi) { $baseHTTP = $urlcgi . '?' . $baseHTTP; } $today = &getdate; +&packages_exist('packages.exists', *packages); &main; sub getdate { @months = ("January", "February", "March", "April", "May","June", "July", "August", "September", "October", "November", "December"); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; return "Updated $months[$mon] $mday, $year"; } sub header { local ($fh, $htext) = @_; print $fh ""; print $fh "$today\">\n"; print $fh ""; print $fh "\n"; print $fh "\n"; print $fh ""; print $fh "%includes;\n"; print $fh "]>\n"; print $fh "&header;\n"; } sub footer { local ($fh, $ftext) = @_; print $fh "\n$ftext\n"; print $fh "&footer;\n"; print $fh "\n\n"; } +sub packages_exist { + local($file, *p) = @_; + + open(P, $file) || do { + warn "open $file: $!\n"; + warn "Cannot create packages links\n"; + return 1; + }; + + while(

) { + chop; + $p{$_} = 1; + } + close P; + return 0; +} + sub main { $sep = ":"; while (<>) { chop; s/&/&/g; s//>/g; # Read a record ($name, $loc, $prefix, $desc, $ldesc, $owner, $cats, $keys, $bdep, $rdep) = split('\|'); # Check for double hyphens in the name (--). $name =~ s/--/-/g; # Split the categories into an array @cat = split("[ \t]+", $cats); $catkey{$name} = $cat[0]; foreach $i (@cat) { $stats{$i}++; # figure out the FTP url $loc =~ s/\/usr/$base/; $ldesc =~ s/\/usr/$baseHTTP/; # The name description and maintainer $data{$i} .= "

$name "; - $data{$i} .= "
$desc
Long description"; + + + $data{$i} .= "
$desc
Long description"; + if ($packages{"$name.tgz"}) { + $data{$i} .= qq{ | Package}; + } + $ownerurl = $owner; $ownerurl =~ s/<//g; $data{$i} .= "
Maintained by: $owner"; # If there are any dependencies, list them if ($bdep ne "" || $rdep ne "") { $data{$i} .= "
Requires: "; @dep = split(/ /, "$bdep $rdep"); foreach $j (@dep) { $data{$i} .= " $j,"; } # remove the trailing comma chop $data{$i}; } # If the port is listed in more than one category, throw # in some cross references if ($#cat > 0) { $data{$i} .= "
Also listed in: "; foreach $j (@cat) { if ($j ne $i) { if ($j eq $cat[0]) { $data{$i} .= " \u$j,"; } else { $data{$i} .= " \u$j,"; } } } # remove the trailing comma chop($data{$i}); } $data{$i} .= "

\n" } # Add an entry to the master index $master[$portnumber] = "$name " . " -- $desc
\n"; $portnumber++; } open(MOUTF, ">index.sgml"); &header(MOUTF, "FreeBSD Ports"); # print MOUTF "\n"; print MOUTF "&blurb;"; print MOUTF "

There are currently $portnumber ports in the FreeBSD Ports Collection.
Download a gzip'd tar file of all $portnumber ports (about 4 megabytes) or browse the following categories:\n"; print MOUTF "

\n"; print MOUTF "\n"; &footer(MOUTF, ""); close(MOUTF); # Create the master index file open(MINDEX, ">master-index.sgml"); &header(MINDEX, "FreeBSD Ports Collection Index"); print MINDEX "

\n"; print MINDEX sort @master; print MINDEX "

"; &footer(MINDEX, "
Port Categories
"); close(MINDEX); } diff --git a/en/ports/Makefile b/en/ports/Makefile index 555f3d76d9..23ad0f6833 100644 --- a/en/ports/Makefile +++ b/en/ports/Makefile @@ -1,24 +1,27 @@ -# $Id: Makefile,v 1.8 1998-04-14 23:46:42 steve Exp $ +# $Id: Makefile,v 1.9 1998-06-10 15:52:30 wosch Exp $ PORTINDEX= perl ./portindex INDEX= ports/INDEX COOKIE= ${INDEX} Makefile.gen .if exists(Makefile.gen) .include "Makefile.gen" -CLEANFILES+= ${DOCS} Makefile.gen ${INDEX} +CLEANFILES+= ${DOCS} Makefile.gen ${INDEX} packages.exists .endif ${INDEX}: cvs -QR co ${INDEX} +packages.exists: + ./packages > ${.TARGET} + Makefile.gen: index.sgml .NOTMAIN echo DOCS= *.sgml > Makefile.gen ${MAKE} ${MAKEFLAGS} ${.IMPSRC} -index.sgml: ${INDEX} portindex ports.inc .NOTMAIN +index.sgml: ${INDEX} packages.exists portindex ports.inc .NOTMAIN rm -f *.sgml ${PORTINDEX} ${INDEX} .include "../web.mk" diff --git a/en/ports/portindex b/en/ports/portindex index 06e1c2c84f..035a9dff85 100755 --- a/en/ports/portindex +++ b/en/ports/portindex @@ -1,176 +1,201 @@ #!/usr/bin/perl # convert a ports INDEX file to HTML # # by John Fieber # Mon May 13 10:31:58 EST 1996 ############################################################ # This is the base of where we ftp stuff from $base = "ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current"; $baseHTTP = "http://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current"; $urlcgi = 'http://www.freebsd.org/cgi/url.cgi'; +$packagesURL = 'ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable/All/'; # better layout and link to the sources if ($urlcgi) { $baseHTTP = $urlcgi . '?' . $baseHTTP; } $today = &getdate; +&packages_exist('packages.exists', *packages); &main; sub getdate { @months = ("January", "February", "March", "April", "May","June", "July", "August", "September", "October", "November", "December"); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; return "Updated $months[$mon] $mday, $year"; } sub header { local ($fh, $htext) = @_; print $fh ""; print $fh "$today\">\n"; print $fh ""; print $fh "\n"; print $fh "\n"; print $fh ""; print $fh "%includes;\n"; print $fh "]>\n"; print $fh "&header;\n"; } sub footer { local ($fh, $ftext) = @_; print $fh "\n$ftext\n"; print $fh "&footer;\n"; print $fh "\n\n"; } +sub packages_exist { + local($file, *p) = @_; + + open(P, $file) || do { + warn "open $file: $!\n"; + warn "Cannot create packages links\n"; + return 1; + }; + + while(

) { + chop; + $p{$_} = 1; + } + close P; + return 0; +} + sub main { $sep = ":"; while (<>) { chop; s/&/&/g; s//>/g; # Read a record ($name, $loc, $prefix, $desc, $ldesc, $owner, $cats, $keys, $bdep, $rdep) = split('\|'); # Check for double hyphens in the name (--). $name =~ s/--/-/g; # Split the categories into an array @cat = split("[ \t]+", $cats); $catkey{$name} = $cat[0]; foreach $i (@cat) { $stats{$i}++; # figure out the FTP url $loc =~ s/\/usr/$base/; $ldesc =~ s/\/usr/$baseHTTP/; # The name description and maintainer $data{$i} .= "

$name "; - $data{$i} .= "
$desc
Long description"; + + + $data{$i} .= "
$desc
Long description"; + if ($packages{"$name.tgz"}) { + $data{$i} .= qq{ | Package}; + } + $ownerurl = $owner; $ownerurl =~ s/<//g; $data{$i} .= "
Maintained by: $owner"; # If there are any dependencies, list them if ($bdep ne "" || $rdep ne "") { $data{$i} .= "
Requires: "; @dep = split(/ /, "$bdep $rdep"); foreach $j (@dep) { $data{$i} .= " $j,"; } # remove the trailing comma chop $data{$i}; } # If the port is listed in more than one category, throw # in some cross references if ($#cat > 0) { $data{$i} .= "
Also listed in: "; foreach $j (@cat) { if ($j ne $i) { if ($j eq $cat[0]) { $data{$i} .= " \u$j,"; } else { $data{$i} .= " \u$j,"; } } } # remove the trailing comma chop($data{$i}); } $data{$i} .= "

\n" } # Add an entry to the master index $master[$portnumber] = "$name " . " -- $desc
\n"; $portnumber++; } open(MOUTF, ">index.sgml"); &header(MOUTF, "FreeBSD Ports"); # print MOUTF "\n"; print MOUTF "&blurb;"; print MOUTF "

There are currently $portnumber ports in the FreeBSD Ports Collection.
Download a gzip'd tar file of all $portnumber ports (about 4 megabytes) or browse the following categories:\n"; print MOUTF "

\n"; print MOUTF "\n"; &footer(MOUTF, ""); close(MOUTF); # Create the master index file open(MINDEX, ">master-index.sgml"); &header(MINDEX, "FreeBSD Ports Collection Index"); print MINDEX "

\n"; print MINDEX sort @master; print MINDEX "

"; &footer(MINDEX, "
Port Categories
"); close(MINDEX); }