my $defaultdist = "sid";
my $refresh = &::getChanConfDefault("debianRefreshInterval",7)
* 60 * 60 * 24;
+my $debug = 1;
### ... old
#my %dists = (
next unless ($update);
- &::DEBUG("announce == $announce.");
+ &::DEBUG("announce == $announce.") if ($debug);
if ($good + $bad == 0 and !$announce) {
&::status("Debian: Downloading files for '$dist'.");
&::msg($::who, "Updating debian files... please wait.");
}
if (exists $::debian{$url}) {
- &::DEBUG("2: ".(time - $::debian{$url})." <= $refresh");
+ &::DEBUG("2: ".(time - $::debian{$url})." <= $refresh") if ($debug);
next if (time() - $::debian{$url} <= $refresh);
- &::DEBUG("stale for url $url; updating!");
+ &::DEBUG("stale for url $url; updating!") if ($debug);
}
if ($url =~ /^ftp:\/\/(.*?)\/(\S+)\/(\S+)$/) {
}
if (! -f $file) {
- &::DEBUG("deb: down: ftpGet: !file");
+ &::WARN("deb: down: ftpGet: !file");
$bad++;
next;
}
# system("cp debian/Contents-potato-i386-non-US.gz debian/Contents-woody-i386-non-US.gz");
# }
- &::DEBUG("deb: download: good.");
+ &::DEBUG("deb: download: good.") if ($debug);
$good++;
} else {
&::ERROR("Debian: invalid format of url => ($url).");
my $prefix = "Debian Search of '$query' ";
if (scalar @list) { # @list.
&::pSReply( &::formListReply(0, $prefix, @list) );
+
} else { # !@list.
&::DEBUG("ok, !\@list, searching desc for '$query'.");
my @list = &searchDesc($query);
if (!scalar @list) {
my $prefix = "Debian Package/File/Desc Search of '$query' ";
&::pSReply( &::formListReply(0, $prefix, ) );
+
} elsif (scalar @list == 1) { # list = 1.
&::DEBUG("list == 1; showing package info of '$list[0]'.");
&infoPackages("info", $list[0]);
+
} else { # list > 1.
my $prefix = "Debian Desc Search of '$query' ";
&::pSReply( &::formListReply(0, $prefix, @list) );
if ($good == 0 and $bad != 0) {
my %urls = &fixDist($dist, %urlpackages);
&::DEBUG("deb: download 2.");
+
if (!&DebianDownload($dist, %urls)) {
&::ERROR("Debian(sA): could not download files.");
return;
while (<IN>) {
if (/^Package: (\S+)$/) {
$package = $1;
+
} elsif (/^Maintainer: (.*) \<(\S+)\>$/) {
my($name,$email) = ($1,$2);
if ($package eq "") {
$maint{$name}{$email} = 1;
$pkg{$name}{$package} = 1;
$package = "";
+
} else {
&::WARN("invalid line: '$_'.");
}
# TODO: should we only search email if '@' is used?
if (scalar keys %hash < 15) {
my $name;
+
foreach $name (keys %maint) {
my $email;
+
foreach $email (keys %{ $maint{$name} }) {
next unless ($email =~ /\Q$query\E/i);
next if (exists $hash{$name});
if ($good == 0 and $bad != 0) {
my %urls = &fixDist($dist, %urlpackages);
&::DEBUG("deb: download 2c.");
+
if (!&DebianDownload($dist, %urls)) {
&::ERROR("Debian(sD): could not download files.");
return;
# hrm...
my %urls = &fixDist($dist, %urlpackages);
if ($dist ne "incoming") {
- &::DEBUG("deb: download 3.");
+ &::DEBUG("deb: download 3.") if ($debug);
+
if (!&DebianDownload($dist, %urls)) { # no good download.
&::WARN("Debian(iP): could not download ANY files.");
}
my $olddist = $dist;
$dist = &getDistro($dist);
- &::DEBUG("D: validPackage($package, $dist) called.");
+ &::DEBUG("D: validPackage($package, $dist) called.") if ($debug);
my $error = 0;
while (!open(IN, "debian/Packages-$dist.idx")) {