ports.cgi - search engine for FreeBSD ports
o search for a port by name or description o search for new or updated ports pds.cgi - FreeBSD Ports download sources cgi script print a list of source files for a port
This commit is contained in:
parent
abc41e6b3d
commit
57bc7f5e4f
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=1965
4 changed files with 1332 additions and 0 deletions
53
data/cgi/pds.cgi
Executable file
53
data/cgi/pds.cgi
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 1997 Wolfram Schneider <wosch@FreeBSD.ORG>, Berlin.
|
||||
# All rights reserved.
|
||||
#
|
||||
# pds.cgi - FreeBSD Ports download sources cgi script
|
||||
# print a list of source files for a port
|
||||
#
|
||||
|
||||
file="$QUERY_STRING"
|
||||
file2="$file/Makefile"
|
||||
CVSROOT=/home/ncvs; export CVSROOT
|
||||
|
||||
# set DISTDIR to a dummy directory.
|
||||
DISTDIR=/tmp/___pds.cgi___; export DISTDIR
|
||||
|
||||
cat <<EOF
|
||||
Content-type: text/html
|
||||
|
||||
EOF
|
||||
|
||||
case "$file" in
|
||||
ports/*/*) ;;
|
||||
*) echo "usage: pds module"; exit;;
|
||||
esac
|
||||
|
||||
if [ -f "$CVSROOT/${file2},v" ]; then :
|
||||
else
|
||||
echo "$file2 does not exist"
|
||||
exit
|
||||
fi
|
||||
|
||||
# security check for ../foo/bar and foo/../../bar/
|
||||
case "$file2" in *..*) echo "$file2 does not exist"; exit;; esac
|
||||
|
||||
cat <<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>Sources for $file</title>
|
||||
</head>
|
||||
<body BGCOLOR="#ffffff" TEXT="#000000"
|
||||
vlink="c00000" link="#0000ff" alink="#eeee00">
|
||||
|
||||
<h1>Sources for $file</h1>
|
||||
|
||||
EOF
|
||||
cvs -Q co -p $file2 | make -I /home/fenner/mk -f - bill-fetch |
|
||||
perl -ne 'print qq{<a href="$1">$1</a><br>\n}
|
||||
if m%((http|ftp)://\S+)%'
|
||||
cat <<EOF
|
||||
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
613
data/cgi/ports.cgi
Executable file
613
data/cgi/ports.cgi
Executable file
|
@ -0,0 +1,613 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (c) 1996-1997 Wolfram Schneider <wosch@FreeBSD.ORG>, Berlin.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $Id: ports.cgi,v 1.1 1997-09-19 16:47:40 wosch Exp $
|
||||
#
|
||||
# ports.cgi - search engine for FreeBSD ports
|
||||
# o search for a port by name or description
|
||||
# o search for new or updated ports
|
||||
#
|
||||
#
|
||||
# If you want use this script on your own host this line must
|
||||
# work for you: $ cvs rdiff -D'last week' ports/INDEX
|
||||
|
||||
|
||||
sub init_variables {
|
||||
$cvsroot = '/home/ncvs'; # $CVSROOT
|
||||
$localPrefix = '/usr/ports'; # ports prefix
|
||||
$ports_database = 'ports/INDEX';
|
||||
# unset $ENV{'CVSROOT'};
|
||||
|
||||
@cvscmd = ('cvs', '-Q', '-d', $cvsroot);
|
||||
|
||||
# URL of ports tree for browsing
|
||||
$remotePrefixFtp =
|
||||
'http://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports';
|
||||
|
||||
# URL of ports tree for download
|
||||
$remotePrefixFtpDownload =
|
||||
# 'ftp://ftp.cs.tu-berlin.de/pub/FreeBSD/FreeBSD-current/ports';
|
||||
'ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports';
|
||||
|
||||
# where to get -current packages
|
||||
local($p) = 'ftp://ftp.freebsd.org/pub/FreeBSD';
|
||||
$remotePrefixFtpPackagesDefault = 'current';
|
||||
%remotePrefixFtpPackages =
|
||||
('current', "$p/packages-stable/All",
|
||||
'2.2.2', "$p/packages-2.2.2/All",
|
||||
'2.1.6', "$p/packages-2.1.6/All",
|
||||
'2.1.0', "$p/packages-2.1/All",
|
||||
);
|
||||
|
||||
%relDate =
|
||||
('current', 'today',
|
||||
'2.2.2', '5/16/97',
|
||||
'2.1.6', '11/16/96',
|
||||
'2.1.0', '11/19/95',
|
||||
);
|
||||
|
||||
#
|
||||
$remotePrefixHtml =
|
||||
'http://www.freebsd.org/ports';
|
||||
|
||||
# CVS Web interface
|
||||
$remotePrefixCvs =
|
||||
'http://www.freebsd.org/cgi/cvsweb.cgi/ports';
|
||||
|
||||
# Ports documentation
|
||||
$portsDesc = 'http://www.freebsd.org/ports/';
|
||||
|
||||
# location of the tiny BSD daemon
|
||||
$daemonGif = '<IMG SRC="/gifs/littlelogo.gif">';
|
||||
|
||||
# visible E-Mail address, plain text
|
||||
$mailto = 'wosch@FreeBSD.org';
|
||||
|
||||
# Mailinglist for FreeBSD Ports
|
||||
$mailtoList = 'ports@FreeBSD.org';
|
||||
|
||||
# use mailto:email?subject
|
||||
$mailtoAdvanced = 'yes';
|
||||
|
||||
# the URL if you click at the E-Mail address (see below)
|
||||
$mailtoURL = 'http://www.apfel.de/~wosch/';
|
||||
$mailtoURL = "mailto:$mailto" if !$mailtoURL;
|
||||
|
||||
# security
|
||||
$ENV{'PATH'} = '/bin:/usr/bin';
|
||||
|
||||
# ports download sources script
|
||||
$pds = 'pds.cgi';
|
||||
}
|
||||
|
||||
# return the date of the last ports database update
|
||||
sub last_update {
|
||||
local($file) = "$cvsroot/$ports_database,v";
|
||||
local($date) = 'unknown';
|
||||
|
||||
open(DB, $file) || do {
|
||||
&warn("$file: $!\n"); &exit;
|
||||
};
|
||||
while(<DB>) {
|
||||
if (/^date/ && /^date\s+([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+);\s+/) {
|
||||
$date = ($1 + 1900) . qq{/$2/$3 $4:$5:$6 UTC};
|
||||
last;
|
||||
}
|
||||
}
|
||||
close DB;
|
||||
return $date;
|
||||
}
|
||||
|
||||
sub last_update_message {
|
||||
return "<p>Last database update: " . &last_update . "<br>\n";
|
||||
}
|
||||
|
||||
sub dec {
|
||||
local($_) = @_;
|
||||
|
||||
s/\+/ /g; # '+' -> space
|
||||
s/%(..)/pack("c",hex($1))/ge; # '%ab' -> char ab
|
||||
|
||||
return($_);
|
||||
}
|
||||
|
||||
sub header {
|
||||
print "Content-type: text/html\n";
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
# $indent is a bit of optional data processing I put in for
|
||||
# formatting the data nicely when you are emailing it.
|
||||
# This is derived from code by Denis Howe <dbh@doc.ic.ac.uk>
|
||||
# and Thomas A Fine <fine@cis.ohio-state.edu>
|
||||
sub decode_form {
|
||||
local($form, *data, $indent, $key, $_) = @_;
|
||||
foreach $_ (split(/&/, $form)) {
|
||||
($key, $_) = split(/=/, $_, 2);
|
||||
$_ =~ s/\+/ /g; # + -> space
|
||||
$key =~ s/\+/ /g; # + -> space
|
||||
$_ =~ 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
|
||||
$data{$key} = $_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# encode unknown data for use in a URL <A HREF="...">
|
||||
sub encode_url {
|
||||
local($_) = @_;
|
||||
s/([\000-\032\;\/\?\:\@\&\=\%\'\"\`\<\>\177-\377 ])/sprintf('%%%02x',ord($1))/eg;
|
||||
# s/%20/+/g;
|
||||
$_;
|
||||
}
|
||||
|
||||
sub warn { print "$_[0]" }
|
||||
sub env { defined($ENV{$_[0]}) ? $ENV{$_[0]} : undef; }
|
||||
sub exit { exit 0 };
|
||||
|
||||
sub readindex {
|
||||
local($date, *var, *msec) = @_;
|
||||
local(@co) = ('co', '-p', '-D', $date, $ports_database);
|
||||
local(@tmp, @s);
|
||||
|
||||
open(C, "-|") || exec (@cvscmd, @co);
|
||||
|
||||
while(<C>) {
|
||||
chop;
|
||||
@tmp = split(/\|/);
|
||||
$var{"$tmp[4]"} = $_;
|
||||
@s = split(/\s+/, $tmp[6]);
|
||||
foreach (@s) {
|
||||
$msec{"$tmp[4],$_"} = 1;
|
||||
}
|
||||
}
|
||||
close C;
|
||||
}
|
||||
|
||||
# extract sub collections
|
||||
sub readcoll {
|
||||
local(@co) = ('co', '-p', 'ports/INDEX');
|
||||
|
||||
open(C, "-|") || exec (@cvscmd, @co);
|
||||
|
||||
local(@a, @b, %key);
|
||||
while(<C>) {
|
||||
chop;
|
||||
|
||||
@a = split('\|');
|
||||
@b = split(/\s+/, $a[6]);
|
||||
|
||||
foreach (@b) {
|
||||
if (!defined($key{$_})) {
|
||||
$key{$_} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close C;
|
||||
|
||||
@a = ();
|
||||
foreach (sort keys %key) {
|
||||
push(@a, $_);
|
||||
}
|
||||
|
||||
return @a;
|
||||
}
|
||||
|
||||
# basic function for HTML output
|
||||
sub out {
|
||||
local($line, $old) = @_;
|
||||
local($version, $path, $local, $comment, $descfile,
|
||||
$email, $sections, $depends, @rest) = split(/\|/, $line);
|
||||
|
||||
if ($path =~ m%^$localPrefix/([^/]+)%o) {
|
||||
if (!$out_sec || $1 ne $out_sec) {
|
||||
print "</DL>\n" if $counter > 0;
|
||||
print qq{\n<H3>} .
|
||||
qq{<a href="$remotePrefixHtml/$1.html">Category $1</a>} .
|
||||
"</H3>\n<DL>\n";
|
||||
$out_sec = $1;
|
||||
}
|
||||
}
|
||||
|
||||
$counter++;
|
||||
$pathDownload = $path;
|
||||
$pathB= $path;
|
||||
$pathB =~ s/^$localPrefix/ports/o;
|
||||
|
||||
$path =~ s/^$localPrefix/$remotePrefixFtp/o;
|
||||
$pathDownload =~ s/^$localPrefix/$remotePrefixFtpDownload/o;
|
||||
$descfile =~ s/^$localPrefix/$remotePrefixFtp/o;
|
||||
|
||||
print qq{<DT><B><A NAME="$version">$version</A></B>\n};
|
||||
print qq{<DD>$comment<BR>\n};
|
||||
|
||||
if ($old) {
|
||||
local($l) = $descfile;
|
||||
$l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o;
|
||||
$l =~ s%/([^/]+)$%/Attic/$1%;
|
||||
|
||||
print qq{<I>Was Maintained by:</I> <A HREF="mailto:$email} .
|
||||
($mailtoAdvanced ?
|
||||
qq{?cc=$mailtoList&subject=FreeBSD%20Port:%20} .
|
||||
&encode_url($version) : '') . qq{">$email</A><BR>} .
|
||||
qq{<A HREF="$l">Removed why</A></DD>};
|
||||
|
||||
} else {
|
||||
local($l) = $path;
|
||||
$l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o;
|
||||
#$l .= '/Makefile';
|
||||
|
||||
print qq{<I>Maintained by:</I> <A HREF="mailto:$email} .
|
||||
($mailtoAdvanced ?
|
||||
qq{?cc=$mailtoList&subject=FreeBSD%20Port:%20} .
|
||||
&encode_url($version) : '') . qq{">$email</A><BR>};
|
||||
|
||||
local(@s) = split(/\s+/, $sections);
|
||||
if ($#s > 0) {
|
||||
print qq{<I>Also listed in:</I> };
|
||||
foreach (@s) {
|
||||
print qq{<A HREF="$remotePrefixHtml/$_.html">$_</A> }
|
||||
if $_ ne $out_sec;
|
||||
}
|
||||
print "<BR>\n";
|
||||
}
|
||||
|
||||
if ($depends) {
|
||||
local($flag) = 0;
|
||||
print qq{<I>Requires:</I> };
|
||||
foreach (split(/\s+/, $depends)) {
|
||||
print ", " if $flag;
|
||||
$flag++;
|
||||
print qq{<A HREF="$script_name?query=^$_&stype=name">$_</A>};
|
||||
}
|
||||
print "<BR>\n";
|
||||
}
|
||||
|
||||
print qq[<A HREF="$descfile">Description</A> <B>:</B>
|
||||
<A HREF="$path">Browse</A> <B>:</B>
|
||||
<A HREF="$pathDownload.tar.gz">Download</A> <B>:</B>
|
||||
<A HREF="$remotePrefixFtpPackages{$release}/$version.tgz">Package</A> <B>:</B>
|
||||
<A HREF="$l">Changes</A> <B>:</B>
|
||||
<A HREF="$pds?$pathB">Sources</A>
|
||||
<p>
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
# new/updated/removed ports output
|
||||
sub out_ports {
|
||||
|
||||
if ($type eq "new") {
|
||||
foreach $key (sort keys %today) {
|
||||
if (!$past{$key}) {
|
||||
if ($section eq "all" || $msec{"$key,$section"}) {
|
||||
&out($today{$key}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elsif ($type eq "removed") {
|
||||
foreach $key (sort keys %past) {
|
||||
if (!$today{$key}) {
|
||||
if ($section eq "all" || $msec{"$key,$section"}) {
|
||||
&out($past{$key}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { # changed
|
||||
foreach $key (sort keys %today) {
|
||||
if ($past{$key} && $past{$key} ne $today{$key}) {
|
||||
@a = split(/\|/, $today{$key});
|
||||
@b = split(/\|/, $past{$key});
|
||||
next if $a[0] eq $b[0];
|
||||
if ($section eq "all" || $msec{"$key,$section"}) {
|
||||
&out($today{$key}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# search and output
|
||||
sub search_ports {
|
||||
local(@a) = ();
|
||||
local($key, $name, $text);
|
||||
|
||||
foreach $key (sort keys %today) {
|
||||
next if $today{$key} !~ /$query/oi;
|
||||
|
||||
@a = split(/\|/, $today{$key});
|
||||
$name = $a[0]; #$name =~ s/(\W)/\\$1/g;
|
||||
$text = $a[3]; #$text =~ s/(\W)/\\$1/g;
|
||||
|
||||
#warn "$stype:$query: $name $text\n";
|
||||
if ($stype eq "name" && $name =~ /$query/o) {
|
||||
&out($today{$key}, 0);
|
||||
} elsif ($stype eq "text" && $text =~ /$query/oi) {
|
||||
&out($today{$key}, 0);
|
||||
} elsif ($stype eq "all" &&
|
||||
($text =~ /$query/oi || $name =~ /$query/io)) {
|
||||
&out($today{$key}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub forms {
|
||||
print qq{<HTML>
|
||||
<HEAD>
|
||||
<TITLE>FreeBSD Ports Changes</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
||||
<H1><a href="../../">FreeBSD Ports Changes</A> $daemonGif</H1>
|
||||
|
||||
<P>
|
||||
FreeBSD Ports [short description <a href="$portsDesc">followed</a> ...]
|
||||
<a href="$script_name/faq.html">FAQ</a>
|
||||
<p>
|
||||
};
|
||||
|
||||
print qq{
|
||||
"Package Name" search for the name of port or distribution.
|
||||
"Description" search case-insensitive in a short comment about the port.
|
||||
"All" search case-insensitive for the package name and in the
|
||||
description about the port.
|
||||
<p>
|
||||
|
||||
<FORM METHOD="GET" ACTION="$script_name">
|
||||
Search for:
|
||||
<INPUT NAME="query" VALUE="$query">
|
||||
<SELECT NAME="stype">
|
||||
};
|
||||
|
||||
local(%d);
|
||||
%d = ('name', 'Package Name',
|
||||
'all', 'All',
|
||||
'text', 'Description');
|
||||
|
||||
foreach ('all', 'name', 'text') {
|
||||
print "<OPTION" . (($_ eq $stype) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">} . ($d{$_} ? $d{$_} : $_) . qq{</OPTION>\n};
|
||||
}
|
||||
|
||||
|
||||
print qq{</SELECT><SELECT NAME="release">\n};
|
||||
foreach (sort keys %remotePrefixFtpPackages) {
|
||||
print qq{<OPTION} .
|
||||
(($_ eq $release) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE=$_>$_</OPTION>\n};
|
||||
}
|
||||
print qq{</SELECT>
|
||||
<INPUT TYPE="submit" VALUE="Submit">
|
||||
</FORM>
|
||||
};
|
||||
|
||||
print qq{<hr noshade>
|
||||
<p>
|
||||
"New" print ports which are new in the ports collection
|
||||
or moved from an other ports section. "Changed" print updated ports.
|
||||
"Removed" print ports which are deleted from ports collections
|
||||
or moved to an other ports section.
|
||||
|
||||
<FORM METHOD="GET" ACTION="$script_name">
|
||||
<SELECT NAME="type">
|
||||
};
|
||||
|
||||
foreach ('new', 'changed', 'removed') {
|
||||
print "<OPTION" . (($_ eq $type) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">$_</OPTION>\n};
|
||||
}
|
||||
|
||||
print qq{</SELECT>\n\n<SELECT NAME="time">\n};
|
||||
foreach ("1 week ago", "2 week ago", "3 week ago", "4 week ago",
|
||||
"6 week ago", "8 week ago", "3 month ago", "4 month ago",
|
||||
"6 month ago", "9 month ago", "12 month ago", "24 month ago")
|
||||
{
|
||||
print "<OPTION" .
|
||||
(($_ eq $time) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">$_</OPTION>\n};
|
||||
}
|
||||
|
||||
print q{</SELECT>
|
||||
|
||||
<SELECT NAME="sektion">
|
||||
<OPTION VALUE="all">All Sections</OPTION>
|
||||
};
|
||||
|
||||
foreach (@sec) {
|
||||
print "<OPTION" .
|
||||
(($_ eq $section) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">$_</OPTION>\n};
|
||||
}
|
||||
|
||||
print q{</SELECT>
|
||||
<INPUT TYPE="submit" VALUE="Submit">
|
||||
</FORM>
|
||||
<HR noshade>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
sub footer {
|
||||
|
||||
print qq{
|
||||
<img ALIGN="RIGHT" src="/gifs/powerlogo.gif">
|
||||
© 1996-1997 by Wolfram Schneider. All rights reserved.<br>
|
||||
};
|
||||
#print q{$Date: 1997/03/20 21:43:48} . "<br>\n";
|
||||
print qq{Please direct questions about this service to
|
||||
<I><A HREF="$mailtoURL">$mailto</A></I><br>\n};
|
||||
print qq{General questions about FreeBSD ports should be sent to } .
|
||||
q{<a href="mailto:$mailtoList">} .
|
||||
qq{<i>$mailtoList</i></a><br>\n};
|
||||
print &last_update_message;
|
||||
print "<hr noshade>\n<P>\n";
|
||||
}
|
||||
|
||||
sub footer2 {
|
||||
print "\n</BODY>\n</HTML>\n";
|
||||
}
|
||||
|
||||
|
||||
sub check_input {
|
||||
if ($query) {
|
||||
$stype = "all" if !$stype;
|
||||
if (!($stype eq "name" ||
|
||||
$stype eq "text" ||
|
||||
$stype eq "all")) {
|
||||
&warn("unknown search type ``$type'', use `all', `text', or `name'\n");
|
||||
&exit(0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!($type eq "new" || $type eq "changed" || $type eq "removed")) {
|
||||
&warn("unknown type `$type', use `new', `changed', or `removed'\n");
|
||||
&exit(0);
|
||||
}
|
||||
|
||||
if ($time !~ /^[1-9][0-9]*\s+(month|week)\s+ago$/) {
|
||||
&warn("unkwnon date: `$time'\n");
|
||||
&exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
sub faq {
|
||||
print qq{<HEAD>\n<TITLE>FAQ</TITLE>\n</HEAD>
|
||||
<BODY <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
||||
<H1>FreeBSD Ports Changed FAQ</h1>
|
||||
|
||||
<h2>Keywords</h2>
|
||||
<dl>
|
||||
<dt><b>Description</b><dd>A more detailed description.
|
||||
<dt><b>Browse</b><dd>Traverse the ports directory.
|
||||
<dt><b>Download</b><dd>Download the ports directory.
|
||||
<dt><b>Package</b><dd>Download the pre-compiled software package.
|
||||
<dt><b>Changes</b><dd>Read the latest changes.
|
||||
<dt><b>Sources</b><dd>Links to all source files.
|
||||
</dl>
|
||||
|
||||
<h2>Misc</h2>
|
||||
All links point to the FreeBSD-stable
|
||||
version and <b>not</b> to the latest releases.<p>
|
||||
|
||||
The script ports.cgi use the file
|
||||
<a href="$remotePrefixCvs/INDEX">
|
||||
FreeBSD-CVS/ports/INDEX,v</a>
|
||||
as database for all operation. INDEX,v will be updated by hand
|
||||
by the portsmeister.<p>
|
||||
|
||||
You may also search the
|
||||
<a href="http://www.de.freebsd.org/de/cgi/man.cgi?manpath=FreeBSD+Ports">ports manual pages</a>.<p>
|
||||
|
||||
Get the <a href ="source">Source</a> of this script.<p>
|
||||
|
||||
<a href="$script_name">Back to the search engine</a><p>
|
||||
<HR noshade>
|
||||
};
|
||||
}
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
|
||||
&init_variables;
|
||||
$query_string = &env('QUERY_STRING');
|
||||
$path_info = &env('PATH_INFO');
|
||||
&decode_form($query_string, *form);
|
||||
|
||||
$type = $form{'type'};
|
||||
$time = $form{'time'};
|
||||
$section = $form{'sektion'};
|
||||
$query = $form{'query'};
|
||||
$stype = $form{'stype'};
|
||||
$release = $form{'release'};
|
||||
$release = $remotePrefixFtpPackagesDefault
|
||||
if !$release || !defined($remotePrefixFtpPackages{$release});
|
||||
$script_name = &env('SCRIPT_NAME');
|
||||
|
||||
if ($path_info eq "/source") {
|
||||
print "Content-type: text/plain\n\n";
|
||||
open(R, $0) || do { print "ick!\n"; &exit; };
|
||||
while(<R>) { print }
|
||||
close R;
|
||||
&exit;
|
||||
}
|
||||
|
||||
&header;
|
||||
if ($path_info eq "/faq.html") {
|
||||
&faq;
|
||||
&footer; &footer2; &exit(0);
|
||||
}
|
||||
|
||||
# allow `/ports.cgi?netscape' where 'netscape' is the query port to search
|
||||
# this make links to this script shorter
|
||||
if (!$query && !$type && $query_string =~ /^([^=&]+)$/) {
|
||||
$query = $1;
|
||||
}
|
||||
|
||||
# automatically read collections, need only 0.2 sec on a pentium
|
||||
@sec = &readcoll;
|
||||
&forms;
|
||||
|
||||
if ($query_string eq "") {
|
||||
&footer; &footer2; &exit(0);
|
||||
}
|
||||
|
||||
#warn "type: $type time: $time section: $section stype: $stype query: $query";
|
||||
&check_input;
|
||||
$counter = 0;
|
||||
|
||||
# search
|
||||
if ($query) {
|
||||
&readindex($relDate{$release}, *today, *msec);
|
||||
$query =~ s/([^\w\^])/\\$1/g;
|
||||
&search_ports;
|
||||
}
|
||||
|
||||
# ports changes
|
||||
else {
|
||||
&readindex('today', *today, *msec);
|
||||
&readindex($time, *past, *msec);
|
||||
&out_ports;
|
||||
}
|
||||
|
||||
if (!$counter) {
|
||||
print "Sorry, nothing found.\n";
|
||||
print qq{You may look for other } .
|
||||
qq{<a href="/search.html">FreeBSD Search Services</a>.\n};
|
||||
} else {
|
||||
print "</dl>\n";
|
||||
}
|
||||
|
||||
print "<hr noshade>\n";
|
||||
&footer;
|
||||
&footer2;
|
53
en/cgi/pds.cgi
Executable file
53
en/cgi/pds.cgi
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 1997 Wolfram Schneider <wosch@FreeBSD.ORG>, Berlin.
|
||||
# All rights reserved.
|
||||
#
|
||||
# pds.cgi - FreeBSD Ports download sources cgi script
|
||||
# print a list of source files for a port
|
||||
#
|
||||
|
||||
file="$QUERY_STRING"
|
||||
file2="$file/Makefile"
|
||||
CVSROOT=/home/ncvs; export CVSROOT
|
||||
|
||||
# set DISTDIR to a dummy directory.
|
||||
DISTDIR=/tmp/___pds.cgi___; export DISTDIR
|
||||
|
||||
cat <<EOF
|
||||
Content-type: text/html
|
||||
|
||||
EOF
|
||||
|
||||
case "$file" in
|
||||
ports/*/*) ;;
|
||||
*) echo "usage: pds module"; exit;;
|
||||
esac
|
||||
|
||||
if [ -f "$CVSROOT/${file2},v" ]; then :
|
||||
else
|
||||
echo "$file2 does not exist"
|
||||
exit
|
||||
fi
|
||||
|
||||
# security check for ../foo/bar and foo/../../bar/
|
||||
case "$file2" in *..*) echo "$file2 does not exist"; exit;; esac
|
||||
|
||||
cat <<EOF
|
||||
<html>
|
||||
<head>
|
||||
<title>Sources for $file</title>
|
||||
</head>
|
||||
<body BGCOLOR="#ffffff" TEXT="#000000"
|
||||
vlink="c00000" link="#0000ff" alink="#eeee00">
|
||||
|
||||
<h1>Sources for $file</h1>
|
||||
|
||||
EOF
|
||||
cvs -Q co -p $file2 | make -I /home/fenner/mk -f - bill-fetch |
|
||||
perl -ne 'print qq{<a href="$1">$1</a><br>\n}
|
||||
if m%((http|ftp)://\S+)%'
|
||||
cat <<EOF
|
||||
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
613
en/cgi/ports.cgi
Executable file
613
en/cgi/ports.cgi
Executable file
|
@ -0,0 +1,613 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (c) 1996-1997 Wolfram Schneider <wosch@FreeBSD.ORG>, Berlin.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $Id: ports.cgi,v 1.1 1997-09-19 16:47:40 wosch Exp $
|
||||
#
|
||||
# ports.cgi - search engine for FreeBSD ports
|
||||
# o search for a port by name or description
|
||||
# o search for new or updated ports
|
||||
#
|
||||
#
|
||||
# If you want use this script on your own host this line must
|
||||
# work for you: $ cvs rdiff -D'last week' ports/INDEX
|
||||
|
||||
|
||||
sub init_variables {
|
||||
$cvsroot = '/home/ncvs'; # $CVSROOT
|
||||
$localPrefix = '/usr/ports'; # ports prefix
|
||||
$ports_database = 'ports/INDEX';
|
||||
# unset $ENV{'CVSROOT'};
|
||||
|
||||
@cvscmd = ('cvs', '-Q', '-d', $cvsroot);
|
||||
|
||||
# URL of ports tree for browsing
|
||||
$remotePrefixFtp =
|
||||
'http://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports';
|
||||
|
||||
# URL of ports tree for download
|
||||
$remotePrefixFtpDownload =
|
||||
# 'ftp://ftp.cs.tu-berlin.de/pub/FreeBSD/FreeBSD-current/ports';
|
||||
'ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports';
|
||||
|
||||
# where to get -current packages
|
||||
local($p) = 'ftp://ftp.freebsd.org/pub/FreeBSD';
|
||||
$remotePrefixFtpPackagesDefault = 'current';
|
||||
%remotePrefixFtpPackages =
|
||||
('current', "$p/packages-stable/All",
|
||||
'2.2.2', "$p/packages-2.2.2/All",
|
||||
'2.1.6', "$p/packages-2.1.6/All",
|
||||
'2.1.0', "$p/packages-2.1/All",
|
||||
);
|
||||
|
||||
%relDate =
|
||||
('current', 'today',
|
||||
'2.2.2', '5/16/97',
|
||||
'2.1.6', '11/16/96',
|
||||
'2.1.0', '11/19/95',
|
||||
);
|
||||
|
||||
#
|
||||
$remotePrefixHtml =
|
||||
'http://www.freebsd.org/ports';
|
||||
|
||||
# CVS Web interface
|
||||
$remotePrefixCvs =
|
||||
'http://www.freebsd.org/cgi/cvsweb.cgi/ports';
|
||||
|
||||
# Ports documentation
|
||||
$portsDesc = 'http://www.freebsd.org/ports/';
|
||||
|
||||
# location of the tiny BSD daemon
|
||||
$daemonGif = '<IMG SRC="/gifs/littlelogo.gif">';
|
||||
|
||||
# visible E-Mail address, plain text
|
||||
$mailto = 'wosch@FreeBSD.org';
|
||||
|
||||
# Mailinglist for FreeBSD Ports
|
||||
$mailtoList = 'ports@FreeBSD.org';
|
||||
|
||||
# use mailto:email?subject
|
||||
$mailtoAdvanced = 'yes';
|
||||
|
||||
# the URL if you click at the E-Mail address (see below)
|
||||
$mailtoURL = 'http://www.apfel.de/~wosch/';
|
||||
$mailtoURL = "mailto:$mailto" if !$mailtoURL;
|
||||
|
||||
# security
|
||||
$ENV{'PATH'} = '/bin:/usr/bin';
|
||||
|
||||
# ports download sources script
|
||||
$pds = 'pds.cgi';
|
||||
}
|
||||
|
||||
# return the date of the last ports database update
|
||||
sub last_update {
|
||||
local($file) = "$cvsroot/$ports_database,v";
|
||||
local($date) = 'unknown';
|
||||
|
||||
open(DB, $file) || do {
|
||||
&warn("$file: $!\n"); &exit;
|
||||
};
|
||||
while(<DB>) {
|
||||
if (/^date/ && /^date\s+([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+);\s+/) {
|
||||
$date = ($1 + 1900) . qq{/$2/$3 $4:$5:$6 UTC};
|
||||
last;
|
||||
}
|
||||
}
|
||||
close DB;
|
||||
return $date;
|
||||
}
|
||||
|
||||
sub last_update_message {
|
||||
return "<p>Last database update: " . &last_update . "<br>\n";
|
||||
}
|
||||
|
||||
sub dec {
|
||||
local($_) = @_;
|
||||
|
||||
s/\+/ /g; # '+' -> space
|
||||
s/%(..)/pack("c",hex($1))/ge; # '%ab' -> char ab
|
||||
|
||||
return($_);
|
||||
}
|
||||
|
||||
sub header {
|
||||
print "Content-type: text/html\n";
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
# $indent is a bit of optional data processing I put in for
|
||||
# formatting the data nicely when you are emailing it.
|
||||
# This is derived from code by Denis Howe <dbh@doc.ic.ac.uk>
|
||||
# and Thomas A Fine <fine@cis.ohio-state.edu>
|
||||
sub decode_form {
|
||||
local($form, *data, $indent, $key, $_) = @_;
|
||||
foreach $_ (split(/&/, $form)) {
|
||||
($key, $_) = split(/=/, $_, 2);
|
||||
$_ =~ s/\+/ /g; # + -> space
|
||||
$key =~ s/\+/ /g; # + -> space
|
||||
$_ =~ 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
|
||||
$data{$key} = $_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# encode unknown data for use in a URL <A HREF="...">
|
||||
sub encode_url {
|
||||
local($_) = @_;
|
||||
s/([\000-\032\;\/\?\:\@\&\=\%\'\"\`\<\>\177-\377 ])/sprintf('%%%02x',ord($1))/eg;
|
||||
# s/%20/+/g;
|
||||
$_;
|
||||
}
|
||||
|
||||
sub warn { print "$_[0]" }
|
||||
sub env { defined($ENV{$_[0]}) ? $ENV{$_[0]} : undef; }
|
||||
sub exit { exit 0 };
|
||||
|
||||
sub readindex {
|
||||
local($date, *var, *msec) = @_;
|
||||
local(@co) = ('co', '-p', '-D', $date, $ports_database);
|
||||
local(@tmp, @s);
|
||||
|
||||
open(C, "-|") || exec (@cvscmd, @co);
|
||||
|
||||
while(<C>) {
|
||||
chop;
|
||||
@tmp = split(/\|/);
|
||||
$var{"$tmp[4]"} = $_;
|
||||
@s = split(/\s+/, $tmp[6]);
|
||||
foreach (@s) {
|
||||
$msec{"$tmp[4],$_"} = 1;
|
||||
}
|
||||
}
|
||||
close C;
|
||||
}
|
||||
|
||||
# extract sub collections
|
||||
sub readcoll {
|
||||
local(@co) = ('co', '-p', 'ports/INDEX');
|
||||
|
||||
open(C, "-|") || exec (@cvscmd, @co);
|
||||
|
||||
local(@a, @b, %key);
|
||||
while(<C>) {
|
||||
chop;
|
||||
|
||||
@a = split('\|');
|
||||
@b = split(/\s+/, $a[6]);
|
||||
|
||||
foreach (@b) {
|
||||
if (!defined($key{$_})) {
|
||||
$key{$_} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close C;
|
||||
|
||||
@a = ();
|
||||
foreach (sort keys %key) {
|
||||
push(@a, $_);
|
||||
}
|
||||
|
||||
return @a;
|
||||
}
|
||||
|
||||
# basic function for HTML output
|
||||
sub out {
|
||||
local($line, $old) = @_;
|
||||
local($version, $path, $local, $comment, $descfile,
|
||||
$email, $sections, $depends, @rest) = split(/\|/, $line);
|
||||
|
||||
if ($path =~ m%^$localPrefix/([^/]+)%o) {
|
||||
if (!$out_sec || $1 ne $out_sec) {
|
||||
print "</DL>\n" if $counter > 0;
|
||||
print qq{\n<H3>} .
|
||||
qq{<a href="$remotePrefixHtml/$1.html">Category $1</a>} .
|
||||
"</H3>\n<DL>\n";
|
||||
$out_sec = $1;
|
||||
}
|
||||
}
|
||||
|
||||
$counter++;
|
||||
$pathDownload = $path;
|
||||
$pathB= $path;
|
||||
$pathB =~ s/^$localPrefix/ports/o;
|
||||
|
||||
$path =~ s/^$localPrefix/$remotePrefixFtp/o;
|
||||
$pathDownload =~ s/^$localPrefix/$remotePrefixFtpDownload/o;
|
||||
$descfile =~ s/^$localPrefix/$remotePrefixFtp/o;
|
||||
|
||||
print qq{<DT><B><A NAME="$version">$version</A></B>\n};
|
||||
print qq{<DD>$comment<BR>\n};
|
||||
|
||||
if ($old) {
|
||||
local($l) = $descfile;
|
||||
$l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o;
|
||||
$l =~ s%/([^/]+)$%/Attic/$1%;
|
||||
|
||||
print qq{<I>Was Maintained by:</I> <A HREF="mailto:$email} .
|
||||
($mailtoAdvanced ?
|
||||
qq{?cc=$mailtoList&subject=FreeBSD%20Port:%20} .
|
||||
&encode_url($version) : '') . qq{">$email</A><BR>} .
|
||||
qq{<A HREF="$l">Removed why</A></DD>};
|
||||
|
||||
} else {
|
||||
local($l) = $path;
|
||||
$l =~ s%^$remotePrefixFtp%$remotePrefixCvs%o;
|
||||
#$l .= '/Makefile';
|
||||
|
||||
print qq{<I>Maintained by:</I> <A HREF="mailto:$email} .
|
||||
($mailtoAdvanced ?
|
||||
qq{?cc=$mailtoList&subject=FreeBSD%20Port:%20} .
|
||||
&encode_url($version) : '') . qq{">$email</A><BR>};
|
||||
|
||||
local(@s) = split(/\s+/, $sections);
|
||||
if ($#s > 0) {
|
||||
print qq{<I>Also listed in:</I> };
|
||||
foreach (@s) {
|
||||
print qq{<A HREF="$remotePrefixHtml/$_.html">$_</A> }
|
||||
if $_ ne $out_sec;
|
||||
}
|
||||
print "<BR>\n";
|
||||
}
|
||||
|
||||
if ($depends) {
|
||||
local($flag) = 0;
|
||||
print qq{<I>Requires:</I> };
|
||||
foreach (split(/\s+/, $depends)) {
|
||||
print ", " if $flag;
|
||||
$flag++;
|
||||
print qq{<A HREF="$script_name?query=^$_&stype=name">$_</A>};
|
||||
}
|
||||
print "<BR>\n";
|
||||
}
|
||||
|
||||
print qq[<A HREF="$descfile">Description</A> <B>:</B>
|
||||
<A HREF="$path">Browse</A> <B>:</B>
|
||||
<A HREF="$pathDownload.tar.gz">Download</A> <B>:</B>
|
||||
<A HREF="$remotePrefixFtpPackages{$release}/$version.tgz">Package</A> <B>:</B>
|
||||
<A HREF="$l">Changes</A> <B>:</B>
|
||||
<A HREF="$pds?$pathB">Sources</A>
|
||||
<p>
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
# new/updated/removed ports output
|
||||
sub out_ports {
|
||||
|
||||
if ($type eq "new") {
|
||||
foreach $key (sort keys %today) {
|
||||
if (!$past{$key}) {
|
||||
if ($section eq "all" || $msec{"$key,$section"}) {
|
||||
&out($today{$key}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elsif ($type eq "removed") {
|
||||
foreach $key (sort keys %past) {
|
||||
if (!$today{$key}) {
|
||||
if ($section eq "all" || $msec{"$key,$section"}) {
|
||||
&out($past{$key}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { # changed
|
||||
foreach $key (sort keys %today) {
|
||||
if ($past{$key} && $past{$key} ne $today{$key}) {
|
||||
@a = split(/\|/, $today{$key});
|
||||
@b = split(/\|/, $past{$key});
|
||||
next if $a[0] eq $b[0];
|
||||
if ($section eq "all" || $msec{"$key,$section"}) {
|
||||
&out($today{$key}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# search and output
|
||||
sub search_ports {
|
||||
local(@a) = ();
|
||||
local($key, $name, $text);
|
||||
|
||||
foreach $key (sort keys %today) {
|
||||
next if $today{$key} !~ /$query/oi;
|
||||
|
||||
@a = split(/\|/, $today{$key});
|
||||
$name = $a[0]; #$name =~ s/(\W)/\\$1/g;
|
||||
$text = $a[3]; #$text =~ s/(\W)/\\$1/g;
|
||||
|
||||
#warn "$stype:$query: $name $text\n";
|
||||
if ($stype eq "name" && $name =~ /$query/o) {
|
||||
&out($today{$key}, 0);
|
||||
} elsif ($stype eq "text" && $text =~ /$query/oi) {
|
||||
&out($today{$key}, 0);
|
||||
} elsif ($stype eq "all" &&
|
||||
($text =~ /$query/oi || $name =~ /$query/io)) {
|
||||
&out($today{$key}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub forms {
|
||||
print qq{<HTML>
|
||||
<HEAD>
|
||||
<TITLE>FreeBSD Ports Changes</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
||||
<H1><a href="../../">FreeBSD Ports Changes</A> $daemonGif</H1>
|
||||
|
||||
<P>
|
||||
FreeBSD Ports [short description <a href="$portsDesc">followed</a> ...]
|
||||
<a href="$script_name/faq.html">FAQ</a>
|
||||
<p>
|
||||
};
|
||||
|
||||
print qq{
|
||||
"Package Name" search for the name of port or distribution.
|
||||
"Description" search case-insensitive in a short comment about the port.
|
||||
"All" search case-insensitive for the package name and in the
|
||||
description about the port.
|
||||
<p>
|
||||
|
||||
<FORM METHOD="GET" ACTION="$script_name">
|
||||
Search for:
|
||||
<INPUT NAME="query" VALUE="$query">
|
||||
<SELECT NAME="stype">
|
||||
};
|
||||
|
||||
local(%d);
|
||||
%d = ('name', 'Package Name',
|
||||
'all', 'All',
|
||||
'text', 'Description');
|
||||
|
||||
foreach ('all', 'name', 'text') {
|
||||
print "<OPTION" . (($_ eq $stype) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">} . ($d{$_} ? $d{$_} : $_) . qq{</OPTION>\n};
|
||||
}
|
||||
|
||||
|
||||
print qq{</SELECT><SELECT NAME="release">\n};
|
||||
foreach (sort keys %remotePrefixFtpPackages) {
|
||||
print qq{<OPTION} .
|
||||
(($_ eq $release) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE=$_>$_</OPTION>\n};
|
||||
}
|
||||
print qq{</SELECT>
|
||||
<INPUT TYPE="submit" VALUE="Submit">
|
||||
</FORM>
|
||||
};
|
||||
|
||||
print qq{<hr noshade>
|
||||
<p>
|
||||
"New" print ports which are new in the ports collection
|
||||
or moved from an other ports section. "Changed" print updated ports.
|
||||
"Removed" print ports which are deleted from ports collections
|
||||
or moved to an other ports section.
|
||||
|
||||
<FORM METHOD="GET" ACTION="$script_name">
|
||||
<SELECT NAME="type">
|
||||
};
|
||||
|
||||
foreach ('new', 'changed', 'removed') {
|
||||
print "<OPTION" . (($_ eq $type) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">$_</OPTION>\n};
|
||||
}
|
||||
|
||||
print qq{</SELECT>\n\n<SELECT NAME="time">\n};
|
||||
foreach ("1 week ago", "2 week ago", "3 week ago", "4 week ago",
|
||||
"6 week ago", "8 week ago", "3 month ago", "4 month ago",
|
||||
"6 month ago", "9 month ago", "12 month ago", "24 month ago")
|
||||
{
|
||||
print "<OPTION" .
|
||||
(($_ eq $time) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">$_</OPTION>\n};
|
||||
}
|
||||
|
||||
print q{</SELECT>
|
||||
|
||||
<SELECT NAME="sektion">
|
||||
<OPTION VALUE="all">All Sections</OPTION>
|
||||
};
|
||||
|
||||
foreach (@sec) {
|
||||
print "<OPTION" .
|
||||
(($_ eq $section) ? ' SELECTED ' : ' ') .
|
||||
qq{VALUE="$_">$_</OPTION>\n};
|
||||
}
|
||||
|
||||
print q{</SELECT>
|
||||
<INPUT TYPE="submit" VALUE="Submit">
|
||||
</FORM>
|
||||
<HR noshade>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
sub footer {
|
||||
|
||||
print qq{
|
||||
<img ALIGN="RIGHT" src="/gifs/powerlogo.gif">
|
||||
© 1996-1997 by Wolfram Schneider. All rights reserved.<br>
|
||||
};
|
||||
#print q{$Date: 1997/03/20 21:43:48} . "<br>\n";
|
||||
print qq{Please direct questions about this service to
|
||||
<I><A HREF="$mailtoURL">$mailto</A></I><br>\n};
|
||||
print qq{General questions about FreeBSD ports should be sent to } .
|
||||
q{<a href="mailto:$mailtoList">} .
|
||||
qq{<i>$mailtoList</i></a><br>\n};
|
||||
print &last_update_message;
|
||||
print "<hr noshade>\n<P>\n";
|
||||
}
|
||||
|
||||
sub footer2 {
|
||||
print "\n</BODY>\n</HTML>\n";
|
||||
}
|
||||
|
||||
|
||||
sub check_input {
|
||||
if ($query) {
|
||||
$stype = "all" if !$stype;
|
||||
if (!($stype eq "name" ||
|
||||
$stype eq "text" ||
|
||||
$stype eq "all")) {
|
||||
&warn("unknown search type ``$type'', use `all', `text', or `name'\n");
|
||||
&exit(0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!($type eq "new" || $type eq "changed" || $type eq "removed")) {
|
||||
&warn("unknown type `$type', use `new', `changed', or `removed'\n");
|
||||
&exit(0);
|
||||
}
|
||||
|
||||
if ($time !~ /^[1-9][0-9]*\s+(month|week)\s+ago$/) {
|
||||
&warn("unkwnon date: `$time'\n");
|
||||
&exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
sub faq {
|
||||
print qq{<HEAD>\n<TITLE>FAQ</TITLE>\n</HEAD>
|
||||
<BODY <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
||||
<H1>FreeBSD Ports Changed FAQ</h1>
|
||||
|
||||
<h2>Keywords</h2>
|
||||
<dl>
|
||||
<dt><b>Description</b><dd>A more detailed description.
|
||||
<dt><b>Browse</b><dd>Traverse the ports directory.
|
||||
<dt><b>Download</b><dd>Download the ports directory.
|
||||
<dt><b>Package</b><dd>Download the pre-compiled software package.
|
||||
<dt><b>Changes</b><dd>Read the latest changes.
|
||||
<dt><b>Sources</b><dd>Links to all source files.
|
||||
</dl>
|
||||
|
||||
<h2>Misc</h2>
|
||||
All links point to the FreeBSD-stable
|
||||
version and <b>not</b> to the latest releases.<p>
|
||||
|
||||
The script ports.cgi use the file
|
||||
<a href="$remotePrefixCvs/INDEX">
|
||||
FreeBSD-CVS/ports/INDEX,v</a>
|
||||
as database for all operation. INDEX,v will be updated by hand
|
||||
by the portsmeister.<p>
|
||||
|
||||
You may also search the
|
||||
<a href="http://www.de.freebsd.org/de/cgi/man.cgi?manpath=FreeBSD+Ports">ports manual pages</a>.<p>
|
||||
|
||||
Get the <a href ="source">Source</a> of this script.<p>
|
||||
|
||||
<a href="$script_name">Back to the search engine</a><p>
|
||||
<HR noshade>
|
||||
};
|
||||
}
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
|
||||
&init_variables;
|
||||
$query_string = &env('QUERY_STRING');
|
||||
$path_info = &env('PATH_INFO');
|
||||
&decode_form($query_string, *form);
|
||||
|
||||
$type = $form{'type'};
|
||||
$time = $form{'time'};
|
||||
$section = $form{'sektion'};
|
||||
$query = $form{'query'};
|
||||
$stype = $form{'stype'};
|
||||
$release = $form{'release'};
|
||||
$release = $remotePrefixFtpPackagesDefault
|
||||
if !$release || !defined($remotePrefixFtpPackages{$release});
|
||||
$script_name = &env('SCRIPT_NAME');
|
||||
|
||||
if ($path_info eq "/source") {
|
||||
print "Content-type: text/plain\n\n";
|
||||
open(R, $0) || do { print "ick!\n"; &exit; };
|
||||
while(<R>) { print }
|
||||
close R;
|
||||
&exit;
|
||||
}
|
||||
|
||||
&header;
|
||||
if ($path_info eq "/faq.html") {
|
||||
&faq;
|
||||
&footer; &footer2; &exit(0);
|
||||
}
|
||||
|
||||
# allow `/ports.cgi?netscape' where 'netscape' is the query port to search
|
||||
# this make links to this script shorter
|
||||
if (!$query && !$type && $query_string =~ /^([^=&]+)$/) {
|
||||
$query = $1;
|
||||
}
|
||||
|
||||
# automatically read collections, need only 0.2 sec on a pentium
|
||||
@sec = &readcoll;
|
||||
&forms;
|
||||
|
||||
if ($query_string eq "") {
|
||||
&footer; &footer2; &exit(0);
|
||||
}
|
||||
|
||||
#warn "type: $type time: $time section: $section stype: $stype query: $query";
|
||||
&check_input;
|
||||
$counter = 0;
|
||||
|
||||
# search
|
||||
if ($query) {
|
||||
&readindex($relDate{$release}, *today, *msec);
|
||||
$query =~ s/([^\w\^])/\\$1/g;
|
||||
&search_ports;
|
||||
}
|
||||
|
||||
# ports changes
|
||||
else {
|
||||
&readindex('today', *today, *msec);
|
||||
&readindex($time, *past, *msec);
|
||||
&out_ports;
|
||||
}
|
||||
|
||||
if (!$counter) {
|
||||
print "Sorry, nothing found.\n";
|
||||
print qq{You may look for other } .
|
||||
qq{<a href="/search.html">FreeBSD Search Services</a>.\n};
|
||||
} else {
|
||||
print "</dl>\n";
|
||||
}
|
||||
|
||||
print "<hr noshade>\n";
|
||||
&footer;
|
||||
&footer2;
|
Loading…
Reference in a new issue