[devscripts] 03/04: chdist: Use newest package version for comparison

James McCoy jamessan at debian.org
Sat Oct 1 02:18:17 UTC 2016


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

jamessan pushed a commit to branch master
in repository devscripts.

commit c84ed1591025e9f95dfb70bb61c12c732ac755fe
Author: James McCoy <jamessan at debian.org>
Date:   Fri Sep 30 22:09:42 2016 -0400

    chdist: Use newest package version for comparison
    
    When multiple repositories are present in one dist (e.g., stable and
    stable updates/security), there may be multiple versions of a package
    available.  Use the newest version when comparing against the other
    dist.
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog  |  3 +++
 scripts/chdist.pl | 11 +++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 8029e12..f3200d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ devscripts (2.16.8) UNRELEASED; urgency=medium
   * chdist:
     + Silence warnings about uninitialized values.  Thanks to Christoph Biedl
       for the patch.  (Closes: #838185)
+    + For compare-bin-packages, use the newest version of a package if
+      multiple versions exist.  Thanks to Christoph Biedl for the patch.
+      (Closes: #838184)
 
  -- Paul Wise <pabs at debian.org>  Sat, 27 Aug 2016 13:58:14 +0800
 
diff --git a/scripts/chdist.pl b/scripts/chdist.pl
index 3745256..f05126c 100755
--- a/scripts/chdist.pl
+++ b/scripts/chdist.pl
@@ -470,8 +470,15 @@ sub dist_compare(\@$$) {
      foreach my $file ( @files ) {
         my $parsed_file = parseFile($file);
         foreach my $package ( keys(%{$parsed_file}) ) {
-           if ( $packages{$dist}{$package} ) {
-              warn "W: Package $package is already listed for $dist. Not overriding.\n";
+           if ($packages{$dist}{$package}) {
+              my $version = $packages{$dist}{$package}{Version};
+              my $alt_ver = $parsed_file->{$package}{Version};
+              my $delta = $version && $alt_ver && version_compare($version, $alt_ver);
+              if (defined($delta) && $delta < 0) {
+                 $packages{$dist}{$package} = $parsed_file->{$package};
+              } else {
+                 warn "W: Package $package is already listed for $dist. Not overriding.\n";
+              }
            } else {
               $packages{$dist}{$package} = $parsed_file->{$package};
            }

-- 
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