#!/usr/bin/perl
# Build user-friendly web-page
my $indexplace="/home/ftp/pub/fido/husky/debian/dists/unstable";
my $debhome="/home/ftp/pub/fido/husky/debian";
my $href="http://husky.sourceforge.net/debian";
# begin html index
open (OUT, "> $indexplace/index.html");
print OUT "\n
Packages for unstable\n\n";
print OUT "For stable (woody) packages go here:\n";
print OUT "stable\n";
print OUT "
\n\n";
# scan packages
open (ls, "cd $indexplace; ls -1 -I\"*.html\" 2>/dev/null |");
while ( ) {
chop;
&parse_packages($_);
}
close (ls);
# end html index
print OUT "
For stable (woody) packages go here:\n";
print OUT "stable\n";
print OUT "
\n\n";
$tm = gmtime();
print OUT "Generated $tm UTC by buildpage 2.0 - Copyright (C) 2002\n";
print OUT "Pavel Andreew\n";
print OUT "\n
\n\n\n";
close (OUT);
exit 0;
sub parse_packages {
local ($pdir) = $_;
local ($line, $source, $filename);
open (IN, "$indexplace/$pdir/binary-i386/Packages");
while ( ) {
chop;
$line = ch_ltgt( $_ );
if ( $line =~ /^Package:.*/ ) {
&parse_changes($package, $source, $filename);
( $key, $package ) = split( /: /, $line, 2);
$source = "";
$filename = "";
}
if ( $line =~ /^Source:.*/ ) {
( $key, $source ) = split( /: /, $line, 2);
}
if ( $line =~ /^Filename:.*/ ) {
( $key, $filename ) = split( /: /, $line, 2);
print OUT "$key: $filename\n";
}
else {
print OUT "$line\n";
}
}
&parse_changes($package, $source, $filename);
close (IN);
}
sub ch_ltgt {
local ($line) = $_;
$line =~ s/>/\>/g;
$line =~ s/\</g;
return $line;
}
sub parse_changes {
local ($package) = $_[0];
local ($source) = $_[1];
local ($filename) = $_[2];
local ($line, $prn);
if ( $filename eq "" ) {
return;
};
if ( $source ne "" ) {
$filename =~ s/$package/$source/g;
};
$filename =~ s/.deb/.changes/g;
open(CH, "$debhome/$filename") || return;
$prn = "no";
while ( ) {
chop;
$line = $_;
if ( $line =~ /^Changes:.*/ ) {
$prn = "yes";
print OUT "Last changes:\n";
}
else {
if ( $line =~ /^Files:.*/ ) {
$prn = "no";
}
else {
if ($prn eq "yes") {
print OUT ch_ltgt($line)."\n";
}
}
}
}
close (CH);
print OUT "\n";
}