tags 841527 + patch thanks Hello, I tinkered with reportbug-ng a bit and it looks that this bug is caused by dpkg-query returning error when multi-arch package is queried for and more than one architecture of that package is installed.
Suggested patch attached. In long term, it should be rewritten using python-apt or something. Regards, Václav Doležal
commit 77978d0d488d7ac0db67f9a4cae65335fbf52cc6 Author: Václav Doležal <fire...@seznam.cz> Date: Sat May 13 15:30:16 2017 +0200 Use 'dpkg-query --show' when listing versions 'dpkg-query --status' fails if package has versions from multiple architectures are installed. This fixes Debian bug #841527. diff --git a/src/rnghelpers.py b/src/rnghelpers.py index e194b5b..b2ec90c 100644 --- a/src/rnghelpers.py +++ b/src/rnghelpers.py @@ -436,20 +436,12 @@ def getInstalledPackageVersions(packages): packagestring += " "+i result[i] = "" - out = commands.getoutput("dpkg-query --status %s 2>/dev/null" % packagestring) - - packagere = re.compile("^Package:\s(.*)$", re.MULTILINE) - versionre = re.compile("^Version:\s(.*)$", re.MULTILINE) + out = commands.getoutput("dpkg-query --show --showformat '${Package} ${version}\n' %s 2>/dev/null" % packagestring) for line in out.splitlines(): - pmatch = re.match(packagere, line) - vmatch = re.match(versionre, line) - - if pmatch: - package = pmatch.group(1) - if vmatch: - version = vmatch.group(1) - result[package] = version + tmp = line.split(None, 1) + if len(tmp) == 2: + result[tmp[0]] = tmp[1] return result