[Piuparts-devel] Bug#898606: piuparts: multiple conflicting versions by `apt-cache show` in piuparts-depends-dummy

Philipp Hahn hahn at univention.de
Mon May 14 07:31:44 BST 2018


Source: piuparts
Version: 0.85
Severity: normal
Tags: patch

Dear Maintainer,

we're using "piuparts" to test our own packages. It sometimes happens
that out Packages files contain multiple versions of a package. Using
`apt-cache show` list all of them leading to the situation, where the
generated "piuparts-depends-dummy" has multiple dependencies on the same
package with different versions:

  Depends: pkg (= 1), pkg (= 2)

You should use `apt-cache show --no-all-versions` which only lists the
version with the highest priority.

-- System Information:
Debian Release: 9.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de:en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
>From 71c0431c4395d8265efee551e29fae3a5635355c Mon Sep 17 00:00:00 2001
Message-Id: <71c0431c4395d8265efee551e29fae3a5635355c.1526279446.git.hahn at univention.de>
From: Philipp Hahn <hahn at univention.de>
Date: Mon, 14 May 2018 08:30:39 +0200
Subject: [PATCH] piuparts: Only depend on latest version
Organization: Univention GmbH, Bremen, Germany

It may happen that the Packages files contain multiple versions of a
package. Using `apt-cache show` list all of them leading to the
situation, where the generated "piuparts-depends-dummy" has multiple
dependencies on the same package with different versions:

  Depends: pkg (= 1), pkg (= 2)

Use `apt-cache show --no-all-versions` to only lists the version with
the highest priority.
---
 piuparts.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/piuparts.py b/piuparts.py
index 7f5c0f77..6c61b07e 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1180,7 +1180,7 @@ class Chroot:
         known_packages = []
         new_packages = []
         for name in packages:
-            (status, output) = self.run(["apt-cache", "show", name],
+            (status, output) = self.run(["apt-cache", "show", "--no-all-versions", name],
                                         ignore_errors=True)
             # apt-cache reports status for some virtual packages and packages
             # in status config-files-remaining state without installation
@@ -2292,7 +2292,7 @@ def install_purge_test(chroot, chroot_state, package_files, packages, extra_pack
         else:
             # We have package names.  Use apt to get all their control
             # information.
-            apt_cache_args = ["apt-cache", "show"]
+            apt_cache_args = ["apt-cache", "show", "--no-all-versions"]
             if os.environ["PIUPARTS_DISTRIBUTION"] in ["lenny"]:
                 # apt-cache in lenny does not accept version-qualified packages
                 apt_cache_args.extend(unqualify(packages))
-- 
2.11.0



More information about the Piuparts-devel mailing list