### new... the right way.
my %dists = (
"unstable" => "sid",
- "testing" => "woody", # new since 20001219.
- "stable" => "potato",
+ "testing" => "sarge", # new since 20020719.
+ "stable" => "woody",
+ "old-stable" => "potato",
"incoming" => "incoming",
);
$file =~ s/##DIST/$dist/g;
my $update = 0;
- if ( -f $file) {
+ if ( -f $file ) {
my $last_refresh = (stat $file)[9];
$update++ if (time() - $last_refresh > $refresh);
} else {
# system("cp debian/Contents-potato-i386-non-US.gz debian/Contents-woody-i386-non-US.gz");
# }
+ my $exit = CORE::system("/bin/gzip -t $file >/dev/null 2>&1");
+ if ($exit) {
+ &::WARN("deb: $file is corrupted :/");
+ unlink $file;
+ next;
+ }
+
&::DEBUG("deb: download: good.") if ($debug);
$good++;
} else {
}
}
+ # ok... lets just run this.
+ &::miscCheck() if (&::whatInterface() =~ /IRC/);
+
if ($good) {
&generateIndex($dist);
return 1;
s/##DIST/$dist/g;
next unless ( -f "$debian_dir/$_" );
- push(@files, "$debian_dir/$_" );
+ push(@files, "$debian_dir/$_");
}
if (!scalar @files) {
$regex =~ s/\?/./g;
open(IN,"zegrep -h '$grepRE' $files |");
+ # wonderful abuse of last and next and unless ;)
while (<IN>) {
- if (/^\.?\/?(.*?)[\t\s]+(\S+)\n$/) {
- my ($file,$package) = ("/".$1,$2);
- if ($query =~ /[\/\*\\]/) {
- next unless (eval { $file =~ /$regex/ });
- return unless &checkEval($@);
- } else {
- my ($basename) = $file =~ /^.*\/(.*)$/;
- next unless (eval { $basename =~ /$regex/ });
- return unless &checkEval($@);
- }
- next if ($query !~ /\.\d\.gz/ and $file =~ /\/man\//);
- next if ($front and eval { $file !~ /^\/$query/ });
- return unless &checkEval($@);
+ last if ($found > 100);
+
+ next unless (/^\.?\/?(.*?)[\t\s]+(\S+)\n$/);
+ my ($file,$package) = ("/".$1,$2);
- $contents{$package}{$file} = 1;
- $found++;
+ if ($query =~ /[\/\*\\]/) {
+ next unless (eval { $file =~ /$regex/ });
+ return unless &checkEval($@);
+ } else {
+ my ($basename) = $file =~ /^.*\/(.*)$/;
+ next unless (eval { $basename =~ /$regex/ });
+ return unless &checkEval($@);
}
+ next if ($query !~ /\.\d\.gz/ and $file =~ /\/man\//);
+ next if ($front and eval { $file !~ /^\/$query/ });
+ return unless &checkEval($@);
- last if ($found > 100);
+ $contents{$package}{$file} = 1;
+ $found++;
}
close IN;
}
my $file = "$::param{tempDir}/$::who.txt";
- if (!open(OUT,">$file")) {
+ if (!open OUT, ">$file") {
&::ERROR("Debian: cannot write file for dcc send.");
return;
}
$package = "";
} else {
- &::WARN("invalid line: '$_'.");
+ chop;
+ &::WARN("debian: invalid line: '$_' (1).");
}
}
close IN;
foreach (keys %urlpackages) {
s/##DIST/$dist/g;
- if (! -f "$debian_bot/$_" ) {
+ if (! -f "$debian_dir/$_" ) {
$bad++;
next;
}
&::WARN("sD: package == NULL?");
next;
}
+
$desc{$package} = $desc;
$package = "";
+
} else {
- &::WARN("invalid line: '$_'.");
+ chop;
+ &::WARN("debian: invalid line: '$_'. (2)");
}
}
close IN;
### STATIC URL.
my %ftp = &::ftpList("llug.sep.bnl.gov", "/pub/debian/Incoming/");
- if (!open(PKG,">$pkgfile")) {
+ if (!open PKG, ">$pkgfile") {
&::ERROR("cannot write to pkg $pkgfile.");
return 0;
}
- if (!open(IDX,">$idxfile")) {
+ if (!open IDX, ">$idxfile") {
&::ERROR("cannot write to idx $idxfile.");
return 0;
}
# package line.
if (/^Package: (.*)\n$/) {
$pkg = $1;
- if ($pkg =~ /^$package$/i) {
+ if ($pkg =~ /^\Q$package\E$/i) {
$found++; # we can use pkg{'package'} instead.
$pkg{'package'} = $pkg;
}
next;
}
- open(IN,"zcat $file 2>&1 |");
+ open(IN, "zcat $file 2>&1 |");
if (! -e $file) {
&::DEBUG("deb: iS: $file does not exist.");
# Usage: &generateIndex();
sub generateIndex {
my (@dists) = @_;
- &::status("Debian: !!! generateIndex($dists[0]) called !!!");
+ &::DEBUG("D: generateIndex($dists[0]) called!");
if (!scalar @dists or $dists[0] eq '') {
&::ERROR("gI: no dists to generate index.");
return 1;
system("cp $idx $idx-old");
}
- &::DEBUG("deb: gIndex: calling DebianDownload($dist, ...).");
+ &::DEBUG("deb: gIndex: calling DebianDownload($dist, ...).") if ($debug);
&DebianDownload($dist, &fixDist($dist, %urlpackages) );
&::status("Debian: generating index for '$dist'.");
- if (!open(OUT,">$idx")) {
+ if (!open OUT, ">$idx") {
&::ERROR("cannot write to $idx.");
return 0;
}
&::DEBUG("deb: validPackage($package, $dist) called.") if ($debug);
my $error = 0;
- while (!open(IN, $debian_dir. "/Packages-$dist.idx")) {
+ while (!open IN, $debian_dir."/Packages-$dist.idx") {
if ($error) {
&::ERROR("Packages-$dist.idx does not exist (#1).");
return;
my $file = $debian_dir."/Packages-$dist.idx";
my @files;
my $error = 0;
- my $warn = 0;
-
- if ($query =~ tr/A-Z/a-z/) {
- $warn++;
- }
+ my $warn = ($query =~ tr/A-Z/a-z/) ? 1 : 0;
&::status("Debian: Search package matching '$query' in '$dist'.");
- unlink $file if ( -z $file);
+ unlink $file if ( -z $file );
- while (!open(IN, $file)) {
+ while (!open IN, $file) {
if ($dist eq "incoming") {
&::DEBUG("deb: sP: dist == incoming; calling gI().");
&generateIncoming();
}
if ($error) {
- &::ERROR("could not generate index ($file)!!!");
+ &::ERROR("could not generate index ($file)!");
return;
}
### TODO: what should we do if the sar wasn't done.
$new{$debian_dir."/".$key} = $val;
}
+
return %new;
}
sub DebianFind {
- ### H-H-H-HACK HACK HACK :)
+ # HACK! HACK! HACK!
my ($str) = @_;
my ($dist, $query) = &getDistroFromStr($str);
my @results = sort &searchPackage($str);
### TODO: remove the following loop (check if dir exists before)
while (1) {
last if (opendir(DEBIAN, $debian_dir));
+
if ($error) {
&::ERROR("dC: cannot opendir debian.");
return;
}
+
mkdir $debian_dir, 0755;
$error++;
}
}
sub searchDescFE {
- &::DEBUG("deb: FE called for searchDesc");
+# &::DEBUG("deb: FE called for searchDesc");
my ($query) = @_;
my @list = &searchDesc($query);