my $announce = 0;
my $defaultdist = "woody";
my %dists = (
- "unstable" => "woody",
+ "unstable" => "sid",
+ "testing" => "woody, # new since 20001219.
"stable" => "potato",
"incoming" => "incoming",
+### the following don't work. too much effort to get 3 types of distros
+### to work harmoniously :-)
"slink" => "archive-2.1",
"hamm" => "archive-2.0",
"rex" => "archive-1.?",
"debian/Contents-##DIST-i386.gz" =>
"ftp://ftp.us.debian.org".
"/debian/dists/##DIST/Contents-i386.gz",
-### BROKEN!!!
-# "debian/Contents-##DIST-i386-non-US.gz" =>
-# "ftp://ftp.ca.debian.org".
-# "/debian-non-US/dists/##DIST/non-US/Contents-i386.gz",
-###
+### APPEARS TO BE FIXED?
+# => strip control chars just to be safe.
+ "debian/Contents-##DIST-i386-non-US.gz" =>
+ "ftp://ftp.ca.debian.org".
+ "/debian-non-US/dists/##DIST/non-US/Contents-i386.gz",
);
my %urlpackages = (
}
if (!&main::ftpGet($host,$path,$thisfile,$file)) {
- &main::DEBUG("deb: down: ftpGet($host,$path,$thisfile,$file) == BAD.");
+ &main::WARN("deb: down: $file == BAD.");
$bad++;
next;
}
$query =~ s/\\([\^\$])/$1/g; # hrm?
$query =~ s/^\s+|\s+$//g;
- ### EGREP DOES NOT SUPPORT THIS TYPE OF EXPRESSION!!!
-### $query =~ s/\*/\\S*/g;
- if ($query =~ /\*/) {
- &main::msg($main::who, "We don't support * yet.");
- return;
- }
if (!&main::validExec($query)) {
&main::msg($main::who, "search string looks fuzzy.");
}
# start of search.
- my $start_time = &main::gettimeofday();
+ my $start_time = &main::timeget();
my $found = 0;
my %contents;
- my $search;
+ my $grepRE;
my $front = 0;
### TODO: search properly if /usr/bin/blah is done.
if ($query =~ s/\$$//) {
&main::DEBUG("search-regex found.");
- $search = "$query\[ \t]";
+ $grepRE = "$query\[ \t]";
} elsif ($query =~ s/^\^//) {
&main::DEBUG("front marker regex found.");
$front = 1;
- $search = $query;
+ $grepRE = $query;
} else {
- $search = "$query.*\[ \t]";
+ $grepRE = "$query*\[ \t]";
}
+ ### fix up grepRE for "*".
+ $grepRE =~ s/\*/.*/g;
+
my @files;
foreach (keys %urlcontents) {
s/##DIST/$dist/g;
my $files = join(' ', @files);
- &main::status("search regex => '$search'.");
- open(IN,"zegrep -h '$search' $files |");
+ open(IN,"zegrep -h '$grepRE' $files |");
while (<IN>) {
if (/^\.?\/?(.*?)[\t\s]+(\S+)\n$/) {
my ($file,$package) = ("/".$1,$2);
$contents{$package}{$file} = 1;
$found++;
}
+
+ last if ($found > 100);
}
close IN;
return;
}
- if (! -d "Temp/") {
- mkdir("Temp",0755);
- }
-
- my $file = "temp/$main::who.txt";
+ my $file = "$main::param{tempDir}/$main::who.txt";
if (!open(OUT,">$file")) {
&main::ERROR("Debian: cannot write file for dcc send.");
return;
@list = sort { length $a <=> length $b } @list;
# show how long it took.
- my $delta_time = &main::gettimeofday() - $start_time;
+ my $delta_time = &main::timedelta($start_time);
&main::status(sprintf("Debian: %.02f sec to complete query.", $delta_time)) if ($delta_time > 0);
my $prefix = "Debian Search of '$query' ";
$query =~ s/^\s+|\s+$//g;
# start of search.
- my $start_time = &main::gettimeofday();
+ my $start_time = &main::timeget();
&main::status("Debian: starting author search.");
my $files;
my @pkg = sort keys %{$pkg{$list[0]}};
# show how long it took.
- my $delta_time = &main::gettimeofday() - $start_time;
+ my $delta_time = &main::timedelta($start_time);
&main::status(sprintf("Debian: %.02f sec to complete query.", $delta_time)) if ($delta_time > 0);
my $email = join(', ', keys %{$maint{$list[0]}});
$query =~ s/^\s+|\s+$//g;
# start of search.
- my $start_time = &main::gettimeofday();
+ my $start_time = &main::timeget();
&main::status("Debian: starting desc search.");
my $files;
}
# show how long it took.
- my $delta_time = &main::gettimeofday() - $start_time;
+ my $delta_time = &main::timedelta($start_time);
&main::status(sprintf("Debian: %.02f sec to complete query.", $delta_time)) if ($delta_time > 0);
}
close IN;
}
+ ### TODO: don't count ppl with multiple email addresses.
+
&main::performStrictReply(
"Debian Distro Stats on $dist... ".
"\002$total{'count'}\002 packages, ".
next;
}
+ if (/^woody$/i) {
+ &main::DEBUG("Copying old index of woody to -old");
+ system("cp $idx $idx-old");
+ }
+
&main::DEBUG("gIndeX: calling DebianDownload($dist, ...).");
&DebianDownload($dist, %urlpackages);
next;
}
- if (/^$package\n$/) {
+ if (/^\Q$package\E\n$/) {
push(@files,$file);
}
$count++;
my ($dist, $query) = &getDistroFromStr($_[0]);
my $file = "debian/Packages-$dist.idx";
my @files;
- my $error = 0;
+ my $error = 0;
+ my $warn = 0;
+
+ if ($query =~ tr/A-Z/a-z/) {
+ $warn++;
+ }
&main::status("Debian: Search package matching '$query' in '$dist'.");
unlink $file if ( -z $file);
}
close IN;
+ if (scalar @files and $warn) {
+ &main::msg($main::who, "searching for package name should be fully lowercase!");
+ }
+
return @files;
}