[Piuparts-commits] [piuparts] 10/12: lib/db: add 'outdated' state
Holger Levsen
holger at layer-acht.org
Mon Mar 13 12:39:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 26a8e1116c97e945520c8758122eff50ee31cb73
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Mar 8 08:10:07 2017 +0100
lib/db: add 'outdated' state
for packages that have a more recent version in a dependent distro
e.g. after a stable-pu upload superseded a previous stable/updates
security update
Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
debian/changelog | 3 +++
piuparts-report.py | 5 +++--
piupartslib/packagesdb.py | 12 ++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 8dfaeed..c1867b6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ piuparts (0.77) UNRELEASED; urgency=medium
* piuparts.py:
- Refactor internal handling of reference chroot state.
+ * piupartslib/packagesdb.py:
+ - Add new state "outdated" to ignore packages if a dependency distro
+ already has a newer version. (Closes: #856846)
* piuparts-slave.py:
* piuparts-analyze.py:
* piuparts-report.py:
diff --git a/piuparts-report.py b/piuparts-report.py
index 17970d9..0bf7ea3 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -558,6 +558,7 @@ def is_bad_state(state):
"unknown",
"unknown-preferred-alternative", # obsolete
"no-dependency-from-alternatives-exists", # obsolete
+ "outdated",
#"foreign:*",
"does-not-exist",
]
@@ -1241,10 +1242,10 @@ class Section:
# make graph since day 1
r('v <- t[0:nrow(t),0:nstate]')
# thanks to http://tango.freedesktop.org/Generic_Icon_Theme_Guidelines for those nice colors
- r('palsize = 13')
+ r('palsize = 14')
r('palette(c("#4e9a06", "#ef2929", "#d3d7cf", "#5c3566", "#c4a000", \
"#fce94f", "#a40000", "#888a85", "#2e3436", "#729fcf", \
- "#3465a4", "#204a87", "#555753"))')
+ "#3465a4", "#204a87", "#555753", "#ce5c00"))')
r('barplot(t(v),col = 1:palsize, \
main="Binary packages per state in ' + self._config.section + '", \
xlab="", ylab="Number of binary packages", space=0, border=NA)')
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index fb2b770..69787d3 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -276,6 +276,7 @@ class PackagesDB:
"unknown",
"unknown-preferred-alternative", # obsolete
"no-dependency-from-alternatives-exists", # obsolete
+ "outdated",
# "foreign:*", # can only happen as query result for a dependency
# "does-not-exist", # can only happen as query result for a dependency
]
@@ -467,6 +468,12 @@ class PackagesDB:
return "unknown"
def _compute_package_state(self, package):
+ # Check if dependency databases have a newer version of this package.
+ for db in self._dependency_databases:
+ v = db.get_version(package["Package"])
+ if v is not None and apt_pkg.version_compare(package["Version"], v) < 0:
+ return "outdated";
+
# First attempt to resolve (still-unresolved) multiple alternative depends
# Definitely sub-optimal, but improvement over blindly selecting first one
# Select the first alternative in the highest of the following states:
@@ -702,6 +709,11 @@ class PackagesDB:
def get_package_state(self, package_name, resolve_virtual=True, recurse=True):
self._compute_package_states()
if package_name in self._package_state:
+ if recurse and self._package_state[package_name] == "outdated":
+ for db in self._dependency_databases:
+ state = db.get_package_state(package_name, resolve_virtual=resolve_virtual, recurse=False)
+ if state not in ["does-not-exist", "outdated"]:
+ return state
return self._package_state[package_name]
if package_name in self._virtual_packages:
if resolve_virtual:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list