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

lintian: r1243 - in trunk: debian lib reporting reporting/templates unpack



Author: rra
Date: 2008-03-04 03:14:23 +0100 (Tue, 04 Mar 2008)
New Revision: 1243

Modified:
   trunk/debian/changelog
   trunk/lib/Read_pkglists.pm
   trunk/reporting/html_reports
   trunk/reporting/templates/maintainer.tmpl
   trunk/unpack/list-srcpkg
Log:
* lib/Read_pkglists.pm:
  + [RA] Extract Uploaders from the source package list.
  + [RA] Include packages for which one is an uploader in one's
    maintainer page, marked accordingly.  (Closes: #421011)
* reporting/templates/*:
* reporting/templates/maintainer.html:
  + [RA] Include packages for which the maintainer is an uploader.
* unpack/list-srcpkg:
  + [RA] Include Uploaders in the package list.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-03-04 00:39:52 UTC (rev 1242)
+++ trunk/debian/changelog	2008-03-04 02:14:23 UTC (rev 1243)
@@ -101,6 +101,8 @@
       (Closes: #469222)
   * lib/Lintian/Data.pm:
     + [RA] New module for loading and querying lists of keywords.
+  * lib/Read_pkglists.pm:
+    + [RA] Extract Uploaders from the source package list.
   * lib/Spelling.pm:
     + [RA] Add another spelling correction.
     + [RA] Merriam-Webster and the OED have both given up on publically
@@ -108,9 +110,15 @@
 
   * reporting/html_reports:
     + [RA] Load the correct configuration file.
-  * reporting/templates:
+    + [RA] Include packages for which one is an uploader in one's
+      maintainer page, marked accordingly.  (Closes: #421011)
+  * reporting/templates/*:
     + [TK] Correct Lintian maintainers address in page footers.
+  * reporting/templates/maintainer.html:
+    + [RA] Include packages for which the maintainer is an uploader.
 
+  * unpack/list-srcpkg:
+    + [RA] Include Uploaders in the package list.
   * unpack/unpack-srcpkg-l2:
     + [RA] Don't rely on the output format of dpkg-source to learn the
       source directory and create a symlink.  Instead, tell dpkg-source to

Modified: trunk/lib/Read_pkglists.pm
===================================================================
--- trunk/lib/Read_pkglists.pm	2008-03-04 00:39:52 UTC (rev 1242)
+++ trunk/lib/Read_pkglists.pm	2008-03-04 02:14:23 UTC (rev 1243)
@@ -29,7 +29,7 @@
 # these banner lines have to be changed with every incompatible change of the
 # binary and source list file formats
 $BINLIST_FORMAT = "Lintian's list of binary packages in the archive--V2";
-$SRCLIST_FORMAT = "Lintian's list of source packages in the archive--V2";
+$SRCLIST_FORMAT = "Lintian's list of source packages in the archive--V3";
 $UDEBLIST_FORMAT = "Lintian's list of udeb packages in the archive--V1";
 
 %source_info = ();
@@ -64,7 +64,7 @@
   while (<IN>) {
     chop;
     next if /^\s*$/o;
-    my ($src,$ver,$maint,$arch,$std,$bin,$files,$file,$timestamp) = split(/\;/,$_);
+    my ($src,$ver,$maint,$uploaders,$arch,$std,$bin,$files,$file,$timestamp) = split(/\;/,$_);
 
     my $src_struct;
     %$src_struct =
@@ -72,6 +72,7 @@
        'source' => $src,
        'version' => $ver,
        'maintainer' => $maint,
+       'uploaders' => $uploaders,
        'architecture' => $arch,
        'standards-version' => $std,
        'binary' => $bin,
@@ -190,3 +191,9 @@
 }
 
 1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 2
+# End:
+# vim: syntax=perl sw=2 sts=2 ts=2 et shiftround

Modified: trunk/reporting/html_reports
===================================================================
--- trunk/reporting/html_reports	2008-03-04 00:39:52 UTC (rev 1242)
+++ trunk/reporting/html_reports	2008-03-04 02:14:23 UTC (rev 1243)
@@ -139,9 +139,12 @@
 #
 # and then stored under the key 'Russ Allbery <rra@debian.org>'
 #
+# %by_uploader holds the same thing except for packages for which the person
+# is only an uploader.
+#
 # %by_tag is a hash of tag names to an anonymous array of tag information
 # hashes just like the inside-most data structure above.
-my (%by_maint, %by_tag);
+my (%by_maint, %by_uploader, %by_tag);
 
 # We take a lintian log file on either standard input or as the first
 # argument.  This log file contains all the tags lintian found, plus N: tags
@@ -153,7 +156,7 @@
 # each other's pages.  If we find two maintainers who map to the same URL,
 # just assume that the second maintainer is the same as the first (but warn
 # about it).
-my (%seen, %urlmap, %warned);
+my (%seen, %saw_maintainer);
 while (<>) {
     chomp;
     next unless /^([EWIXO]): (\S+)(?: (\S+))?: (\S+)(?:\s+(.*))?/;
@@ -179,12 +182,13 @@
     # to be no source package in the archive.  Determine the maintainer and
     # version.  Work around a missing source package by pulling information
     # from a binary package or udeb of the same name if there is any.
-    my ($source, $version, $maintainer);
+    my ($source, $version, $maintainer, $uploaders);
     if ($type eq 'source') {
         $source = $package;
         if (exists $source_info{$source}) {
             $version = $source_info{$source}->{version};
             $maintainer = $source_info{$source}->{maintainer};
+            $uploaders = $source_info{$source}->{uploaders};
         } else {
             warn "source package $package not listed!\n";
         }
@@ -192,6 +196,7 @@
         $source = $bin_src_ref{$package};
         if ($source and exists $source_info{$source}) {
             $maintainer = $source_info{$source}->{maintainer};
+            $uploaders = $source_info{$source}->{uploaders};
         } else {
             warn "source for package $package not found!\n";
             $source = $package;
@@ -210,18 +215,10 @@
     $maintainer ||= '(unknown)';
     $version ||= 'unknown';
 
-    # Check if we've seen the URL for this maintainer before.
-    my $url = maintainer_url ($maintainer);
-    if ($urlmap{$url} && $urlmap{$url} ne $maintainer) {
-        warn "$maintainer has the same page as $urlmap{$url}\n"
-            unless ($warned{$maintainer}
-                    || lc ($maintainer) eq lc ($urlmap{$url})
-                    || $maintainer =~ /\@lists\.(alioth\.)?debian\.org>/);
-        $warned{$maintainer}++;
-        $maintainer = $urlmap{$url};
-    } else {
-        $urlmap{$url} = $maintainer;
-    }
+    # Check if we've seen the URL for this maintainer before and, if so, map
+    # them to the same person as the previous one.
+    $maintainer = map_maintainer ($maintainer);
+    $saw_maintainer{$maintainer} = 1;
 
     # Update maintainer statistics.
     $statistics{maintainers}++ unless defined $by_maint{$maintainer};
@@ -245,6 +242,19 @@
     push(@{ $by_maint{$maintainer}{$source}{$version} }, $info);
     $by_tag{$tag} ||= [];
     push(@{ $by_tag{$tag} }, $info);
+
+    # If the package had uploaders listed, also add the information to
+    # %by_uploaders (still sharing the data between hashes).
+    if ($uploaders) {
+        my @uploaders = split (/\s*,\s*/, $uploaders);
+        for (@uploaders) {
+            my $uploader = map_maintainer ($_);
+            next if $uploader eq $maintainer;
+            $saw_maintainer{$uploader} = 1;
+            $by_uploader{$uploader}{$source}{$version} ||= [];
+            push(@{ $by_uploader{$uploader}{$source}{$version} }, $info);
+        }
+    }
 }
 
 # Build a hash of all maintainers, not just those with Lintian tags.  We use
@@ -260,12 +270,19 @@
 # page that includes info, experimental, and overriden tags, and assemble the
 # maintainer index and the QA package list as we go.
 my (%qa, %maintainers, %packages);
-for my $maintainer (sort keys %by_maint) {
+my @maintainers;
+{
+    my %seen;
+    @maintainers =
+        sort grep { !$seen{$_}++ } keys (%by_maint), keys (%by_uploader);
+}
+for my $maintainer (@maintainers) {
     delete $clean{$maintainer};
 
     # For each of this maintainer's packages, add statistical information
     # about warnings and errors to the QA list and build the packages hash
-    # used for the package index.
+    # used for the package index.  We only do this for the maintainer
+    # packages, not the uploader packages, to avoid double-counting.
     my ($errors, $warnings) = (0, 0);
     for my $source (keys %{ $by_maint{$maintainer} }) {
         for my $version (keys %{ $by_maint{$maintainer}{$source} }) {
@@ -296,6 +313,7 @@
         maintainer => html_quote ($maintainer),
         name       => html_quote ($name),
         packages   => $by_maint{$maintainer},
+        uploads    => $by_uploader{$maintainer},
         timestamp  => $timestamp,
         version    => $LINTIAN_VERSION
     );
@@ -342,7 +360,7 @@
         version    => $LINTIAN_VERSION
     );
     my $id = maintainer_url ($maintainer);
-    next if $urlmap{$id};
+    next if $saw_maintainer{$id};
     output_template ("maintainer/$id", $templates{clean}, \%data);
     output_template ("full/$id", $templates{clean}, \%data);
 }
@@ -464,6 +482,28 @@
     }
 }
 
+# Deduplicate maintainers.  Maintains a cache of the maintainers we've seen
+# with a given e-mail address, issues a warning if two maintainers have the
+# same e-mail address, and returns the maintainer string that we should use
+# (which is whatever maintainer we saw first with that e-mail).
+{
+    my (%urlmap, %warned);
+    sub map_maintainer {
+        my ($maintainer) = @_;
+        my $url = maintainer_url ($maintainer);
+        if ($urlmap{$url} && $urlmap{$url} ne $maintainer) {
+            warn "$maintainer has the same page as $urlmap{$url}\n"
+                unless ($warned{$maintainer}
+                        || lc ($maintainer) eq lc ($urlmap{$url})
+                        || $maintainer =~ /\@lists\.(alioth\.)?debian\.org>/);
+            $warned{$maintainer}++;
+            $maintainer = $urlmap{$url};
+        } else {
+            $urlmap{$url} = $maintainer;
+        }
+    }
+}
+
 # Quote special characters for HTML output.
 sub html_quote {
     my ($text) = @_;

Modified: trunk/reporting/templates/maintainer.tmpl
===================================================================
--- trunk/reporting/templates/maintainer.tmpl	2008-03-04 00:39:52 UTC (rev 1242)
+++ trunk/reporting/templates/maintainer.tmpl	2008-03-04 02:14:23 UTC (rev 1243)
@@ -39,23 +39,31 @@
     # We get a hash of package names to a hash of versions to a list of
     # tags.  Create a description list with the package information as the
     # title and the tags as the value.
-    for my $source (sort keys %packages) {
-        my $anchored;
-        for my $version (sort keys %{ $packages{$source} }) {
-            my $tags = $packages{$source}{$version};
+    for my $source (sort (keys (%packages), keys (%uploads))) {
+        my ($anchored, $data, $upload);
+        if ($packages{$source}) {
+            $data = $packages{$source};
+        } else {
+            $data = $uploads{$source};
+            $upload = 1;
+        }
+        for my $version (sort keys %$data) {
+            my $tags = $data->{$version};
             my $last = '';
             for my $info (@$tags) {
                 if ($errors) {
                     next unless $info->{code} eq 'E' or $info->{code} eq 'W';
                 }
                 unless ($last) {
-                    if ($anchored) {
+                    if ($anchored || $upload) {
                         $OUT .= qq(    <dt>);
                     } else {
                         $OUT .= qq(    <dt id="$source"><a name="$source">);
                     }
-                    $OUT .= "<strong>$source ($version)</strong>";
-                    if ($anchored) {
+                    $OUT .= "<strong>$source ($version)";
+                    $OUT .= ' (Uploader)' if $upload;
+                    $OUT .= '</strong>';
+                    if ($anchored || $upload) {
                         $OUT .= qq(</dt>\n    <dd>\n);
                     } else {
                         $OUT .= qq(</a></dt>\n    <dd>\n);

Modified: trunk/unpack/list-srcpkg
===================================================================
--- trunk/unpack/list-srcpkg	2008-03-04 00:39:52 UTC (rev 1242)
+++ trunk/unpack/list-srcpkg	2008-03-04 02:14:23 UTC (rev 1243)
@@ -96,7 +96,7 @@
   do { $line = <IN> } until ($line =~ m/^ [0-9a-f]{32} [0-9]+ (.+\.dsc)$/m);
   my $dsc_file = "$pkg_dir/$1";
   do { $line = <IN> } until ($line =~ m/^\s*$/m);
-  
+
   my @stat;
   # get timestamp...
   unless (@stat = stat "$LINTIAN_ARCHIVEDIR/$dsc_file") {
@@ -154,13 +154,14 @@
   }
 
   # write entry to output file
-  for (qw/version maintainer architecture standards-version binary files/) {
-    $data->{$_} =~ tr/;\n/__/;
+  for (qw/version maintainer uploaders architecture standards-version binary files/) {
+    $data->{$_} =~ tr/;\n/_ / if $data->{$_};
   }
   print OUT join(';',
 		 $pkg,
 		 $data->{'version'},
 		 $data->{'maintainer'},
+                 $data->{'uploaders'} || '';
                  $data->{'architecture'},
                  $data->{'standards-version'},
                  $data->{'binary'},
@@ -187,3 +188,9 @@
 }
 
 exit 0;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 2
+# End:
+# vim: syntax=perl sw=2 sts=2 ts=2 et shiftround


Reply to: