# display dependencies
#
my $dep_list;
- $dep_list = print_src_deps( \%packages, $opts, $pkg,
- $page->get_dep_field('build-depends'),
- 'build-depends' );
- $dep_list .= print_src_deps( \%packages, $opts, $pkg,
- $page->get_dep_field('build-depends-indep'),
- 'build-depends-indep' );
+ $dep_list = print_deps( \%packages, $opts, $pkg,
+ $page->get_dep_field('build-depends'),
+ 'build-depends' );
+ $dep_list .= print_deps( \%packages, $opts, $pkg,
+ $page->get_dep_field('build-depends-indep'),
+ 'build-depends-indep' );
if ( $dep_list ) {
$package_page .= "<div id=\"pdeps\">\n";
sub print_deps {
my ( $packages, $opts, $pkg, $relations, $type) = @_;
my %dep_type = ('depends' => 'dep', 'recommends' => 'rec',
- 'suggests' => 'sug');
+ 'suggests' => 'sug', 'build-depends' => 'adep',
+ 'build-depends-indep' => 'idep' );
my $res = "<ul class=\"ul$dep_type{$type}\">\n";
my $first = 1;
my $suite = $opts->{suite}[0];
+ my $one_archive = @{$opts->{archive}} > 1 ? '': $opts->{archive}[0];
# use Data::Dumper;
# debug( "print_deps called:\n".Dumper( $pkg, $relations, \$type ), 3 );
my ( $p_name, $pkg_version, $arch_neg,
$arch_str, $subsection, $available ) = @$rel_alt;
- if ($arch_str) {
+ if ($arch_str ||= '') {
if ($arch_neg) {
$arch_str = " [".gettext("not")." $arch_str]";
} else {
$arch_str = " [$arch_str]";
}
}
- $pkg_version = "($pkg_version)" if $pkg_version;
+ $pkg_version = "($pkg_version)" if $pkg_version ||= '';
my @results;
my %entries;
read_entry_simple( $packages, $p_name, $opts->{h_archives}, $suite);
my $short_desc = $entry->[-1];
my $arch = $entry->[2];
+ my $archive = $entry->[0];
if ( $short_desc ) {
+ my $path = $one_archive eq $archive ? "$suite/$archive" :
+ $suite;
if ( $is_old_pkgs ) {
- push @res_pkgs, dep_item( "$ROOT/$suite/$p_name",
+ push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
$p_name, "$pkg_version$arch_str" );
} elsif ($arch eq 'virtual') {
$short_desc = "virtual package";
- push @res_pkgs, dep_item( "$ROOT/$suite/$p_name",
+ push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
$p_name, "$pkg_version$arch_str", $short_desc );
} else {
$entries{$p_name} ||= $entry;
$short_desc = encode_entities( $short_desc, "<>&\"" );
- push @res_pkgs, dep_item( "$ROOT/$suite/$p_name",
+ push @res_pkgs, dep_item( "$ROOT/$path/$p_name",
$p_name, "$pkg_version$arch_str", $short_desc );
}
} elsif ( $is_old_pkgs ) {
return $res;
} # end print_deps
-sub print_src_deps {
- my ( $packages, $opts, $pkg, $relations, $type) = @_;
- my %dep_type = ('build-depends' => 'adep', 'build-depends-indep' => 'idep' );
- my $suite = $opts->{suite}[0];
- my $res = "<ul class=\"ul$dep_type{$type}\">\n";
- foreach my $dep (@$relations) {
- my @res_pkgs;
- $res .= "<li><dl><dt><img class=\"hidecss\" src=\"$ROOT/Pics/$dep_type{$type}.gif\" alt=\"[$dep_type{$type}]\"> ";
- foreach my $or_dep ( @$dep ) {
- my $p_name = $or_dep->[0];
- my $p_version = $or_dep->[1] ? "(".encode_entities( $or_dep->[1] ).
- " $or_dep->[2]) " : "";
- my $not = gettext( "not" );
- my $arch_str = '';
- if ($or_dep->[3] && @{$or_dep->[3]}) {
- # as either all or no archs have to be prepended with
- # exlamation marks, convert the first and delete the others
- if ($or_dep->[3][0] =~ /^!/) {
- $arch_str = "$not ";
- foreach (@{$or_dep->[3]}) {
- $_ =~ s/^!//go;
- }
- }
- $arch_str = " [${arch_str}@{$or_dep->[3]}]";
- }
- my $short_desc = (read_entry_simple( $packages, $p_name, $opts->{h_archives}, $suite))->[-1];
- if ( $short_desc ) {
- $short_desc = encode_entities( $short_desc, "<>&\"" );
- push @res_pkgs, dep_item( "/$suite/$p_name", $p_name, "$p_version$arch_str", $short_desc );
- } else {
- $short_desc = gettext( "Package not available" );
- push @res_pkgs, dep_item( undef, $p_name, "$p_version$arch_str", $short_desc );
- }
- }
- $res .= "\n".join( "<dt>\n".gettext( "or" )." ", @res_pkgs )."</dl></li>\n";
- }
- if (@$relations) {
- $res .= "\n</ul>";
- } else {
- $res = "";
- }
- return $res;
-} # end print_src_deps
-
-
my $ds_begin = '<dl>';
my $ds_item_desc = '<dt>';
my $ds_item = ':</dt><dd>';
sub get_dep_field {
my ($self, $dep_field) = @_;
- return $self->{dep_fields}{$dep_field}[1];
+ my @deps;
+ foreach my $dep (@{$self->{dep_fields}{$dep_field}[1]}) {
+ my @or_deps;
+ foreach my $or_dep ( @$dep ) {
+ my $p_name = $or_dep->[0];
+ my $p_version = $or_dep->[1] ? "$or_dep->[1] $or_dep->[2]" : undef;
+ my $arch_neg;
+ my $arch_str = '';
+ if ($or_dep->[3] && @{$or_dep->[3]}) {
+ # as either all or no archs have to be prepended with
+ # exlamation marks, use the first and delete the others
+ if ($or_dep->[3][0] =~ /^!/) {
+ $arch_neg = 1;
+ foreach (@{$or_dep->[3]}) {
+ $_ =~ s/^!//go;
+ }
+ }
+ $arch_str = join(" ",sort(@{$or_dep->[3]}));
+ }
+
+ push @or_deps, [ $p_name, $p_version, $arch_neg, $arch_str ];
+ }
+ push @deps, [ 0, @or_deps ];
+ }
+ return \@deps;
}
1;