[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.11-18-g7ba4769



The following commit has been merged in the master branch:
commit 7ba4769de81e364e01049be135bf986201136348
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Dec 30 14:18:28 2012 +0100

    r/t/maintainer.tmpl: Support multiple versions of a source
    
    Generate versioned link anchors for all source packages listed on the
    maintainer page.  Also include an unversioned one for the first
    version of that source.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index e165e12..085ca11 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,9 @@ lintian (2.5.12) UNRELEASED; urgency=low
     + [NT] Schedule groups in chunks (default 512 per chunk).
       This makes the Lintian processes shorter and makes memory
       reclaimable sooner.  (Closes: #695839)
+  * reporting/templates/maintainer.tmpl:
+    + [NT] Properly handle multiple versions of the same source and
+      add versioned anchors to them.
 
  -- Niels Thykier <niels@thykier.net>  Thu, 13 Dec 2012 13:38:59 +0100
 
diff --git a/reporting/html_reports b/reporting/html_reports
index 02c1b40..fa232a4 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -57,6 +57,7 @@ use Lintian::Data;
 use Lintian::Internal::FrontendUtil qw(split_tag);
 use Lintian::Lab;
 use Lintian::Profile;
+use Lintian::Relation::Version qw(versions_comparator);
 use Lintian::Util qw(read_dpkg_control slurp_entire_file);
 
 my $profile = Lintian::Profile->new (undef,
@@ -702,6 +703,7 @@ sub output_template {
     my ($file, $template, $data) = @_;
     $data->{version} ||= $LINTIAN_VERSION;
     $data->{timestamp} ||= $timestamp;
+    $data->{by_version} ||= \&versions_comparator;
     $data->{head} ||= sub { $templates{head}->fill_in (HASH => { page_title => $_[0],
                                                                  path_prefix => '../' x ($_[1]||0),
                                                                  %$data }) };
diff --git a/reporting/templates/maintainer.tmpl b/reporting/templates/maintainer.tmpl
index f45fa15..8791731 100644
--- a/reporting/templates/maintainer.tmpl
+++ b/reporting/templates/maintainer.tmpl
@@ -29,25 +29,36 @@
             # Only display a link for the package if either we're
             # displaying the full report, or the package has error
             # or warning tags
-            my $interesting = 0;
+            my @interesting = ();
+            my $versions = $packages{$source} || $uploads{$source};
+
             if (!$errors) {
                 # Full report, so include the package
-                $interesting = 1;
+                @interesting = sort by_version keys %$versions
             } else {
-                my $versions = $packages{$source} || $uploads{$source};
-                VERSIONS: for my $version (sort keys %$versions) {
+                for my $version (sort by_version keys %$versions) {
                     my $tags = $versions->{$version};
                     for my $tag (@$tags) {
                         if (($tag->{code} eq 'E') or ($tag->{code} eq 'W')) {
-                            $interesting = 1;
-                            last VERSIONS;
+                            push @interesting, $version;
+                            last;
                         }
                     }
                 }
             }
 
-            if ($interesting) {
-                $OUT .= qq(      <li><a href="#$source">$source</a></li>\n);
+            if (@interesting) {
+                if (scalar @interesting > 1) {
+                    $OUT .= qq(      <li>$source<ul>\n);
+                    foreach my $version (@interesting) {
+                        $OUT .= '            ' .
+                            qq(<li><a href="#${source}_${version}">$version</a></li>\n);
+                    }
+                    $OUT .= qq(      </ul></li>\n);
+                } else {
+                    my ($version) = @interesting;
+                    $OUT .= qq(      <li><a href="#${source}_${version}">$source</a> ($version)</li>\n);
+                }
             }
         }
         $OUT .= "    </ul>\n  </div>\n";
@@ -61,13 +72,14 @@
     # the value.
     for my $source (sort (keys (%packages), keys (%uploads))) {
         my ($data, $upload);
+        my $first_version = 1;
         if ($packages{$source}) {
             $data = $packages{$source};
         } else {
             $data = $uploads{$source};
             $upload = 1;
         }
-        for my $version (sort keys %$data) {
+        for my $version (sort by_version keys %$data) {
             my $tags = $data->{$version};
             my $first = 1;
             my $binary = '';
@@ -85,9 +97,14 @@
                 $firstarea = $info->{area} unless $firstarea;
                 if ($first) {
                     $OUT .= qq(  <div class="source-header">\n);
-                    $OUT .= qq(   <h2 id="$source">);
+                    $OUT .= qq(   <h2 id="${source}_${version}">);
                     $OUT .= "$source ($version$area)";
                     $OUT .= " [Uploader]" if $upload;
+                    if ($first_version) {
+                        # Unversioned #<pkg> references just go to the first version.
+                        $first_version = 0;
+                        $OUT .= qq( <a id="${source}" />)
+                    }
                     $OUT .= "</h2>\n";
                     $OUT .= qq(   <p class="info-links">\n);
                     $OUT .= qq(    <a href="http://packages.debian.org/src:$source";>Info</a>\n);

-- 
Debian package checker


Reply to: