1 |
<?php |
2 |
|
3 |
$SOURCES="/srv/andrew.net.au/changelogs/Sources"; |
4 |
$URL_STUB="http://packages.debian.org/changelogs/"; |
5 |
|
6 |
header("Pragma: no-cache"); |
7 |
list(, $package) = explode("/", $HTTP_SERVER_VARS["REQUEST_URI"]); |
8 |
$handle = popen("grep-dctrl -sDirectory -sVersion -P $package -X -n $SOURCES", 'r'); |
9 |
|
10 |
$directory = chop(fgets($handle, 1024)); |
11 |
$version = chop(fgets($handle, 1024)); |
12 |
|
13 |
pclose($handle); |
14 |
|
15 |
$version = ereg_replace("^[[:digit:]]+\:", "", $version); |
16 |
|
17 |
if (!strlen($directory) || !strlen($version)) { |
18 |
header("HTTP/1.1 404 Not Found"); ?> |
19 |
<HTML> |
20 |
<HEAD> |
21 |
<TITLE>Debian source package changelog viewer</TITLE> |
22 |
</HEAD> |
23 |
<BODY> |
24 |
<H1>Debian source package changelog viewer</H1> |
25 |
<H2>Error: No such package</H2> |
26 |
The package name you provided, <B><?php echo $package ?></B>, does not seem to exist in the Sources file. |
27 |
</BODY> |
28 |
</HTML> |
29 |
|
30 |
<?php } else { |
31 |
$URL = $URL_STUB . $directory . "/" .$package . "_" . $version . "/changelog"; |
32 |
|
33 |
//echo "Will redirect to $URL\n"; |
34 |
|
35 |
header("Location: $URL"); |
36 |
|
37 |
//phpinfo(); |
38 |
} |
39 |
?> |