Skip to content

Commit 9e93a50

Browse files
committed
bugs: don't file a package as its own dependency
rust's bootstrap block lists its own slot first, || ( rust-bin:1.86.0 rust:1.86.0 rust-bin:1.85.1 rust:1.85.1 ) so the alternative picked for it is the package being stabilized, which then got an edge to itself and a bogus "Found cycle" that merge_cycles quietly merged away. Such a block is solved by the stabilization in flight, so drop a dependency match that is the package itself. Resolves: #208 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent bee94a8 commit 9e93a50

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎NEWS.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ pkgdev 0.2.19 (unreleased)
1111
while a new bug is filed, alongside obsoleting it or reusing it (Arthur
1212
Zamarin, #230)
1313

14+
- bugs: fix a package being filed as its own dependency, when an unsolvable
15+
``|| ( ... )`` is answered by the package's own slot (Arthur Zamarin, #208)
16+
1417
pkgdev 0.2.18 (2026-09-05)
1518
--------------------------
1619

‎src/pkgdev/scripts/pkgdev_bugs.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,12 @@ def _drop_settled(pkgset: list[package], arches: set[str], stable: bool) -> list
647647
return [pkg for pkg in pkgset if not settled.intersection(pkg.keywords)] or pkgset
648648

649649
def _find_dependencies(self, pkg: package, keywords: set[str], stable: bool = True):
650+
"""The unsolvable dependencies of ``pkg``, minus ``pkg`` itself."""
651+
for match, arches in self._unsolvable_deps(pkg, keywords, stable):
652+
if match != pkg:
653+
yield match, arches
654+
655+
def _unsolvable_deps(self, pkg: package, keywords: set[str], stable: bool = True):
650656
check = visibility.VisibilityCheck(self.options, profile_addon=self.profile_addon)
651657
# the fake pkgs fed here aren't parsed ebuild sources (no .tree), so skip the
652658
# optfeature check, which requires a tree-sitter parse tree to run

‎tests/scripts/test_pkgdev_bugs.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,21 @@ def test_deps_outside_a_group_are_kept(self, repo):
405405
assert graph._pick_alternatives(groups, "amd64", deps) == deps
406406

407407

408+
def test_own_slot_is_not_a_dependency(repo):
409+
repo.create_ebuild("dev-lang/rust-1", KEYWORDS=["amd64"], slot="1")
410+
repo.create_ebuild("dev-lang/rust-2", KEYWORDS=["~amd64"], slot="2")
411+
pkg = max(repo.itermatch(atom("=dev-lang/rust-2")))
412+
413+
graph = mk_graph(repo)
414+
graph.targets = (pkg,)
415+
graph.target_arches = {pkg: {"amd64"}}
416+
graph._unsolvable_deps = lambda p, keywords, stable=True: iter(((p, {"amd64"}),))
417+
graph.build_full_graph()
418+
419+
(node,) = graph.nodes
420+
assert node.edges == set()
421+
422+
408423
class TestSettledVersions:
409424
def _mk_pkgs(self, repo, *keywords):
410425
for i, kws in enumerate(keywords, start=1):

0 commit comments

Comments
 (0)