Add description md5sum to packages_small entries.
Use this to translate the short descriptions in
search results and dependency listings.
$subsections{$suite}{$subsection}++;
$priorities{$suite}{$data{priority}}++;
my $pkgitem = "$archive $suite $data{'architecture'} ".
- "$section $subsection $data{'priority'} $data{'version'} $sdescr\0";
+ "$section $subsection $data{'priority'} $data{'version'} $data{'description-md5'} $sdescr\0";
my $previtem = ($packages_small{$data{'package'}}{$suite}{$data{'architecture'}}
||= $pkgitem);
$packages_small{$data{'package'}}{$suite}{$data{'architecture'}} = $pkgitem
unless ($opts->{source}) {
foreach (@results) {
my ($pkg_t, $archive, $suite, $arch, $section, $subsection,
- $priority, $version, $desc) = @$_;
+ $priority, $version, $desc_md5, $desc) = @$_;
my ($pkg) = $pkg_t =~ m/^(.+)/; # untaint
if ($arch ne 'virtual') {
$sect{$pkg}{$suite}{$version} = $section;
$archives{$pkg}{$suite}{$version} ||= $archive;
- $desc{$pkg}{$suite}{$version} = $desc;
+ $desc{$pkg}{$suite}{$version} = [ $desc_md5, $desc ];
} else {
$provided_by{$pkg}{$suite} = [ split /\s+/, $desc ];
}
my @versions = version_sort keys %{$pkgs->{$suite}};
$suite{section} = $sect->{$suite}{$versions[0]};
$suite{subsection} = $subsect->{$suite}{$versions[0]};
- $suite{desc} = $desc->{$suite}{$versions[0]};
+ my $desc_md5 = $desc->{$suite}{$versions[0]}[0];
+ $suite{desc} = $desc->{$suite}{$versions[0]}[1];
$suite{versions} = [];
-
+
+ my $trans_desc = $desctrans{$desc_md5};
+ my %sdescs;
+ if ($trans_desc) {
+ my %trans_desc = split /\000|\001/, $trans_desc;
+ while (my ($l, $d) = each %trans_desc) {
+ $d =~ s/\n.*//os;
+
+ $sdescs{$l} = $d;
+ }
+ $suite{trans_desc} = \%sdescs;
+ }
+
foreach my $v (@versions) {
my %version;
$version{version} = $v;
for my $entry (@results) {
debug( join(":", @$entry), 1 ) if DEBUG;
my (undef, $archive, undef, $arch, $section, $subsection,
- $priority, $version, $provided_by) = @$entry;
+ $priority, $version, undef, $provided_by) = @$entry;
if ($arch ne 'virtual') {
my %data = split /\000/, $packages_all{"$pkg $arch $version"};
my $entry = $entries{$p_name} ||
read_entry_simple( $packages, $p_name, $opts->{h_archives}, $suite);
my $short_desc = $entry->[-1];
+ my $desc_md5 = $entry->[-2];
my $arch = $entry->[3];
my $archive = $entry->[1];
my $p_suite = $entry->[2];
if ( $short_desc ) {
$rel_alt_out{desc} = $short_desc;
+ my $trans_desc = $desctrans{$desc_md5};
+ if ($trans_desc) {
+ my %trans_desc = split /\000|\001/, $trans_desc;
+ my %sdescs;
+ while (my ($l, $d) = each %trans_desc) {
+ $d =~ s/\n.*//os;
+
+ $sdescs{$l} = $d;
+ }
+ $rel_alt_out{trans_desc} = \%sdescs;
+ }
$rel_alt_out{suite} = $p_suite;
if ( $rel_out{is_old_pkgs} ) {
} elsif (defined $entry->[1]) {
# we don't deal with virtual packages here because for the
# current uses of this function this isn't needed
- my $short_desc = (read_entry_simple( $packages, $p, $opts->{h_archives}, $suite))->[-1];
+ my $data = read_entry_simple( $packages, $p, $opts->{h_archives}, $suite);
+ my ($desc_md5, $short_desc) = ($data->[-2],$data->[-1]);
if ( $short_desc ) {
- push @$list, { name => $p, desc => $short_desc, available => 1 };
+ my $trans_desc = $desctrans{$desc_md5};
+ my %sdescs;
+ if ($trans_desc) {
+ my %trans_desc = split /\000|\001/, $trans_desc;
+ while (my ($l, $d) = each %trans_desc) {
+ $d =~ s/\n.*//os;
+
+ $sdescs{$l} = $d;
+ }
+ }
+ push @$list, { name => $p, desc => $short_desc,
+ trans_desc => \%sdescs, available => 1 };
} else {
push @$list, { name => $p, desc => _g("Not available") };
}
while (my ($suite, $provides) = each %virt) {
next if $suite eq '-';
if ($opts->{h_suites}{$suite}) {
- push @$results, [ $key, "-", $suite, 'virtual', 'v', 'v', 'v', 'v',
+ push @$results, [ $key, "-", $suite, 'virtual', 'v', 'v', 'v', 'v', 'v',
$provides];
} else {
- push @$non_results, [ $key, "-", $suite, 'virtual', 'v', 'v', 'v', 'v',
+ push @$non_results, [ $key, "-", $suite, 'virtual', 'v', 'v', 'v', 'v', 'v',
$provides];
}
}
foreach (split(/\000/o, $result||'')) {
- my @data = split ( /\s/o, $_, 8 );
+ my @data = split ( /\s/o, $_, 9 );
debug( "Considering entry ".join( ':', @data), 2) if DEBUG;
if ($opts->{h_suites}{$data[1]}
&& ($opts->{h_archs}{$data[2]} || $data[2] eq 'all')
# with correctly, but it's adequate enough for now
return [ $virt{$suite} ] unless defined $result;
foreach (split /\000/o, $result) {
- my @data = split ( /\s/o, $_, 8 );
+ my @data = split ( /\s/o, $_, 9 );
debug( "use entry: @data", 2 ) if DEBUG && $data[1] eq $suite;
return [ $virt{$suite}, @data ] if $data[1] eq $suite;
}
[% FOREACH s IN suites;
suite = s.suite %]
<li class="[% suite %]"><a class="resultlink" href="[% make_url(pkg,'','suite',suite,'arch','','section','') %]">[% suite %]
- [%- ' (' _ suite_aliases.$suite _ ')' IF suite_aliases.$suite %]</a>[% ' (' _ s.subsection _ ')' IF s.subsection %]: [% s.desc %] [%- IF s.section != main_section %] [<strong class="pmarker">[% s.section %]</strong>][% END %]
+ [%- ' (' _ suite_aliases.$suite _ ')' IF suite_aliases.$suite %]</a>[% ' (' _ s.subsection _ ')' IF s.subsection %]: [% IF s.trans_desc.$lang; s.trans_desc.$lang | html; ELSE; s.desc | html; END %] [%- IF s.section != main_section %] [<strong class="pmarker">[% s.section %]</strong>][% END %]
[% FOREACH s.versions %]
<br>[% version %] [%- IF archive != main_archive %] [<strong class="pmarker">[% archive %]</strong>][% END %]: [% architectures.join(' ') %]
[% END %]
[%- END %]
[% END %]
-[% FOREACH providers %]
+[% FOREACH p IN providers %]
[% IF loop.first %]<div id="pdeps"><h2>[% g('Packages providing %s', pkg) %]</h2><dl>[% END %]
- <dt>[% IF available %]<a href="[% make_url(name,'','source','') %]">[% name %]</a>[% ELSE %][% name %][% END %]</dt>
- <dd>[% desc %]</dd>
+ <dt>[% IF p.available %]<a href="[% make_url(name,'','source','') %]">[% p.name %]</a>[% ELSE; p.name; END %]</dt>
+ <dd>[% IF p.trans_desc.$lang; p.trans_desc.$lang | html; ELSE; p.desc | html; END %]</dd>
[% '</dl></div>' IF loop.last %]
[% END %]
</div> <!-- pdesctab -->
[% END %]
-[% FOREACH binaries %]
+[% FOREACH b IN binaries %]
[% IF loop.first %]<div id="pbinaries">[% g('The following binary packages are built from this source package:') %]<dl>[% END %]
- <dt>[% IF available %]<a href="[% make_url(name,'','source','') %]">[% name %]</a>[% ELSE %][% name %][% END %]</dt>
- <dd>[% desc %]</dd>
+ <dt>[% IF b.available %]<a href="[% make_url(name,'','source','') %]">[% b.name %]</a>[% ELSE; b.name; END %]</dt>
+ <dd>[% IF b.trans_desc.$lang; b.trans_desc.$lang | html; ELSE; b.desc | html; END %]</dd>
[% '</dl></div>' IF loop.last %]
[% END %]
[% ' (' _ version _ ')' IF version %]
[% ' [' _ arch_str _ ']' IF arch_str %]</dt>
[%- IF !is_old_pkgs -%]
- <dd>[% desc -%]
+ <dd>[% IF trans_desc.$lang; trans_desc.$lang | html; ELSE; desc | html; END -%]
[%- IF providers.pkgs.size > 0 -%]
[% IF providers.also;
'<br>' _ g('also a virtual package provided by');