perltidy
This commit is contained in:
parent
20c3606135
commit
37edf79a84
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=30574
1 changed files with 296 additions and 265 deletions
561
en/cgi/ports.cgi
561
en/cgi/ports.cgi
|
|
@ -24,7 +24,7 @@
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
# SUCH DAMAGE.
|
# SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
# $FreeBSD: www/en/cgi/ports.cgi,v 1.94 2006/08/19 21:40:25 simon Exp $
|
# $FreeBSD: www/en/cgi/ports.cgi,v 1.95 2007/08/02 18:28:26 wosch Exp $
|
||||||
#
|
#
|
||||||
# ports.cgi - search engine for FreeBSD ports
|
# ports.cgi - search engine for FreeBSD ports
|
||||||
# o search for a port by name or description
|
# o search for a port by name or description
|
||||||
|
|
@ -39,88 +39,88 @@ h3 { font-size: 1.2em; border-bottom: thin solid black; }
|
||||||
`;
|
`;
|
||||||
|
|
||||||
sub init_variables {
|
sub init_variables {
|
||||||
$localPrefix = '/usr/ports'; # ports prefix
|
$localPrefix = '/usr/ports'; # ports prefix
|
||||||
|
|
||||||
# Directory of the up-to-date INDEX*
|
# Directory of the up-to-date INDEX*
|
||||||
$portsDatabaseHeadDir = "/usr/local/www/ports";
|
$portsDatabaseHeadDir = "/usr/local/www/ports";
|
||||||
|
|
||||||
# Ports database file to use
|
# Ports database file to use
|
||||||
if (-f "$portsDatabaseHeadDir/INDEX-6") {
|
if ( -f "$portsDatabaseHeadDir/INDEX-6" ) {
|
||||||
$ports_database = 'INDEX-6';
|
$ports_database = 'INDEX-6';
|
||||||
} elsif (-f "$portsDatabaseHeadDir/INDEX-5") {
|
}
|
||||||
$ports_database = 'INDEX-5';
|
elsif ( -f "$portsDatabaseHeadDir/INDEX-5" ) {
|
||||||
} else {
|
$ports_database = 'INDEX-5';
|
||||||
$ports_database = 'INDEX';
|
}
|
||||||
|
else {
|
||||||
|
$ports_database = 'INDEX';
|
||||||
}
|
}
|
||||||
|
|
||||||
# URL of ports tree for browsing
|
# URL of ports tree for browsing
|
||||||
$remotePrefixFtp = 'ports';
|
$remotePrefixFtp = 'ports';
|
||||||
# 'ftp://ftp.FreeBSD.org/pub/FreeBSD/branches/-current/ports';
|
|
||||||
|
# 'ftp://ftp.FreeBSD.org/pub/FreeBSD/branches/-current/ports';
|
||||||
|
|
||||||
# URL of ports tree for download
|
# URL of ports tree for download
|
||||||
$remotePrefixFtpDownload =
|
$remotePrefixFtpDownload = 'http://cvsweb.FreeBSD.org/ports';
|
||||||
'http://cvsweb.FreeBSD.org/ports';
|
|
||||||
$remoteSuffixFtpDownload = '%s.tar.gz?tarball=1';
|
$remoteSuffixFtpDownload = '%s.tar.gz?tarball=1';
|
||||||
|
|
||||||
# where to get -current packages
|
# where to get -current packages
|
||||||
local($p) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386';
|
local ($p) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386';
|
||||||
local($palpha) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/alpha';
|
local ($palpha) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/alpha';
|
||||||
local($pamd64) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/amd64';
|
local ($pamd64) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/amd64';
|
||||||
local($pia64) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/ia64';
|
local ($pia64) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/ia64';
|
||||||
local($psparc64) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/sparc64';
|
local ($psparc64) = 'ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/sparc64';
|
||||||
|
|
||||||
$remotePrefixFtpPackagesDefault = '6-STABLE/i386';
|
$remotePrefixFtpPackagesDefault = '6-STABLE/i386';
|
||||||
|
|
||||||
# This is currently unused
|
# This is currently unused
|
||||||
%remotePrefixFtpPackages =
|
%remotePrefixFtpPackages = (
|
||||||
(
|
'7-CURRENT/i386', "$p/packages-7-current/All",
|
||||||
'7-CURRENT/i386', "$p/packages-7-current/All",
|
'6-STABLE/i386', " $p/packages-6-stable/All",
|
||||||
'6-STABLE/i386', " $p/packages-6-stable/All",
|
'5-STABLE/i386', " $p/packages-5-stable/All",
|
||||||
'5-STABLE/i386', " $p/packages-5-stable/All",
|
'4-STABLE/i386', " $p/packages-4-stable/All",
|
||||||
'4-STABLE/i386', " $p/packages-4-stable/All",
|
|
||||||
|
|
||||||
'6.0-RELEASE/i386', "$p/packages-6.0-release/All",
|
'6.0-RELEASE/i386', "$p/packages-6.0-release/All",
|
||||||
'5.4-RELEASE/i386', "$p/packages-5.4-release/All",
|
'5.4-RELEASE/i386', "$p/packages-5.4-release/All",
|
||||||
'4.11-RELEASE/i386',"$p/packages-4.11-release/All",
|
'4.11-RELEASE/i386', "$p/packages-4.11-release/All",
|
||||||
|
|
||||||
'4-STABLE/alpha', "$palpha/packages-4-stable/All",
|
'4-STABLE/alpha', "$palpha/packages-4-stable/All",
|
||||||
|
|
||||||
'5.4-RELEASE/alpha', "$palpha/packages-5.4-release/All",
|
'5.4-RELEASE/alpha', "$palpha/packages-5.4-release/All",
|
||||||
'4.11-RELEASE/alpha',"$palpha/packages-4.11-release/All",
|
'4.11-RELEASE/alpha', "$palpha/packages-4.11-release/All",
|
||||||
|
|
||||||
'7-CURRENT/amd64', "$pamd64/packages-7-current/All",
|
'7-CURRENT/amd64', "$pamd64/packages-7-current/All",
|
||||||
'6-STABLE/amd64', "$pamd64/packages-6-stable/All",
|
'6-STABLE/amd64', "$pamd64/packages-6-stable/All",
|
||||||
'5-STABLE/amd64', "$pamd64/packages-5-stable/All",
|
'5-STABLE/amd64', "$pamd64/packages-5-stable/All",
|
||||||
|
|
||||||
'6.0-RELEASE/amd64', "$pamd64/packages-6.0-release/All",
|
'6.0-RELEASE/amd64', "$pamd64/packages-6.0-release/All",
|
||||||
'5.4-RELEASE/amd64', "$pamd64/packages-5.4-release/All",
|
'5.4-RELEASE/amd64', "$pamd64/packages-5.4-release/All",
|
||||||
|
|
||||||
'7-CURRENT/ia64', "$pia64/packages-7-current/All",
|
'7-CURRENT/ia64', "$pia64/packages-7-current/All",
|
||||||
'6-STABLE/ia64', "$pia64/packages-6-stable/All",
|
'6-STABLE/ia64', "$pia64/packages-6-stable/All",
|
||||||
|
|
||||||
'6.0-RELEASE/ia64', "$pia64/packages-6.0-release/All",
|
'6.0-RELEASE/ia64', "$pia64/packages-6.0-release/All",
|
||||||
'5.4-RELEASE/ia64', "$pia64/packages-5.4-release/All",
|
'5.4-RELEASE/ia64', "$pia64/packages-5.4-release/All",
|
||||||
|
|
||||||
'7-CURRENT/sparc64', "$psparc64/packages-7-current/All",
|
'7-CURRENT/sparc64', "$psparc64/packages-7-current/All",
|
||||||
'6-STABLE/sparc64', "$psparc64/packages-6-stable/All",
|
'6-STABLE/sparc64', "$psparc64/packages-6-stable/All",
|
||||||
'5-STABLE/sparc64', "$psparc64/packages-5-stable/All",
|
'5-STABLE/sparc64', "$psparc64/packages-5-stable/All",
|
||||||
|
|
||||||
'6.0-RELEASE/sparc64', "$psparc64/packages-6.0-release/All",
|
'6.0-RELEASE/sparc64', "$psparc64/packages-6.0-release/All",
|
||||||
'5.4-RELEASE/sparc64', "$psparc64/packages-5.4-release/All",
|
'5.4-RELEASE/sparc64', "$psparc64/packages-5.4-release/All",
|
||||||
);
|
);
|
||||||
|
|
||||||
$remotePrefixHtml =
|
$remotePrefixHtml = "$hsty_base/ports";
|
||||||
"$hsty_base/ports";
|
|
||||||
|
|
||||||
# CVS Web interface
|
# CVS Web interface
|
||||||
$remotePrefixCvs =
|
$remotePrefixCvs = 'http://cvsweb.FreeBSD.org/ports';
|
||||||
'http://cvsweb.FreeBSD.org/ports';
|
|
||||||
|
|
||||||
# Ports documentation
|
# Ports documentation
|
||||||
$portsDesc = "$hsty_base/ports/";
|
$portsDesc = "$hsty_base/ports/";
|
||||||
|
|
||||||
# location of the tiny BSD daemon
|
# location of the tiny BSD daemon
|
||||||
$daemonGif = "<img src='$hsty_base/gifs/littlelogo.gif' alt='Really small BSD Daemon'>";
|
$daemonGif =
|
||||||
|
"<img src='$hsty_base/gifs/littlelogo.gif' alt='Really small BSD Daemon'>";
|
||||||
|
|
||||||
# visible E-Mail address, plain text
|
# visible E-Mail address, plain text
|
||||||
$mailto = 'www@FreeBSD.org';
|
$mailto = 'www@FreeBSD.org';
|
||||||
|
|
@ -146,22 +146,21 @@ sub init_variables {
|
||||||
# extension type for packages
|
# extension type for packages
|
||||||
$packageExt = 'tbz';
|
$packageExt = 'tbz';
|
||||||
|
|
||||||
local($packageDB) = '../ports/packages.exists';
|
local ($packageDB) = '../ports/packages.exists';
|
||||||
&packages_exist($packageDB, *packages) if -f $packageDB;
|
&packages_exist( $packageDB, *packages ) if -f $packageDB;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub packages_exist {
|
sub packages_exist {
|
||||||
local($file, *p) = @_;
|
local ( $file, *p ) = @_;
|
||||||
|
|
||||||
open(P, $file) || do {
|
open( P, $file ) || do {
|
||||||
warn "open $file: $!\n";
|
warn "open $file: $!\n";
|
||||||
warn "Cannot create packages links\n";
|
warn "Cannot create packages links\n";
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
while(<p>) {
|
while (<p>) {
|
||||||
chop;
|
chop;
|
||||||
$p{$_} = 1;
|
$p{$_} = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -169,17 +168,17 @@ sub packages_exist {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# return the date of the last ports database update
|
# return the date of the last ports database update
|
||||||
sub last_update {
|
sub last_update {
|
||||||
local($file) = "$portsDatabaseHeadDir/$ports_database";
|
local ($file) = "$portsDatabaseHeadDir/$ports_database";
|
||||||
local($modtime, $modtimestr);
|
local ( $modtime, $modtimestr );
|
||||||
|
|
||||||
$modtime = (stat($file))[9];
|
$modtime = ( stat($file) )[9];
|
||||||
if (defined($modtime) && $modtime > 0) {
|
if ( defined($modtime) && $modtime > 0 ) {
|
||||||
$modtimestr = strftime("%G-%m-%d %H:%M:%S UTC", gmtime($modtime));
|
$modtimestr = strftime( "%G-%m-%d %H:%M:%S UTC", gmtime($modtime) );
|
||||||
} else {
|
}
|
||||||
$modtimestr = "Unknown";
|
else {
|
||||||
|
$modtimestr = "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $modtimestr;
|
return $modtimestr;
|
||||||
|
|
@ -190,75 +189,75 @@ sub last_update_message {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub dec {
|
sub dec {
|
||||||
local($_) = @_;
|
local ($_) = @_;
|
||||||
|
|
||||||
s/\+/ /g; # '+' -> space
|
s/\+/ /g; # '+' -> space
|
||||||
s/%(..)/pack("c",hex($1))/ge; # '%ab' -> char ab
|
s/%(..)/pack("c",hex($1))/ge; # '%ab' -> char ab
|
||||||
|
|
||||||
return($_);
|
return ($_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# $indent is a bit of optional data processing I put in for
|
# $indent is a bit of optional data processing I put in for
|
||||||
# formatting the data nicely when you are emailing it.
|
# formatting the data nicely when you are emailing it.
|
||||||
# This is derived from code by Denis Howe <dbh@doc.ic.ac.uk>
|
# This is derived from code by Denis Howe <dbh@doc.ic.ac.uk>
|
||||||
# and Thomas A Fine <fine@cis.ohio-state.edu>
|
# and Thomas A Fine <fine@cis.ohio-state.edu>
|
||||||
sub decode_form {
|
sub decode_form {
|
||||||
local($form, *data, $indent, $key, $_) = @_;
|
local ( $form, *data, $indent, $key, $_ ) = @_;
|
||||||
foreach $_ (split(/&/, $form)) {
|
foreach $_ ( split( /&/, $form ) ) {
|
||||||
($key, $_) = split(/=/, $_, 2);
|
( $key, $_ ) = split( /=/, $_, 2 );
|
||||||
$_ =~ s/\+/ /g; # + -> space
|
$_ =~ s/\+/ /g; # + -> space
|
||||||
$key =~ s/\+/ /g; # + -> space
|
$key =~ s/\+/ /g; # + -> space
|
||||||
$_ =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig; # undo % escapes
|
$_ =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig; # undo % escapes
|
||||||
$key =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig; # undo % escapes
|
$key =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig; # undo % escapes
|
||||||
$_ =~ s/[\r\n]+/\n\t/g if defined($indent); # indent data after \n
|
$_ =~ s/[\r\n]+/\n\t/g if defined($indent); # indent data after \n
|
||||||
$data{$key} = $_;
|
$data{$key} = $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub escapeHTML {
|
sub escapeHTML {
|
||||||
my $toencode = shift;
|
my $toencode = shift;
|
||||||
return "" unless defined($toencode);
|
return "" unless defined($toencode);
|
||||||
|
|
||||||
$toencode =~ s{&}{&}gso;
|
$toencode =~ s{&}{&}gso;
|
||||||
$toencode =~ s{<}{<}gso;
|
$toencode =~ s{<}{<}gso;
|
||||||
$toencode =~ s{>}{>}gso;
|
$toencode =~ s{>}{>}gso;
|
||||||
$toencode =~ s{"}{"}gso;
|
$toencode =~ s{"}{"}gso;
|
||||||
return $toencode;
|
return $toencode;
|
||||||
}
|
}
|
||||||
|
|
||||||
# encode unknown data for use in a URL <a href="...">
|
# encode unknown data for use in a URL <a href="...">
|
||||||
sub encode_url {
|
sub encode_url {
|
||||||
local($_) = @_;
|
local ($_) = @_;
|
||||||
s/([\000-\032\;\/\?\:\@\&\=\%\'\"\`\<\>\177-\377 ])/sprintf('%%%02x',ord($1))/eg;
|
s/([\000-\032\;\/\?\:\@\&\=\%\'\"\`\<\>\177-\377 ])/sprintf('%%%02x',ord($1))/eg;
|
||||||
|
|
||||||
# s/%20/+/g;
|
# s/%20/+/g;
|
||||||
$_;
|
$_;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub warn { print "$_[0]" }
|
sub warn { print "$_[0]" }
|
||||||
sub env { defined($ENV{$_[0]}) ? $ENV{$_[0]} : undef; }
|
sub env { defined( $ENV{ $_[0] } ) ? $ENV{ $_[0] } : undef; }
|
||||||
sub exit { exit 0 };
|
sub exit { exit 0 }
|
||||||
|
|
||||||
sub readindex {
|
sub readindex {
|
||||||
local(*var, *msec) = @_;
|
local ( *var, *msec ) = @_;
|
||||||
local($localportsdb) = "$portsDatabaseHeadDir/$ports_database";
|
local ($localportsdb) = "$portsDatabaseHeadDir/$ports_database";
|
||||||
local(@tmp, @s);
|
local ( @tmp, @s );
|
||||||
|
|
||||||
open(C, $localportsdb) || do {
|
open( C, $localportsdb ) || do {
|
||||||
warn "Cannot open ports database $localportsdb: $!\n"; &exit;
|
warn "Cannot open ports database $localportsdb: $!\n";
|
||||||
|
&exit;
|
||||||
};
|
};
|
||||||
|
|
||||||
while(<C>) {
|
while (<C>) {
|
||||||
next if $query && !/$query/oi;
|
next if $query && !/$query/oi;
|
||||||
chop;
|
chop;
|
||||||
|
|
||||||
@tmp = split(/\|/);
|
@tmp = split(/\|/);
|
||||||
$var{"$tmp[4]"} = $_;
|
$var{"$tmp[4]"} = $_;
|
||||||
@s = split(/\s+/, $tmp[6]);
|
@s = split( /\s+/, $tmp[6] );
|
||||||
foreach (@s) {
|
foreach (@s) {
|
||||||
$msec{"$tmp[4],$_"} = 1;
|
$msec{"$tmp[4],$_"} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close C;
|
close C;
|
||||||
}
|
}
|
||||||
|
|
@ -266,48 +265,50 @@ sub readindex {
|
||||||
# extract sub collections
|
# extract sub collections
|
||||||
sub readcoll {
|
sub readcoll {
|
||||||
|
|
||||||
local(@a, @b, %key);
|
local ( @a, @b, %key );
|
||||||
local($file) = '../ports/categories';
|
local ($file) = '../ports/categories';
|
||||||
local($localportsdb) = "$portsDatabaseHeadDir/$ports_database";
|
local ($localportsdb) = "$portsDatabaseHeadDir/$ports_database";
|
||||||
|
|
||||||
if (-r $file && open(C, $file)) {
|
if ( -r $file && open( C, $file ) ) {
|
||||||
while(<C>) {
|
while (<C>) {
|
||||||
chop;
|
chop;
|
||||||
|
|
||||||
if (/^\s*([^,]+),\s*"([^"]+)",\s*([A-Z]+)/) {
|
if (/^\s*([^,]+),\s*"([^"]+)",\s*([A-Z]+)/) {
|
||||||
@b = split(/\s+/, $1);
|
@b = split( /\s+/, $1 );
|
||||||
foreach (@b) {
|
foreach (@b) {
|
||||||
if (!defined($key{$_})) {
|
if ( !defined( $key{$_} ) ) {
|
||||||
$key{$_} = 1;
|
$key{$_} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (-r $localportsdb) {
|
else {
|
||||||
open(C, $localportsdb) || do {
|
if ( -r $localportsdb ) {
|
||||||
warn "Cannot open ports database $localportsdb: $!\n"; &exit;
|
open( C, $localportsdb ) || do {
|
||||||
}
|
warn "Cannot open ports database $localportsdb: $!\n";
|
||||||
}
|
&exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while(<C>) {
|
while (<C>) {
|
||||||
chop;
|
chop;
|
||||||
|
|
||||||
@a = split('\|');
|
@a = split('\|');
|
||||||
@b = split(/\s+/, $a[6]);
|
@b = split( /\s+/, $a[6] );
|
||||||
|
|
||||||
foreach (@b) {
|
foreach (@b) {
|
||||||
if (!defined($key{$_})) {
|
if ( !defined( $key{$_} ) ) {
|
||||||
$key{$_} = 1;
|
$key{$_} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close C;
|
close C;
|
||||||
|
|
||||||
@a = ();
|
@a = ();
|
||||||
foreach (sort keys %key) {
|
foreach ( sort keys %key ) {
|
||||||
push(@a, $_);
|
push( @a, $_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
return @a;
|
return @a;
|
||||||
|
|
@ -315,86 +316,96 @@ sub readcoll {
|
||||||
|
|
||||||
# basic function for HTML output
|
# basic function for HTML output
|
||||||
sub out {
|
sub out {
|
||||||
local($line) = @_;
|
local ($line) = @_;
|
||||||
local($version, $path, $local, $comment, $descfile, $email,
|
local (
|
||||||
$sections, $bdepends, $rdepends, @rest) = split(/\|/, $line);
|
$version, $path, $local, $comment, $descfile,
|
||||||
|
$email, $sections, $bdepends, $rdepends, @rest
|
||||||
|
) = split( /\|/, $line );
|
||||||
|
|
||||||
if ($path =~ m%^$localPrefix/([^/]+)%o) {
|
if ( $path =~ m%^$localPrefix/([^/]+)%o ) {
|
||||||
if (!$out_sec || $1 ne $out_sec) {
|
if ( !$out_sec || $1 ne $out_sec ) {
|
||||||
print "</dl>\n" if $counter > 0;
|
print "</dl>\n" if $counter > 0;
|
||||||
print qq{\n<h3>} .
|
print qq{\n<h3>}
|
||||||
qq{<a href="$remotePrefixHtml/$1.html">Category $1</a>} .
|
. qq{<a href="$remotePrefixHtml/$1.html">Category $1</a>}
|
||||||
"</h3>\n<dl>\n";
|
. "</h3>\n<dl>\n";
|
||||||
$out_sec = $1;
|
$out_sec = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$counter++;
|
$counter++;
|
||||||
$pathDownload = $path;
|
$pathDownload = $path;
|
||||||
$pathB= $path;
|
$pathB = $path;
|
||||||
$pathB =~ s/^$localPrefix/ports/o;
|
$pathB =~ s/^$localPrefix/ports/o;
|
||||||
|
|
||||||
$path =~ s/^$localPrefix/$remotePrefixFtp/o;
|
$path =~ s/^$localPrefix/$remotePrefixFtp/o;
|
||||||
$pathDownload =~ s/^$localPrefix/$remotePrefixFtpDownload/o;
|
$pathDownload =~ s/^$localPrefix/$remotePrefixFtpDownload/o;
|
||||||
if ($remoteSuffixFtpDownload) {
|
if ($remoteSuffixFtpDownload) {
|
||||||
if (substr($remoteSuffixFtpDownload, 0, 2) eq '%s') {
|
if ( substr( $remoteSuffixFtpDownload, 0, 2 ) eq '%s' ) {
|
||||||
$pathDownload =~ m,([^/]+)$,;
|
$pathDownload =~ m,([^/]+)$,;
|
||||||
$pathDownload .= "/$1" . substr($remoteSuffixFtpDownload, 2);
|
$pathDownload .= "/$1" . substr( $remoteSuffixFtpDownload, 2 );
|
||||||
} else {
|
}
|
||||||
$pathDownload .= $remoteSuffixFtpDownload;
|
else {
|
||||||
}
|
$pathDownload .= $remoteSuffixFtpDownload;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$descfile =~ s/^$localPrefix/$remotePrefixFtp/o;
|
$descfile =~ s/^$localPrefix/$remotePrefixFtp/o;
|
||||||
$version = &encode_url($version);
|
$version = &encode_url($version);
|
||||||
|
|
||||||
#$version =~ s/[\+,]/X/g;
|
#$version =~ s/[\+,]/X/g;
|
||||||
|
|
||||||
local($l) = $path;
|
local ($l) = $path;
|
||||||
$l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o;
|
$l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o;
|
||||||
|
|
||||||
print qq{<dt><b><a name="$version"></a><a href="$l">$version</a></b></dt>\n};
|
print
|
||||||
|
qq{<dt><b><a name="$version"></a><a href="$l">$version</a></b></dt>\n};
|
||||||
print qq{<dd>}, &escapeHTML($comment), qq{<br />\n};
|
print qq{<dd>}, &escapeHTML($comment), qq{<br />\n};
|
||||||
|
|
||||||
print qq[<a href="$url?$descfile">Long description</a> <b>:</b>\n];
|
print qq[<a href="$url?$descfile">Long description</a> <b>:</b>\n];
|
||||||
print qq[<a href="$pds?$pathB">Sources</a> <b>:</b>\n];
|
print qq[<a href="$pds?$pathB">Sources</a> <b>:</b>\n];
|
||||||
|
|
||||||
# Link package in "default" arch/release. Verify it's existence on ftp-master.
|
# Link package in "default" arch/release. Verify it's existence on ftp-master.
|
||||||
if ($packages{"$version.$packageExt"}) {
|
if ( $packages{"$version.$packageExt"} ) {
|
||||||
print qq[<a href="$remotePrefixFtpPackages{$remotePrefixFtpPackagesDefault}/$version.$packageExt">Package</a> <b>:</b>\n];
|
print
|
||||||
|
qq[<a href="$remotePrefixFtpPackages{$remotePrefixFtpPackagesDefault}/$version.$packageExt">Package</a> <b>:</b>\n];
|
||||||
}
|
}
|
||||||
|
|
||||||
print qq[<a href="$l">Changes</a> <b>:</b>\n];
|
print qq[<a href="$l">Changes</a> <b>:</b>\n];
|
||||||
print qq[<a href="$pathDownload">Download</a><br />\n];
|
print qq[<a href="$pathDownload">Download</a><br />\n];
|
||||||
|
|
||||||
print qq{<i>Maintained by:</i> <a href="mailto:$email} .
|
print qq{<i>Maintained by:</i> <a href="mailto:$email}
|
||||||
($mailtoAdvanced ?
|
. (
|
||||||
qq{?cc=$mailtoList&subject=FreeBSD%20Port:%20} .
|
$mailtoAdvanced
|
||||||
&encode_url($version) : '') . qq{">$email</a><br />\n};
|
? qq{?cc=$mailtoList&subject=FreeBSD%20Port:%20}
|
||||||
|
. &encode_url($version)
|
||||||
|
: ''
|
||||||
|
) . qq{">$email</a><br />\n};
|
||||||
|
|
||||||
local(@s) = split(/\s+/, $sections);
|
local (@s) = split( /\s+/, $sections );
|
||||||
if ($#s > 0) {
|
if ( $#s > 0 ) {
|
||||||
print qq{<i>Also listed in:</i> };
|
print qq{<i>Also listed in:</i> };
|
||||||
foreach (@s) {
|
foreach (@s) {
|
||||||
print qq{<a href="$remotePrefixHtml/$_.html">$_</a> }
|
print qq{<a href="$remotePrefixHtml/$_.html">$_</a> }
|
||||||
if $_ ne $out_sec;
|
if $_ ne $out_sec;
|
||||||
}
|
}
|
||||||
print "<br />\n";
|
print "<br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bdepends || $rdepends) {
|
if ( $bdepends || $rdepends ) {
|
||||||
local($flag) = 0;
|
local ($flag) = 0;
|
||||||
local($last) = '';
|
local ($last) = '';
|
||||||
print qq{<i>Requires:</i> };
|
print qq{<i>Requires:</i> };
|
||||||
foreach (sort split(/\s+/, "$bdepends $rdepends")) {
|
foreach ( sort split( /\s+/, "$bdepends $rdepends" ) ) {
|
||||||
# delete double entries
|
|
||||||
next if $_ eq $last;
|
|
||||||
$last = $_;
|
|
||||||
|
|
||||||
print ", " if $flag;
|
# delete double entries
|
||||||
$flag++;
|
next if $_ eq $last;
|
||||||
print qq{<a href="$script_name?query=^$_&stype=name">$_</a>};
|
$last = $_;
|
||||||
}
|
|
||||||
print "<br />\n";
|
print ", " if $flag;
|
||||||
}
|
$flag++;
|
||||||
|
print qq{<a href="$script_name?query=^$_&stype=name">$_</a>};
|
||||||
|
}
|
||||||
|
print "<br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
print qq[</dd>];
|
print qq[</dd>];
|
||||||
|
|
||||||
|
|
@ -402,43 +413,48 @@ sub out {
|
||||||
print qq[<dd> </dd>];
|
print qq[<dd> </dd>];
|
||||||
print qq[\n\n];
|
print qq[\n\n];
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
# search and output
|
# search and output
|
||||||
sub search_ports {
|
sub search_ports {
|
||||||
local(@a) = ();
|
local (@a) = ();
|
||||||
local($key, $name, $text);
|
local ( $key, $name, $text );
|
||||||
|
|
||||||
foreach $key (sort keys %today) {
|
foreach $key ( sort keys %today ) {
|
||||||
next if $today{$key} !~ /$query/oi;
|
next if $today{$key} !~ /$query/oi;
|
||||||
|
|
||||||
@a = split(/\|/, $today{$key});
|
@a = split( /\|/, $today{$key} );
|
||||||
$name = $a[0]; #$name =~ s/(\W)/\\$1/g;
|
$name = $a[0]; #$name =~ s/(\W)/\\$1/g;
|
||||||
$text = $a[3]; #$text =~ s/(\W)/\\$1/g;
|
$text = $a[3]; #$text =~ s/(\W)/\\$1/g;
|
||||||
|
|
||||||
if ($section ne "all") {
|
if ( $section ne "all" ) {
|
||||||
next if $a[6] !~ /^$section(\s|$)/;
|
next if $a[6] !~ /^$section(\s|$)/;
|
||||||
}
|
}
|
||||||
|
|
||||||
#warn "$stype:$query: $name $text\n";
|
#warn "$stype:$query: $name $text\n";
|
||||||
if ($stype eq "name" && $name =~ /$query/o) {
|
if ( $stype eq "name" && $name =~ /$query/o ) {
|
||||||
&out($today{$key});
|
&out( $today{$key} );
|
||||||
} elsif ($stype eq "text" && $text =~ /$query/oi) {
|
}
|
||||||
&out($today{$key});
|
elsif ( $stype eq "text" && $text =~ /$query/oi ) {
|
||||||
} elsif ($stype eq "all" &&
|
&out( $today{$key} );
|
||||||
($text =~ /$query/oi || $name =~ /$query/io)) {
|
}
|
||||||
&out($today{$key});
|
elsif ( $stype eq "all"
|
||||||
} elsif ($stype eq 'maintainer' && $a[5] =~ /$query/io) {
|
&& ( $text =~ /$query/oi || $name =~ /$query/io ) )
|
||||||
&out($today{$key});
|
{
|
||||||
} elsif ($stype eq 'requires' &&
|
&out( $today{$key} );
|
||||||
($a[7] =~ /$query/io || $a[8] =~ /$query/io)) {
|
}
|
||||||
&out($today{$key});
|
elsif ( $stype eq 'maintainer' && $a[5] =~ /$query/io ) {
|
||||||
}
|
&out( $today{$key} );
|
||||||
|
}
|
||||||
|
elsif ( $stype eq 'requires'
|
||||||
|
&& ( $a[7] =~ /$query/io || $a[8] =~ /$query/io ) )
|
||||||
|
{
|
||||||
|
&out( $today{$key} );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub forms {
|
sub forms {
|
||||||
print qq{<p>
|
print qq{<p>
|
||||||
FreeBSD Ports [short description <a href="$portsDesc">followed</a> ...]
|
FreeBSD Ports [short description <a href="$portsDesc">followed</a> ...]
|
||||||
|
|
@ -459,18 +475,19 @@ Search for:
|
||||||
<select name="stype">
|
<select name="stype">
|
||||||
};
|
};
|
||||||
|
|
||||||
local(%d);
|
local (%d);
|
||||||
%d = ('name', 'Package Name',
|
%d = (
|
||||||
'all', 'All',
|
'name', 'Package Name', 'all', 'All',
|
||||||
'maintainer', 'Maintainer',
|
'maintainer', 'Maintainer', 'text', 'Description',
|
||||||
'text', 'Description',
|
'pkgdescr', 'Long Description', 'requires', 'Requires',
|
||||||
'pkgdescr', 'Long Description',
|
);
|
||||||
'requires', 'Requires',
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ('all', 'name', 'text', 'pkgdescr', 'maintainer', 'requires') {
|
foreach ( 'all', 'name', 'text', 'pkgdescr', 'maintainer', 'requires' ) {
|
||||||
print "<option" . (($_ eq $stype) ? ' selected="selected" ' : ' ') .
|
print "<option"
|
||||||
qq{value="$_">} . ($d{$_} ? $d{$_} : $_) . qq{</option>\n};
|
. ( ( $_ eq $stype ) ? ' selected="selected" ' : ' ' )
|
||||||
|
. qq{value="$_">}
|
||||||
|
. ( $d{$_} ? $d{$_} : $_ )
|
||||||
|
. qq{</option>\n};
|
||||||
}
|
}
|
||||||
|
|
||||||
print qq{</select>
|
print qq{</select>
|
||||||
|
|
@ -480,9 +497,9 @@ Search for:
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (@sec) {
|
foreach (@sec) {
|
||||||
print "<option" .
|
print "<option"
|
||||||
(($_ eq $section) ? ' selected="selected" ' : ' ') .
|
. ( ( $_ eq $section ) ? ' selected="selected" ' : ' ' )
|
||||||
qq{value="$_">$_</option>\n};
|
. qq{value="$_">$_</option>\n};
|
||||||
}
|
}
|
||||||
|
|
||||||
print q{</select>
|
print q{</select>
|
||||||
|
|
@ -499,30 +516,38 @@ sub footer {
|
||||||
<img align="right" src="$hsty_base/gifs/powerlogo.gif" alt="Powered by FreeBSD" />
|
<img align="right" src="$hsty_base/gifs/powerlogo.gif" alt="Powered by FreeBSD" />
|
||||||
© 1996-2007 by Wolfram Schneider. All rights reserved.<br />
|
© 1996-2007 by Wolfram Schneider. All rights reserved.<br />
|
||||||
};
|
};
|
||||||
#print q{$FreeBSD: www/en/cgi/ports.cgi,v 1.94 2006/08/19 21:40:25 simon Exp $} . "<br />\n";
|
|
||||||
|
#print q{$FreeBSD: www/en/cgi/ports.cgi,v 1.95 2007/08/02 18:28:26 wosch Exp $} . "<br />\n";
|
||||||
print qq{Please direct questions about this service to
|
print qq{Please direct questions about this service to
|
||||||
<i><a href="$mailtoURL">$mailto</a></i><br />\n};
|
<i><a href="$mailtoURL">$mailto</a></i><br />\n};
|
||||||
print qq{General questions about FreeBSD ports should be sent to } .
|
print qq{General questions about FreeBSD ports should be sent to }
|
||||||
qq{<a href="mailto:$mailtoList">} .
|
. qq{<a href="mailto:$mailtoList">}
|
||||||
qq{<i>$mailtoList</i></a><br />\n};
|
. qq{<i>$mailtoList</i></a><br />\n};
|
||||||
print &last_update_message;
|
print &last_update_message;
|
||||||
print qq{<hr noshade="noshade" />\n<p />\n};
|
print qq{<hr noshade="noshade" />\n<p />\n};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub check_input {
|
sub check_input {
|
||||||
if ($query) {
|
if ($query) {
|
||||||
$stype = "all" if !$stype;
|
$stype = "all" if !$stype;
|
||||||
if (!($stype eq "name" ||
|
if (
|
||||||
$stype eq "text" ||
|
!(
|
||||||
$stype eq "maintainer" ||
|
$stype eq "name"
|
||||||
$stype eq "requires" ||
|
|| $stype eq "text"
|
||||||
$stype eq "all")) {
|
|| $stype eq "maintainer"
|
||||||
&warn("unknown search type ``$type'', use `all', `text', `name', 'requires', or `maintainer'\n");
|
|| $stype eq "requires"
|
||||||
&exit(0);
|
|| $stype eq "all"
|
||||||
} else {
|
)
|
||||||
return;
|
)
|
||||||
}
|
{
|
||||||
|
&warn(
|
||||||
|
"unknown search type ``$type'', use `all', `text', `name', 'requires', or `maintainer'\n"
|
||||||
|
);
|
||||||
|
&exit(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -565,44 +590,47 @@ You may also search the
|
||||||
|
|
||||||
&init_variables;
|
&init_variables;
|
||||||
$query_string = &env('QUERY_STRING');
|
$query_string = &env('QUERY_STRING');
|
||||||
$path_info = &env('PATH_INFO');
|
$path_info = &env('PATH_INFO');
|
||||||
&decode_form($query_string, *form);
|
&decode_form( $query_string, *form );
|
||||||
|
|
||||||
$section = $form{'sektion'};
|
$section = $form{'sektion'};
|
||||||
$section = 'all' if (!$section);
|
$section = 'all' if ( !$section );
|
||||||
$query = $form{'query'};
|
$query = $form{'query'};
|
||||||
$stype = $form{'stype'};
|
$stype = $form{'stype'};
|
||||||
$script_name = &env('SCRIPT_NAME');
|
$script_name = &env('SCRIPT_NAME');
|
||||||
|
|
||||||
if ($path_info eq "/source") {
|
if ( $path_info eq "/source" ) {
|
||||||
|
|
||||||
# XXX
|
# XXX
|
||||||
print "Content-type: text/plain\n\n";
|
print "Content-type: text/plain\n\n";
|
||||||
open(R, $0) || do { print "ick!\n"; &exit; };
|
open( R, $0 ) || do { print "ick!\n"; &exit; };
|
||||||
while(<R>) { print }
|
while (<R>) { print }
|
||||||
close R;
|
close R;
|
||||||
&exit;
|
&exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Full text search in ports/<category>/port>/pkg-descr
|
# Full text search in ports/<category>/port>/pkg-descr
|
||||||
if ($stype eq 'pkgdescr') {
|
if ( $stype eq 'pkgdescr' ) {
|
||||||
local($url) =
|
local ($url) =
|
||||||
'http://www.FreeBSD.org/cgi/search.cgi?source=pkgdescr&max=25';
|
'http://www.FreeBSD.org/cgi/search.cgi?source=pkgdescr&max=25';
|
||||||
$query =~ s/\s+/+/g;
|
$query =~ s/\s+/+/g;
|
||||||
print "Location: $url&words=$query\n\n";
|
print "Location: $url&words=$query\n\n";
|
||||||
&exit;
|
&exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stype eq "faq") {
|
if ( $stype eq "faq" ) {
|
||||||
print &short_html_header("FreeBSD Ports Search FAQ", 1);
|
print &short_html_header( "FreeBSD Ports Search FAQ", 1 );
|
||||||
&faq;
|
&faq;
|
||||||
&footer; print &html_footer; &exit(0);
|
&footer;
|
||||||
|
print &html_footer;
|
||||||
|
&exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
print &html_header("FreeBSD Ports Search", 1);
|
print &html_header( "FreeBSD Ports Search", 1 );
|
||||||
|
|
||||||
# allow `/ports.cgi?netscape' where 'netscape' is the query port to search
|
# allow `/ports.cgi?netscape' where 'netscape' is the query port to search
|
||||||
# this make links to this script shorter
|
# this make links to this script shorter
|
||||||
if (!$query && $query_string =~ /^([^=&]+)$/) {
|
if ( !$query && $query_string =~ /^([^=&]+)$/ ) {
|
||||||
$query = $1;
|
$query = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -613,8 +641,10 @@ if (!$query && $query_string =~ /^([^=&]+)$/) {
|
||||||
$query =~ s/^\s+//;
|
$query =~ s/^\s+//;
|
||||||
$query =~ s/\s+$//;
|
$query =~ s/\s+$//;
|
||||||
|
|
||||||
if ($query_string eq "" || !$query) {
|
if ( $query_string eq "" || !$query ) {
|
||||||
&footer; print &html_footer; &exit(0);
|
&footer;
|
||||||
|
print &html_footer;
|
||||||
|
&exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
&check_input;
|
&check_input;
|
||||||
|
|
@ -622,16 +652,17 @@ $counter = 0;
|
||||||
|
|
||||||
# search
|
# search
|
||||||
if ($query) {
|
if ($query) {
|
||||||
&readindex(*today, *msec);
|
&readindex( *today, *msec );
|
||||||
$query =~ s/([^\w\^])/\\$1/g;
|
$query =~ s/([^\w\^])/\\$1/g;
|
||||||
&search_ports;
|
&search_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$counter) {
|
if ( !$counter ) {
|
||||||
print "Sorry, nothing found.\n";
|
print "Sorry, nothing found.\n";
|
||||||
print qq{You may look for other } .
|
print qq{You may look for other }
|
||||||
qq{<a href="/search/search.html">FreeBSD Search Services</a>.\n};
|
. qq{<a href="/search/search.html">FreeBSD Search Services</a>.\n};
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
print "</dl>\n";
|
print "</dl>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue