[Piuparts-devel] [Git][debian/piuparts][develop] packagesdb: resolve virtual packages when detecting dependency cycles

Nicolas Dandrimont (@olasd) gitlab at salsa.debian.org
Thu Oct 10 23:16:55 BST 2024



Nicolas Dandrimont pushed to branch develop at Debian / piuparts


Commits:
9907f43b by Nicolas Dandrimont at 2024-10-10T23:14:34+01:00
packagesdb: resolve virtual packages when detecting dependency cycles

The rust ecosystem currently has a dependency cycle going through 2
virtual packages. piuparts fails to schedule tests for these packages,
as well as any package that ends up depending on them, as their status
gets reported as `unknown`.

- - - - -


1 changed file:

- piupartslib/packagesdb.py


Changes:

=====================================
piupartslib/packagesdb.py
=====================================
@@ -488,7 +488,7 @@ class PackagesDB:
                 deps.append(dep)
                 dep_pkg = self.get_package(dep, recurse=True, resolve_virtual=True)
                 if dep_pkg is not None:
-                    more += dep_pkg.dependencies()
+                    more += [self._resolve_virtual(pkg) for pkg in dep_pkg.dependencies()]
         return deps
 
     def _get_dependency_cycle(self, package_name):
@@ -503,7 +503,7 @@ class PackagesDB:
                 dep_pkg = self.get_package(dep, recurse=True, resolve_virtual=True)
                 if dep_pkg is not None and package_name in self._get_recursive_dependencies(dep_pkg):
                     circular.append(dep)
-                    more += dep_pkg.dependencies()
+                    more += [self._resolve_virtual(pkg) for pkg in dep_pkg.dependencies()]
         return circular
 
     def _is_successfully_tested(self, package):
@@ -620,7 +620,8 @@ class PackagesDB:
         if package["Package"] in circular_deps:
             testable = True
             for dep, dep_state in dep_states:
-                if dep in circular_deps:
+                resolved = self._resolve_virtual(dep)
+                if resolved in circular_deps:
                     # allow any non-error dep_state on the cycle for testing
                     # (error states are handled by the error propagation above)
                     pass
@@ -779,6 +780,12 @@ class PackagesDB:
         else:
             return self._packages[package_name][header]
 
+    def _resolve_virtual(self, package_name):
+        if package_name in self._virtual_packages:
+            return self._virtual_packages[package_name][0]
+        else:
+            return package_name
+
     def get_package_state(self, package_name, resolve_virtual=True, recurse=True):
         self._compute_package_states()
         if package_name in self._package_state:
@@ -790,7 +797,7 @@ class PackagesDB:
             return self._package_state[package_name]
         if package_name in self._virtual_packages:
             if resolve_virtual:
-                provider = self._virtual_packages[package_name][0]
+                provider = self._resolve_virtual(package_name)
                 return self._package_state[provider]
             else:
                 return "virtual"



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/commit/9907f43b9ae86828fc563dd946498dea3398c571

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/commit/9907f43b9ae86828fc563dd946498dea3398c571
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20241010/255d3f3e/attachment-0001.htm>


More information about the Piuparts-devel mailing list