Look for pkg-descr in Attic, if it can not be found in the expected

directory.

This fixes the problem reported several times on www@ when a port's
pkg-descr file is CVS deleted and INDEX isn't fully updated, then the
description link in ports.cgi will not work, because url.cgi can't the
pkg-descr file.

PR:		www/53386
Submitted by:	myself
Approved by:	ceri (mentor)
This commit is contained in:
Simon L. B. Nielsen 2003-07-24 14:40:48 +00:00
parent 6e8051bd4b
commit 609d7da443
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=17663

View file

@ -26,7 +26,7 @@
# #
# url.cgi - make plain text URLs clickable # url.cgi - make plain text URLs clickable
# #
# $FreeBSD: www/en/cgi/url.cgi,v 1.30 2001/12/11 21:37:30 wosch Exp $ # $FreeBSD: www/en/cgi/url.cgi,v 1.31 2002/05/02 14:21:40 wosch Exp $
use strict; use strict;
@ -69,15 +69,30 @@ if ($file =~ m%^ports/([\w-]+)/(\w[\w-+.]+)/pkg-descr%) {
print &short_html_header($file); print &short_html_header($file);
} }
# do cvs checkout my $isvalidfilename = ($file =~ m%^ports/[\w-]+/\w[\w-+.]*/pkg-descr%);
my($cvsroot) = '/usr/local/www/cvsroot/FreeBSD'; my $atticfile = $file;
if ($file =~ m%^ports/[\w-]+/\w[\w-+.]*/pkg-descr% && -f "$cvsroot/$file,v") { $atticfile =~ s%^(.*)/([^/]+)$%$1/Attic/$2%;
open(CO, "-|") ||
exec ('/usr/bin/co', '-p', '-q', "$cvsroot/$file,v") ||
die "exec co -pq $cvsroot/$file,v: $!\n";
}
else { my($cvsroot) = '/usr/local/www/cvsroot/FreeBSD';
my $realfile;
# since CVS moves deleted files into the Attic subdirectory we also
# want to look there, so we can find CVS deleted files (which might
# still be referenced from other places).
if ($isvalidfilename && -f "$cvsroot/$file,v") {
$realfile = $file;
} elsif ($isvalidfilename && -f "$cvsroot/$atticfile,v") {
$realfile = $atticfile;
} else {
$isvalidfilename = 0;
}
# do cvs checkout
if($isvalidfilename) {
open(CO, "-|") ||
exec ('/usr/bin/co', '-p', '-q', "$cvsroot/$realfile,v") ||
die "exec co -pq $cvsroot/$realfile,v: $!\n";
} else {
print "<p>The port specified does not exist, or has an invalid name: <p>", print "<p>The port specified does not exist, or has an invalid name: <p>",
"<blockquote>$file</blockquote>\n"; "<blockquote>$file</blockquote>\n";