From: Jeroen van Wolffelaar Date: Wed, 22 Feb 2006 02:27:38 +0000 (+0000) Subject: Move version info to arch table (only when there are actually multiple X-Git-Tag: switch-to-templates~75 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=eb5c6135119af5de93a6d00ade6618676b767a2f;p=deb%2Fpackages.git Move version info to arch table (only when there are actually multiple versions), making looks at the top a bit more clearer --- diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm index 3070f1b..6efef58 100644 --- a/lib/Packages/DoShow.pm +++ b/lib/Packages/DoShow.pm @@ -125,13 +125,13 @@ sub do_show { my $std = timediff($st1, $st0); debug( "Data search and merging took ".timestr($std) ); - my ($v_str, $v_str_arch, $v_str_arr) = $page->get_version_string(); my $did = $page->get_newest( 'description' ); $section = $page->get_newest( 'section' ); $subsection = $page->get_newest( 'subsection' ); my $filenames = $page->get_arch_field( 'filename' ); my $file_md5sums = $page->get_arch_field( 'md5sum' ); my $archives = $page->get_arch_field( 'archive' ); + my $versions = $page->get_arch_field( 'version' ); my $sizes_inst = $page->get_arch_field( 'installed-size' ); my $sizes_deb = $page->get_arch_field( 'size' ); my @archs = sort $page->get_architectures; @@ -161,6 +161,9 @@ sub do_show { $subsection ], ); + my $v_str = $version; + my $multiple_versions = grep { $_ ne $version } values %$versions; + $v_str .= " (and others)" if $multiple_versions; my $title .= sprintf( _g( "Package: %s (%s)" ), $pkg, $v_str ); $title .= " ".marker( $archive ) if $archive ne 'us'; $title .= " ".marker( $subsection ) if $subsection eq 'non-US' @@ -168,8 +171,6 @@ sub do_show { $title .= " ".marker( $section ) if $section ne 'main'; $package_page .= title( $title ); - $package_page .= "

"._g( "Versions:" )." $v_str_arch

\n" - unless $version eq $v_str; if (my $provided_by = $page->{provided_by}) { note( _g( "This is also a virtual package provided by ").join( ', ', map { "$_" } @$provided_by) ); } @@ -225,11 +226,16 @@ sub do_show { $package_page .= "\n"; $package_page .= "\n"; $package_page .= "\n"; - $package_page .= "\n"; + $package_page .= ""; + $package_page .= "" + if $multiple_versions; + $package_page .= "\n"; foreach my $a ( @archs ) { $package_page .= "\n"; $package_page .= "\n"; + $package_page .= "" + if $multiple_versions; $package_page .= "
"._g("Download for all available architectures")."
"._g("Architecture").""._g("Files").""._g( "Package Size").""._g("Installed Size")."
"._g("Architecture").""._g("Version").""._g("Files").""._g( "Package Size").""._g("Installed Size")."
$a".$versions->{$a}.""; if ( $suite ne "experimental" ) { $package_page .= sprintf( "["._g( "list of files" )."]\n", @@ -296,7 +302,6 @@ sub do_show { my $std = timediff($st1, $st0); debug( "Data search and merging took ".timestr($std) ); - my ($v_str, $v_str_arr) = $page->get_version_string(); $archive = $page->get_newest( 'archive' ); $section = $page->get_newest( 'section' ); $subsection = $page->get_newest( 'subsection' ); @@ -312,7 +317,7 @@ sub do_show { ); my $title .= sprintf( _g( "Source Package: %s (%s)" ), - $pkg, $v_str ); + $pkg, $version ); $title .= " ".marker( $archive ) if $archive ne 'us'; $title .= " ".marker( $subsection ) if $subsection eq 'non-US' and $archive ne 'non-US'; # non-US/security diff --git a/lib/Packages/Page.pm b/lib/Packages/Page.pm index 201408f..c2aff05 100644 --- a/lib/Packages/Page.pm +++ b/lib/Packages/Page.pm @@ -212,42 +212,6 @@ sub get_arch_field { return \%result; } -sub get_versions { - my ($self) = @_; - - my %versions; - foreach (keys %{$self->{versions}}) { - my $version = $self->{versions}{$_}{version}; - $versions{$version} ||= []; - push @{$versions{$version}}, $_; - } - - return \%versions; -} - -sub get_version_string { - my ($self) = @_; - - my $versions = $self->get_versions; - my @versions = version_sort keys %$versions; - my (@v_str, $v_str, $v_str_arch); - if ( scalar @versions == 1 ) { - @v_str = ( [ $versions[0], undef ] ); - $v_str = $versions[0]; - $v_str_arch = $versions[0]; - } else { - my @v_str_arch; - foreach ( @versions ) { - push @v_str, [ $_, $versions->{$_} ]; - push @v_str_arch, "$_ [".join(', ', @{$versions->{$_}})."]"; - } - $v_str_arch = join( ", ", @v_str_arch ); - $v_str = join( ", ", @versions ); - } - - return ($v_str, $v_str_arch, \@v_str); -} - sub get_dep_field { my ($self, $dep_field) = @_; diff --git a/lib/Packages/SrcPage.pm b/lib/Packages/SrcPage.pm index 6d03ff2..3d513d7 100644 --- a/lib/Packages/SrcPage.pm +++ b/lib/Packages/SrcPage.pm @@ -93,20 +93,6 @@ sub get_arch_field { return $self->{data}{$field}; } -sub get_versions { - my ($self) = @_; - - return [ $self->{version} ]; -} - -sub get_version_string { - my ($self) = @_; - - my $versions = $self->get_versions; - - return ($self->{version}, $versions); -} - sub get_dep_field { my ($self, $dep_field) = @_;