# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
+use warnings;
use lib './lib';
$| = 1;
$packages_contents_lastword{$_} = "$file\0";
}
# Searches are case-insensitive
- $file =~ tr [A-Z] [a-z];
-
- print REVERSED (reverse $file)."\0".(join ":$arch\0", @packages).":$arch\n";
+ (my $nocase = $file) =~ tr [A-Z] [a-z];
+ my $case = ($nocase eq $file) ? '-' : $file;
+
+ print REVERSED (reverse $nocase)."\0".$case."\0".
+ (join ":$arch\0", @packages).":$arch\n";
}
close CONT;
rename("$DBDIR/reverse.tmp", "$DBDIR/reverse_${suite}_${arch}.txt");
rename("$filelist_db.new", $filelist_db);
- system("ln -sf $filelist_db $DBDIR/filelists_${suite}_all.db") == 0
+ system("ln", "-sf", $filelist_db, "$DBDIR/filelists_${suite}_all.db") == 0
or die "Oops";
}
}
print "Merging reverse path lists for ${suite}...\n";
- open MERGED, "sort -m $DBDIR/reverse_${suite}_*.txt |"
+ open MERGED, "-|", "sort -m $DBDIR/reverse_${suite}_*.txt"
or die "Failed to open merged list";
- open FILENAMES, "> $DBDIR/filenames_$suite.txt.new"
+ open FILENAMES, ">", "$DBDIR/filenames_$suite.txt.new"
or die "Failed to open filenames list";
tie my %reverse_path_db, "DB_File", "$DBDIR/reverse_${suite}.db.new",
O_RDWR|O_CREAT, 0666, $DB_BTREE
or die "Error creating DB: $!";
- my $lastpath = "";
- my $lastfile = "";
- my @matches = ();
+ my $lastpath = my $lastcasepath = my $lastfile = "";
+ my %matches = ();
while (<MERGED>) {
print "Doing line ".($./1000000)."M (out of approx. 16M)\n"
if $. % 1000000 == 0;
chomp;
my @line = split /\0/o, $_;
my $revpath = shift @line;
+ my $casepath = shift @line;
if ($revpath ne $lastpath) {
# Wrap: Do useful stuff with this ($lastpath, @matches)
- $reverse_path_db{$lastpath} = join "\0", @matches if $lastpath ne "";
+ if ($lastpath ne "") {
+ my @matches;
+ while (my ($k, $v) = each %matches) {
+ push @matches, join("\0", $k, @$v);
+ }
+ $reverse_path_db{$lastpath} = join "\1", @matches;
+ %matches = ();
+ }
$lastpath =~ s,/.*,,o;
if ($lastfile ne $lastpath) {
$lastfile = $lastpath;
}
#
$lastpath = $revpath;
- @matches = @line;
+ $lastcasepath = $casepath;
+ $matches{$casepath} = \@line;
next;
+# } elsif ($lastcasepath ne "" and $casepath ne $lastcasepath) {
+# warn reverse($revpath)." has more than one casepath: $casepath $lastcasepath\n";
}
- push @matches, @line
- }
+ push @{$matches{$casepath}}, @line;
+ }
# Note: do useful stuff here too, for out last entry. Maybe prevent this by
# adding a fake ultimate entry?
- $reverse_path_db{$lastpath} = join "\0", @matches;
-
+ {
+ my @matches;
+ while (my ($k, $v) = each %matches) {
+ push @matches, join("\0", $k, @$v);
+ }
+ $reverse_path_db{$lastpath} = join "\1", @matches;
+ }
+
untie %reverse_path_db;
close FILENAMES;
close MERGED;
# Test whether all required packages are installed and generate a mail
# if they aren't, so that the admin is informed.
-required="subversion gettext locales rsync dpkg-dev procmail"
+required="git-core gettext locales rsync dpkg-dev procmail"
required="$required libcompress-zlib-perl"
required="$required libhtml-parser-perl libio-stringy-perl"
required="$required liblocale-gettext-perl libmldbm-perl"
return $mime_types{$_[0]} || $_[1] || 'text/html';
}
-our (@fatal_errors, @errors, @debug, @msgs, @hints, @notes);
+our (@fatal_errors, @errors, @debug, @hints);
our $http_code;
sub reset {
- @fatal_errors = @errors = @debug = @msgs = @hints = @notes = ();
+ @fatal_errors = @errors = @debug = @hints = ();
$http_code = 200;
}
my $lvl = $_[1] || 0;
push(@debug, $_[0]) if $debug > $lvl;
}
-sub msg {
- push @msgs, $_[0];
-}
-sub note {
- push @notes, [ @_ ];
-}
sub get_errors { (@fatal_errors, @errors) }
sub get_debug {
return unless $debug && @debug;
return @debug;
}
-sub get_msgs { @msgs };
sub get_hints { @hints };
-sub get_notes { @notes };
sub get_all_messages {
return {
errors => [ @fatal_errors, @errors ],
debugs => $debug ? \@debug : [],
- msgs => \@msgs,
hints => \@hints,
- notes => \@notes,
};
}
foreach my $param ( keys %params ) {
- debug( "Param <strong>$param</strong>", 2 ) if DEBUG;
+ debug( "Param $param", 2 ) if DEBUG;
my $p_value_orig = $cgi->param($param);
last unless index($key, $kw) == 0;
debug( "found $key", 2 ) if DEBUG;
- my @hits = split /\0/o, $value;
- push @$results, [ scalar reverse($key), @hits ];
+ my @files = split /\001/o, $value;
+ foreach my $f (@files) {
+ my @hits = split /\0/o, $f;
+ my $file = shift @hits;
+ if ($file eq '-') {
+ $file = reverse($key);
+ }
+ push @$results, [ $file, @hits ];
+ }
last if ($$nres)++ > 100;
}
use Packages::Config qw( $DBDIR @SUITES @ARCHIVES @SECTIONS
@ARCHITECTURES %FTP_SITES @DDTP_LANGUAGES);
use Packages::I18N::Locale;
-use Packages::CGI qw( :DEFAULT make_url make_search_url note );
+use Packages::CGI qw( :DEFAULT make_url make_search_url );
use Packages::DB;
use Packages::Search qw( :all );
use Packages::Page ();
}
unless (@results || @non_results ) {
- fatal_error( _g( "No such package." )."<br>".
- sprintf( _g( '<a href="%s">Search for the package</a>' ), make_search_url('','keywords='.uri_escape($pkg)) ) );
+ fatal_error( _g( "No such package.") );
+ #sprintf( _g( '<a href="%s">Search for the package</a>' ), make_search_url('','keywords='.uri_escape($pkg)) ) );
} else {
my %all_suites;
foreach (@results, @non_results) {
-.oldstable-volatile, .oldstable-backports, .etch-m68k, .stable-backports {
+.sarge-volatile, .sarge-backports, .etch-m68k, .etch-backports {
font-size: smaller;
}
margin: 0;
clear: both;
}
-.pnotes {
- margin: .2em;
- padding: .5em;
- border: solid thin black;
- background-color: #bdf;
- clear: both;
-}
-.pnotes h2 {
- color: red;
-}
.pconstantnag {
max-width: 60em;
border: dotted thin red;
<p>[% hint | html %]</p>
[% '</div>' IF loop.last -%]
[% END -%]
-[%- FOREACH msg IN msgs %]
-[%- '<div class="pmsgs">' IF loop.first %]
- <p>[% msg | html %]</p>
-[% '</div>' IF loop.last -%]
-[% END -%]
-[%- FOREACH note IN notes %]
-[%- '<div class="pnotes">' IF loop.first %]
-[%- IF note.1 %]
- <h2>[% note.0 | html %]</h2>
- <p>[% note.1 | html %]</p>
-[% ELSE %]
- <p>[% note.0 | html %]</p>
-[% END -%]
-[% '</div>' IF loop.last -%]
-[% END -%]