[devscripts] 02/02: dd-list: Use latest package version from a sources file

James McCoy jamessan at debian.org
Sun Oct 4 20:37:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit 98d1d88c4a0774662fa25dd7968e2b2f7d0c9555
Author: James McCoy <jamessan at debian.org>
Date:   Sun Oct 4 16:34:39 2015 -0400

    dd-list: Use latest package version from a sources file
    
    There may be multiple versions of a package in a sources file, e.g. when
    the newer version hasn't been built everywhere yet.  Using only the
    latest version ensures that maintainers that have removed themselves
    from the current version aren't included in the output.
    
    Closes: #788820
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog     |  2 ++
 scripts/dd-list.pl   | 38 +++++++++++++++++------
 test/dd-list/sources | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/test_dd-list    |  6 ++++
 4 files changed, 124 insertions(+), 10 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0962080..490bf1c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -39,6 +39,8 @@ devscripts (2.15.9) UNRELEASED; urgency=medium
       (Closes: #789579)
   * dd-list:
     + Omit information from stanzas with “Extra-Source-Only: yes”.
+    + Use only the information from the most recent version of a package
+      within each sources file.  (Closes: #788820)
 
   [ Dominique Dumont ]
   * licensecheck:
diff --git a/scripts/dd-list.pl b/scripts/dd-list.pl
index 547d71e..f5c1276 100755
--- a/scripts/dd-list.pl
+++ b/scripts/dd-list.pl
@@ -24,6 +24,7 @@ use strict;
 use warnings;
 use FileHandle;
 use Getopt::Long qw(:config gnu_getopt);
+use Dpkg::Version;
 
 my $version='###VERSION###';
 
@@ -107,6 +108,7 @@ sub parsefh
 				 map { "\Q$_\E" }
 				 keys %package_name;
     }
+    my %info;
     while (<$fh>) {
 	my ($package, $source, $binaries, $maintainer, @uploaders);
 
@@ -141,6 +143,10 @@ sub parsefh
 	    $matches =~ s/\n//g;
 	    @uploaders = split /(?<=>)\s*,\s*/, $matches;
 	}
+	my $version = '0~0~0';
+	if (/^Version:\s+(.*)$/m) {
+	    $version = $1;
+	}
 
 	if (defined $maintainer
 	    && (defined $package || defined $source || defined $binaries)) {
@@ -150,29 +156,41 @@ sub parsefh
 	    if ($check_package) {
 		my @pkgs;
 		if (@pkgs = ($binaries =~ m/$package_names/g)) {
-		    map { $package_name{$_}-- } @pkgs;
+		    $info{$source}{$version}{binaries} = [@pkgs];
 		}
 		elsif ($source !~ m/$package_names/) {
 		    next;
 		}
-		$package_name{$source}--;
-		@names = $print_binary ? @pkgs : $source;
 	    }
 	    else {
-		@names = $print_binary ? $binaries : $source;
-	    }
-	    push @{$dict{$maintainer}}, @names;
-	    if ($show_uploaders && @uploaders) {
-		foreach my $uploader (@uploaders) {
-		    push @{$dict{$uploader}}, map "$_ (U)", @names;
-		}
+		$info{$source}{$version}{binaries} = [$binaries];
 	    }
+	    $info{$source}{$version}{maintainer} = $maintainer;
+	    $info{$source}{$version}{uploaders} = [@uploaders];
 	}
 	else {
 	    warn "E: parse error in stanza $. of $fname\n";
 	    $errors=1;
 	}
     }
+
+    for my $source (keys %info) {
+	my @versions = sort map { Dpkg::Version->new($_) } keys %{$info{$source}};
+	my $version = $versions[-1];
+	my $srcinfo = $info{$source}{$version};
+	my @names;
+	if ($check_package) {
+	    $package_name{$source}--;
+	    $package_name{$_}-- for @{$srcinfo->{binaries}};
+	}
+	@names = $print_binary ? @{$srcinfo->{binaries}} : $source;
+	push @{$dict{$srcinfo->{maintainer}}}, @names;
+	if ($show_uploaders && @{$srcinfo->{uploaders}}) {
+	    foreach my $uploader (@{$srcinfo->{uploaders}}) {
+		push @{$dict{$uploader}}, map "$_ (U)", @names;
+	    }
+	}
+    }
 }
 
 if ($use_dctrl) {
diff --git a/test/dd-list/sources b/test/dd-list/sources
index 15735bf..e314539 100644
--- a/test/dd-list/sources
+++ b/test/dd-list/sources
@@ -95,3 +95,91 @@ Package-List:
 Directory: pool/main/b/bzip2
 Priority: source
 Section: utils
+
+Package: subversion
+Binary: subversion, subversion-dbg, libsvn1, libsvn-dev, libsvn-doc, libapache2-mod-svn, libapache2-svn, python-subversion, subversion-tools, libsvn-java, libsvn-perl, ruby-svn, libsvn-ruby1.8
+Version: 1.8.13-1
+Maintainer: Peter Samuelson <peter at p12n.org>
+Uploaders: Troy Heber <troyh at debian.org>, James McCoy <jamessan at debian.org>
+Build-Depends: debhelper (>= 8), libserf-dev (>= 1.2), zlib1g-dev, libapr1-dev, libaprutil1-dev, libdb5.3-dev, libsasl2-dev, apache2-dev, dh-apache2, libsqlite3-dev (>= 3.7.12), libgnome-keyring-dev, libdbus-1-dev, kdelibs5-dev, quilt, doxygen, autotools-dev, autoconf, libtool-bin, swig, python-all-dev, perl, libperl-dev, ruby, ruby-dev, default-jdk, junit
+Build-Conflicts: libsvn-dev (<< 1.8~), ruby-test-unit
+Architecture: any all
+Standards-Version: 3.9.5
+Format: 1.0
+Files:
+ 4b08c636bc2c67f22cce2f27f04e4bba 3105 subversion_1.8.13-1.dsc
+ 8065b3698d799507fb72dd7926ed32b6 9326793 subversion_1.8.13.orig.tar.gz
+ 4e2ea3b225f551ec470796203bd14803 270351 subversion_1.8.13-1.diff.gz
+Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-subversion/src/1.8.x/
+Vcs-Svn: svn://anonscm.debian.org/pkg-subversion/src/1.8.x/
+Checksums-Sha1:
+ 80a8c73f36c57d476989d949f31cf1504631e5fb 3105 subversion_1.8.13-1.dsc
+ 437cf662b7ed27d2254aa7ca334fdd74b49262ef 9326793 subversion_1.8.13.orig.tar.gz
+ be7fdefbc914b305c38698897f2d061b93942b79 270351 subversion_1.8.13-1.diff.gz
+Checksums-Sha256:
+ 26fb93f8adf42cf1bc3afae7890a4bbfff32d860dcb805eb20d8013bffe3e063 3105 subversion_1.8.13-1.dsc
+ 17e8900a877ac9f0d5ef437c20df437fec4eb2c5cb9882609d2277e2312da52c 9326793 subversion_1.8.13.orig.tar.gz
+ 7cf687a60566f4f41ea70f6e028253880ea0d2b52d6dead5ba99c9e298a8245d 270351 subversion_1.8.13-1.diff.gz
+Homepage: http://subversion.apache.org/
+Package-List: 
+ libapache2-mod-svn deb httpd optional arch=any
+ libapache2-svn deb oldlibs extra arch=all
+ libsvn-dev deb libdevel extra arch=any
+ libsvn-doc deb doc extra arch=all
+ libsvn-java deb java optional arch=any
+ libsvn-perl deb perl optional arch=any
+ libsvn-ruby1.8 deb oldlibs extra arch=all
+ libsvn1 deb libs optional arch=any
+ python-subversion deb python optional arch=any
+ ruby-svn deb ruby optional arch=any
+ subversion deb vcs optional arch=any
+ subversion-dbg deb debug extra arch=any
+ subversion-tools deb vcs extra arch=any
+Testsuite: autopkgtest
+Directory: pool/main/s/subversion
+Priority: source
+Section: vcs
+
+Package: subversion
+Binary: subversion, subversion-dbg, libsvn1, libsvn-dev, libsvn-doc, libapache2-mod-svn, libapache2-svn, python-subversion, subversion-tools, libsvn-java, libsvn-perl, ruby-svn, libsvn-ruby1.8
+Version: 1.9.2-1
+Maintainer: Peter Samuelson <peter at p12n.org>
+Uploaders: James McCoy <jamessan at debian.org>
+Build-Depends: apache2-dev (>= 2.4.16), autoconf, autotools-dev, bash-completion, debhelper (>= 8), default-jdk (>= 2:1.6) [!hurd-i386 !kfreebsd-amd64 !kfreebsd-i386 !hppa !m68k !sparc !sparc64], dh-apache2, dh-python, doxygen, junit [!hurd-i386 !kfreebsd-amd64 !kfreebsd-i386 !hppa !m68k !sparc !sparc64], kdelibs5-dev, libapr1-dev, libaprutil1-dev, libdb5.3-dev, libdbus-1-dev, libgnome-keyring-dev, libperl-dev, libsasl2-dev, libserf-dev (>= 1.3.4), libsqlite3-dev (>= 3.7.12), libtool, pe [...]
+Build-Conflicts: libsvn-dev (<< 1.9~)
+Architecture: any all
+Standards-Version: 3.9.5
+Format: 1.0
+Files:
+ ead24ca2537b45470a38ff0c568f371b 3259 subversion_1.9.2-1.dsc
+ c3f4a2d2f21c565617e97f7640c3c81d 10625378 subversion_1.9.2.orig.tar.gz
+ 939a431c1f383a8b93a38c05982c32d8 2418695 subversion_1.9.2-1.diff.gz
+Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-subversion/src/1.9.x/
+Vcs-Svn: svn://anonscm.debian.org/pkg-subversion/src/1.9.x/
+Checksums-Sha1:
+ 48a7fc952190b738f307e85fb87737f173d49dd4 3259 subversion_1.9.2-1.dsc
+ 4c57828c07d21b4777a058f0d3dc973652d18ce9 10625378 subversion_1.9.2.orig.tar.gz
+ aa869fff7dc7116fd4dafc344cd21ca52bbe00c5 2418695 subversion_1.9.2-1.diff.gz
+Checksums-Sha256:
+ 0020561afd37b3cf20661c7e5da23fde210a1cc70ddfd679604216bb0cb368e4 3259 subversion_1.9.2-1.dsc
+ 6fe6ef49114e9ca2942063e339ce886078612c4e6cc58f268a2ff4db4cf0cf19 10625378 subversion_1.9.2.orig.tar.gz
+ 8deef11131ab873821696e83a1bc2fd175773f52fb8619257073896fdb200187 2418695 subversion_1.9.2-1.diff.gz
+Homepage: http://subversion.apache.org/
+Package-List: 
+ libapache2-mod-svn deb httpd optional arch=any
+ libapache2-svn deb oldlibs extra arch=all
+ libsvn-dev deb libdevel extra arch=any
+ libsvn-doc deb doc extra arch=all
+ libsvn-java deb java optional arch=any
+ libsvn-perl deb perl optional arch=any
+ libsvn-ruby1.8 deb oldlibs extra arch=all
+ libsvn1 deb libs optional arch=any
+ python-subversion deb python optional arch=any
+ ruby-svn deb ruby optional arch=any
+ subversion deb vcs optional arch=any
+ subversion-dbg deb debug extra arch=any
+ subversion-tools deb vcs extra arch=any
+Testsuite: autopkgtest
+Directory: pool/main/s/subversion
+Priority: source
+Section: vcs
diff --git a/test/test_dd-list b/test/test_dd-list
index efca316..a92b0b7 100755
--- a/test/test_dd-list
+++ b/test/test_dd-list
@@ -36,4 +36,10 @@ testExtraSourceOnlyIgnored() {
   assertFalse 'Jorge listed as uploader' "grep -q Jorge $SHUNIT_TMPDIR/extra-source.out"
 }
 
+testUseOnlyLatestVersion() {
+  $COMMAND -s ${WORKDIR}/dd-list/sources subversion >$SHUNIT_TMPDIR/latest-version.out
+
+  assertFalse 'Troy Heber listed as uploader'  "grep -q Troy $SHUNIT_TMPDIR/latest-version.out"
+}
+
 . shunit2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list