diff --git a/en/ports/Makefile b/en/ports/Makefile index 7a55d6e902..1c815a672c 100644 --- a/en/ports/Makefile +++ b/en/ports/Makefile @@ -1,83 +1,93 @@ -# $FreeBSD: www/en/ports/Makefile,v 1.40 2005/10/18 03:45:12 linimon Exp $ +# $FreeBSD: www/en/ports/Makefile,v 1.41 2005/10/18 12:24:12 edwin Exp $ .if exists(../Makefile.conf) .include "../Makefile.conf" .endif .if exists(../Makefile.inc) .include "../Makefile.inc" .endif .if exists(Makefile.inc) .include "Makefile.inc" .endif FETCH_OPT?= -am # # Force NO_TIDY for the ports web pages, since it takes a long time to # run tidy on these huge HTML files, and the files are valid HTML when # generated by portindex, even without tidy. # NO_TIDY= YES .if defined(PINDEX_OVERRIDE) ${INDEX}: ${PINDEX_OVERRIDE} ${CP} ${PINDEX_OVERRIDE} ${INDEX} .elif defined(NOPORTSNET) ${INDEX}: $${PORTSBASE}/${PINDEX} ${CP} ${PORTSBASE}/${PINDEX} ${INDEX} .else ${INDEX}: ${FETCH} ${FETCH_OPT} ${INDEXURI} .endif # build the list of available packages only on the # main FreeBSD machines hostname!= hostname # # don't build the packages links if NO_PACKAGES_LINK # is set and not empty. # # XXX: you can set NO_PACKAGES_LINK to your hostname to # test the packages link generation # .if defined(NO_PACKAGES_LINK) && !empty(NO_PACKAGES_LINK) hostname= ${NO_PACKAGES_LINK} .endif packages.exists: .if ${hostname} == "hub.freebsd.org" || ${hostname} == "freefall.freebsd.org" || ${hostname} == "www.freebsd.org" @if ${SH} ${.CURDIR}/packages > ${.TARGET}.temp; then \ ${MV} ${.TARGET}.temp ${.TARGET}; \ else \ ${RM} ${.TARGET}.temp; ${TOUCH} ${.TARGET}; \ fi; .else ${TOUCH} ${.TARGET} .endif Makefile.gen: index.sgml .NOTMAIN ${ECHO_CMD} DOCS= *.sgml > Makefile.gen .if defined(NO_TIDY) ${ECHO_CMD} NO_TIDY=${NO_TIDY} >> Makefile.gen .endif -index.sgml: ${INDEX} categories categories.descriptions packages.exists portindex ports.inc .NOTMAIN +PORTS_TARGZ_URL?= ftp://ftp-master.FreeBSD.org/pub/FreeBSD/ports/ports/ports.tar.gz + +ports.size: +.if defined (NOPORTSNET) + touch ${.TARGET} +.else + ${RM} -f ${.TARGET} + ${FETCH} -s ${PORTS_TARGZ_URL} > ${.TARGET} +.endif + +index.sgml: ${INDEX} categories categories.descriptions packages.exists portindex ports.inc ports.size .NOTMAIN ${RM} -f *.sgml ${PORTINDEX} ${INDEX} ${.CURDIR} install: all beforeinstall all install clean: cd ${.CURDIR}; \ ${MAKE} ${MAKEFLAGS} -f ${.CURDIR}/Makefile.inc0 ${.TARGET} .if defined(WITH_PORTS_GROWTH) cd growth; \ ${MAKE} ${MAKEFLAGS} ${.TARGET} beforeinstall: .else beforeinstall: ${SED} -i "" -e 's,HREF="growth,href="http://www.FreeBSD.org/ports/growth,' index.html .endif .include "${WEB_PREFIX}/share/mk/web.site.mk" diff --git a/en/ports/Makefile.inc b/en/ports/Makefile.inc index 76a899b5f2..2f6606ad80 100644 --- a/en/ports/Makefile.inc +++ b/en/ports/Makefile.inc @@ -1,15 +1,16 @@ -# $FreeBSD: www/en/ports/Makefile.inc,v 1.5 2001/01/04 22:12:42 wosch Exp $ +# $FreeBSD: www/en/ports/Makefile.inc,v 1.6 2001/06/14 03:09:56 dd Exp $ PORTINDEX= ${PERL} ${.CURDIR}/portindex INDEX= INDEX PINDEX= ports/${INDEX} COOKIE= ${INDEX} Makefile.gen CLEANFILES+= ${INDEX} CLEANFILES+= packages.exists.temp packages.exists CLEANFILES+= ${DOCS} CLEANFILES+= Makefile.gen +CLEANFILES+= ports.size _ALLINSTALL= packages.exists ${INDEX} categories diff --git a/en/ports/portindex b/en/ports/portindex index 47eb183341..98ca8a8992 100755 --- a/en/ports/portindex +++ b/en/ports/portindex @@ -1,343 +1,353 @@ #!/usr/bin/perl -w # convert a ports INDEX file to HTML # # by John Fieber # Mon May 13 10:31:58 EST 1996 -# $FreeBSD: www/en/ports/portindex,v 1.52 2005/10/04 19:43:49 hrs Exp $ +# $FreeBSD: www/en/ports/portindex,v 1.53 2005/10/18 03:45:12 linimon Exp $ ############################################################ use strict; use POSIX; use IO::File; my $base = ""; my $baseHTTP = ""; my $urlcgi = ""; my $packagesURL = ""; my $today = getdate(); my %p = (); # Load local config file. You can override in portindex.conf # the variables for the default web and the ftp server. This # make it easy to maintain a local web mirror and let the # URL point to yourself and not to the standard FreeBSD FTP server. my $config = $0 . '.' . 'conf'; do $config if -f $config; # This is the base of where we ftp stuff from my $ftpserver; if ($ENV{'MASTER_FTP_SERVER'}) { $ftpserver = $ENV{'MASTER_FTP_SERVER'}; } else { $ftpserver = 'ftp://ftp.FreeBSD.org' if !$ftpserver; } $baseHTTP = $base if !$baseHTTP; my $baseFTP = "$ftpserver/pub/FreeBSD/ports/ports"; my $baseCVSWEB = 'http://www.FreeBSD.org/cgi/cvsweb.cgi/'; $urlcgi = 'http://www.FreeBSD.org/cgi/url.cgi' if !$urlcgi; $packagesURL = "$ftpserver/pub/FreeBSD/ports/i386/packages-stable/All/" if !$packagesURL; # support tar on the fly or gzip'ed tar on the fly my $ftparchive = ''; $ftparchive = 'tar' if !defined $ftparchive; # ports download sources script my $pds = 'http://www.FreeBSD.org/cgi/pds.cgi'; # better layout and link to the sources if ($urlcgi) { $baseHTTP = $urlcgi . '?' . $baseHTTP; } my %packages = (); my %category_description = (); my @category_groups = (); my %category_groups = (); packages_exist('packages.exists'); category_description(($ARGV[1] || '.') . '/categories' ); category_groups(($ARGV[1] || '.') . '/categories.descriptions' ); main(); sub getdate { return POSIX::strftime("Last modified: %d-%B-%Y",localtime); } sub header { my $fh = shift; my $htext = shift; #local($fh, $htext) = @_; print $fh < $today"> %navincludes; %includes; ]> &header; EOF } sub footer { my $fh = shift; my $ftext = shift; #local ($fh, $ftext) = @_; print $fh < EOF } sub packages_exist { my $file=shift; my %p; #local($file, *p) = @_; open(P, $file) || do { warn "open $file: $!\n"; warn "Cannot create packages links\n"; return 1; }; while(

) { chop; $packages{$_} = 1; } close P; } sub category_description { my $file = shift; open(P, $file) || do { warn "open $file: $!\n"; warn "Cannot find category description\n"; return 1; }; while(

) { # ignore comments next if /^\s*#/; if (/^\s*([^,]+),\s*"([^"]+)",([A-Z]+)/) { $category_description{$1}{desc}=$2; $category_description{$1}{group}=$3; } } close P; } sub category_groups { my $file = shift; open(P, $file) || do { warn "open $file: $!\n"; warn "Cannot find category groups\n"; return 1; }; while(

) { # ignore comments next if /^\s*#/; if (/^\s*([^,]+),\s*(.+)/) { $category_groups{$1}=$2 if (/^\s*([^,]+),\s*(.+)/); push(@category_groups,$1); } } close P; } sub main { my @master=(); my %stats; my %catkey; my %data; my $portnumber = 0; my $sep = ":"; my $moutf = new IO::File; my $outf = new IO::File; my $mindex = new IO::File; open(INDEX, $ARGV[0]); $portnumber = "0"; while () { chop; s/&/&/g; s//>/g; # Read a record my ($name, $loc, $prefix, $desc, $ldesc, $owner, $cats, $bdep, $rdep, $www) = split('\|'); # Check for double hyphens in the name (--). $name =~ s/--/-/g; # Split the categories into an array my @cat = split("[ \t]+", $cats); $catkey{$name} = $cat[0]; my $sourcepath = $loc; $sourcepath =~ s%/usr/%%; foreach my $i (sort(@cat)) { $stats{$i}++; # figure out the FTP url $loc =~ s/\/usr\//$baseCVSWEB/; $ldesc =~ s/\/usr\//$baseHTTP/; # The name description and maintainer $data{$i} .= "

$name "; $data{$i} .= "
$desc
Long description"; if ($packages{"$name.tbz"}) { $data{$i} .= qq{ | Package}; } elsif ($packages{"$name.tgz"}) { $data{$i} .= qq{ | Package}; } $data{$i} .= qq{ | Sources}; if ($www ne "") { $data{$i} .= qq{ | Main Web Site}; } my $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: "; my @dep = split(/ /, "$bdep $rdep"); my $last = ''; foreach my $j (sort @dep) { next if $j eq $last; $last = $j; $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 my $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 # workaround for SGML bug, `--' is not allowed in comments my $sname = $name; $sname =~ s/--/-=/g; $master[$portnumber] = "$name " . " -- $desc
\n"; $portnumber++; } + my $ptgzsize = `cat ports.size 2>/dev/null` || ""; + if ($ptgzsize =~ /^\d+$/) { + $ptgzsize = sprintf("%.0f", $ptgzsize/(1024*1024)); + } else { + warn "Unknown size for ports.tar.gz\n"; + } + $moutf->open(">index.sgml"); header($moutf, "FreeBSD Ports"); # print $moutf "\n"; print $moutf "&blurb;"; print $moutf <

Current status

There are currently $portnumber ports in the FreeBSD Ports Collection.
You may download a gzip'd tar file of all ports -(about 30 megabytes), view the +EOF + print $moutf "(about $ptgzsize megabytes)" if ($ptgzsize =~ /^\d+$/); + print $moutf <alphabetical list of all ports, or browse the ports in the following categories:

EOF if ($portnumber eq '0') { print $moutf "

none found

\n"; } else { foreach my $cg (@category_groups) { print $moutf "

",$category_groups{$cg},"

\n"; print $moutf "
    \n"; foreach my $key (sort(keys(%stats))) { next if ($category_description{$key}{group} ne $cg); # For the master file... print $moutf "
  • \u$key ($stats{$key})"; if ($category_description{$key}{desc}) { print $moutf " -- " . $category_description{$key}{desc}; } # Someone forgot to add a category to the description file # or there is a typo in the category field. else { warn "No description found for category: ``$key''!\n"; warn "Please fix me or send an E-Mail to doc\@FreeBSD.org\a\n"; sleep(3); } print $moutf "
  • \n"; # Create the category file $outf->open(">$key.sgml"); header($outf, "FreeBSD Ports: \u$key"); if ($category_description{$key}{desc}) { print $outf "

    ", $category_description{$key}{desc}, "

    \n"; } print $outf "
    \n"; my $d = join("\n", sort(split(/\n/, $data{$key}))); $d =~ s/##([^#]*)##/$catkey{$1}/g; print $outf $d; print $outf "
    \n"; footer($outf, "

    Port Categories" . " -- Index"); $outf->close; } print $moutf "
\n"; } } footer($moutf, ""); $moutf->close; # Create the master index file $mindex->open(">master-index.sgml"); header($mindex, "FreeBSD Ports Collection Index"); print $mindex "

\n"; print $mindex sort @master; print $mindex "

"; footer($mindex, "Port Categories"); $mindex->close; close(INDEX); }