[Piuparts-commits] [piuparts] 01/03: lib/db: detect 'dependency-does-not-exist' state immediately

Holger Levsen holger at moszumanska.debian.org
Fri Jul 10 09:47:09 UTC 2015


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

holger pushed a commit to branch develop
in repository piuparts.

commit ad22ab85c94a4a711c0a2affef9596895e2c85db
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Jun 30 16:51:51 2015 +0200

    lib/db: detect 'dependency-does-not-exist' state immediately
    
    do not wait until an existing pass/ log gets recycled
    
    dependency versioning is still being ignored
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 debian/changelog          |  3 +++
 piupartslib/packagesdb.py | 30 +++++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f8276ed..840b13f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ piuparts (0.65) UNRELEASED; urgency=medium
     - Ensure /etc/mtab exists in the chroot.
     - Create sources.list entries for --testdebs-repo with '[ trusted=yes ]'
       to avoid needing --do-not-verify-signatures which would act globally.
+  * piupartslib/packagesdb.py:
+    - Put package in 'dependency-does-not-exist' state if a pass/ log exists
+      but a dependency has been removed from the archive since then.
   * scripts/post_distupgrade_exceptions:
     - Fix the /etc/nsswitch.conf wheezy -> jessie upgrade handling.
   * Add bug template for wheezy -> jessie -> stretch upgrades.
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 9fa5b25..bfb674c 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -429,11 +429,27 @@ class PackagesDB:
                     more += dep_pkg.dependencies()
         return circular
 
-    def _lookup_package_state(self, package):
+    def _is_successfully_tested(self, package):
+        # a pass/ log exists but no corresponding recycle/ log exists
+        if self._logdb.log_exists(package, [self._ok]):
+            if not (self._recycle_mode and self._logdb.log_exists(package, [self._recycle])):
+                return True
+        return False
+
+    def _lookup_package_state(self, package, use_cached_success):
         if self._recycle_mode and self._logdb.log_exists(package, [self._recycle]):
             return "unknown"
         if self._logdb.log_exists(package, [self._ok]):
-            return "successfully-tested"
+            success = True
+            if not use_cached_success:
+                # if a pass/ log exists but any dependency may be not
+                # trivially satisfiable do not skip dependency resolution
+                for dep in package.dependencies():
+                    if not self.get_package(dep, resolve_virtual=True):
+                        success = False
+                        break
+            if success:
+                return "successfully-tested"
         if self._logdb.log_exists(package, [self._fail] + self._morefail):
             return "failed-testing"
         if self._logdb.log_exists(package, [self._evil]):
@@ -501,6 +517,8 @@ class PackagesDB:
                 testable = False
                 break
         if testable:
+            if self._is_successfully_tested(package):
+                return "successfully-tested"
             return "waiting-to-be-tested"
 
         # treat circular-dependencies as testable (for the part of the circle)
@@ -517,6 +535,8 @@ class PackagesDB:
                     testable = False
                     break
             if testable:
+                if self._is_successfully_tested(package):
+                    return "successfully-tested"
                 return "waiting-to-be-tested"
 
         for dep, dep_state in dep_states:
@@ -525,7 +545,7 @@ class PackagesDB:
 
         return "unknown"
 
-    def _compute_package_states(self):
+    def _compute_package_states(self, use_cached_success=False):
         if self._in_state is not None:
             return
 
@@ -543,7 +563,7 @@ class PackagesDB:
         todo = []
 
         for package_name, package in self._packages.iteritems():
-            state = self._lookup_package_state(package)
+            state = self._lookup_package_state(package, use_cached_success)
             assert state in self._states
             self._package_state[package_name] = state
             if state == "unknown":
@@ -552,7 +572,7 @@ class PackagesDB:
                 self._in_state[state].append(package_name)
 
         for db in self._dependency_databases:
-            db._compute_package_states()
+            db._compute_package_states(use_cached_success=True)
 
         while todo:
             package_names = todo

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