for my $archive (@ARCHIVES) {
for my $suite (@SUITES) {
+ my %virtual_packages = ();
print "Reading $archive/$suite...\n";
my %packages_all_db;
tie %packages_all_db, "DB_File", "$DBDIR/packages_all_$suite.db.new",
# Skip double package
next if exists($packages_all_db{"$data{'package'} $data{'architecture'} $data{'version'}"});
+ if ($data{'provides'}) {
+ foreach (split /\s*,\s*/, $data{'provides'}) {
+ $virtual_packages{$_}{$data{'package'}}++;
+ }
+ }
$package_names{$data{'package'}} = 1;
my $src = $data{'package'};
my $src_version = '';
= $data;
}
+ foreach (keys %virtual_packages) {
+ my @provided_by = keys %{$virtual_packages{$_}};
+ $packages_small{$_} .= "$archive $suite virtual - - - - @provided_by\000";
+ }
+
untie %packages_all_db;
}
}
print_hints();
print_debug();
if (@results) {
- my (%pkgs, %subsect, %sect, %desc, %binaries);
+ my (%pkgs, %subsect, %sect, %desc, %binaries, %provided_by);
unless ($opts{searchon} eq 'sourcenames') {
foreach (@results) {
$priority, $version, $desc) = @$_;
my ($pkg) = $pkg_t =~ m/^(.+)/; # untaint
- $pkgs{$pkg}{$suite}{$archive}{$version}{$arch} = 1;
- $subsect{$pkg}{$suite}{$archive}{$version} = $subsection;
- $sect{$pkg}{$suite}{$archive}{$version} = $section
- unless $section eq 'main';
-
- $desc{$pkg}{$suite}{$archive}{$version} = $desc;
+ if ($arch ne 'virtual') {
+ $pkgs{$pkg}{$suite}{$archive}{$version}{$arch} = 1;
+ $subsect{$pkg}{$suite}{$archive}{$version} = $subsection;
+ $sect{$pkg}{$suite}{$archive}{$version} = $section
+ unless $section eq 'main';
+
+ $desc{$pkg}{$suite}{$archive}{$version} = $desc;
+ } else {
+ $provided_by{$pkg}{$suite}{$archive} = [ split /\s+/, $desc ];
+ }
}
+my @pkgs = sort(keys %pkgs, keys %provided_by);
if ($opts{format} eq 'html') {
- my ($start, $end) = multipageheader( $input, scalar keys %pkgs, \%opts );
+ my ($start, $end) = multipageheader( $input, scalar @pkgs, \%opts );
my $count = 0;
- foreach my $pkg (sort keys %pkgs) {
+ foreach my $pkg (@pkgs) {
$count++;
next if $count < $start or $count > $end;
printf "<h3>Package %s</h3>\n", $pkg;
print "<ul>\n";
foreach my $suite (@SUITES) {
foreach my $archive (@ARCHIVES) {
+ my $path = $suite.(($archive ne 'us')?"/$archive":'');
if (exists $pkgs{$pkg}{$suite}{$archive}) {
my @versions = version_sort keys %{$pkgs{$pkg}{$suite}{$archive}};
my $origin_str = "";
$origin_str .= " [<span style=\"color:red\">$sect{$pkg}{$suite}{$versions[0]}</span>]";
}
printf "<li><a href=\"$ROOT/%s/%s\">%s</a> (%s): %s %s\n",
- $suite.(($archive ne 'us')?"/$archive":''), $pkg, $suite.(($archive ne 'us')?"/$archive":''), $subsect{$pkg}{$suite}{$archive}{$versions[0]},
+ $path, $pkg, $path, $subsect{$pkg}{$suite}{$archive}{$versions[0]},
$desc{$pkg}{$suite}{$archive}{$versions[0]}, $origin_str;
foreach my $v (@versions) {
printf "<br>%s: %s\n",
$v, join (" ", (sort keys %{$pkgs{$pkg}{$suite}{$archive}{$v}}) );
}
+ if (my $provided_by = $provided_by{$pkg}{$suite}{$archive}) {
+ print '<br>also provided by: ',
+ join( ', ', map { "<a href=\"$ROOT/$path/$_\">$_</a>" } @$provided_by);
+ }
print "</li>\n";
+ } elsif (my $provided_by = $provided_by{$pkg}{$suite}{$archive}) {
+ printf "<li><a href=\"$ROOT/%s/%s\">%s</a>: Virtual package<br>",
+ $path, $pkg, $path;
+ print 'provided by: ',
+ join( ', ', map { "<a href=\"$ROOT/$path/$_\">$_</a>" } @$provided_by);
}
}
}
for my $entry (@results) {
debug( join(":", @$entry), 1 );
my (undef, $archive, undef, $arch, $section, $subsection,
- $priority, $version) = @$entry;
+ $priority, $version, @provided_by) = @$entry;
- my %data = split /\000/, $packages_all{"$pkg $arch $version"};
- $data{package} = $pkg;
- $data{architecture} = $arch;
- $data{version} = $version;
- $page->merge_package(\%data) or debug( "Merging $pkg $arch $version FAILED", 2 );
+ if ($arch ne 'virtual') {
+ my %data = split /\000/, $packages_all{"$pkg $arch $version"};
+ $data{package} = $pkg;
+ $data{architecture} = $arch;
+ $data{version} = $version;
+ $page->merge_package(\%data) or debug( "Merging $pkg $arch $version FAILED", 2 );
+ } else {
+ $page->add_provided_by(\@provided_by);
+ }
}
$version = $page->{newest};
my @data = split ( /\s/o, $_, 8 );
debug( "Considering entry ".join( ':', @data), 2);
if ($opts->{h_archives}{$data[0]} && $opts->{h_suites}{$data[1]}
- && ($opts->{h_archs}{$data[2]} || $data[2] eq 'all')
- && $opts->{h_sections}{$data[3]}) {
+ && ($opts->{h_archs}{$data[2]} || $data[2] eq 'all'
+ || $data[2] eq 'virtual')
+ && ($opts->{h_sections}{$data[3]} || $data[3] eq '-')) {
debug( "Using entry ".join( ':', @data), 2);
push @$results, [ $key, @data ];
} else {