-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emerge: Skip installed packages with emptytree in depgraph selection
Running emerge with emptytree tries to find the best match for every atom it needs to install. Sometimes the best matches would be already installed packages (with `operation=nomerge`), but these packages would be silently skipped with full emptytree installation. This change makes sure that emerge attempts to install every package. If the package has unmet requirements, emerge will complain. Bug: https://bugs.gentoo.org/651018 Signed-off-by: Gábor Oszkár Dénes <gaboroszkar@protonmail.com> Closes: #1272 Signed-off-by: Sam James <sam@gentoo.org>
- Loading branch information
1 parent
fbaaa4a
commit 92ff02b
Showing
5 changed files
with
166 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
lib/portage/tests/resolver/test_emptytree_reinstall_unsatisfiability.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# Copyright 2024 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
from portage.tests import TestCase | ||
from portage.tests.resolver.ResolverPlayground import ( | ||
ResolverPlayground, | ||
ResolverPlaygroundTestCase, | ||
) | ||
|
||
|
||
class EmptytreeReinstallUnsatisfiabilityTestCase(TestCase): | ||
def testEmptytreeReinstallUnsatisfiability(self): | ||
""" | ||
Tests to check if emerge fails and complains when --emptytree | ||
package dependency graph reinstall is unsatisfied, even if the already | ||
installed packages successfully satisfy the dependency tree. | ||
See bug #651018 where emerge silently skips package | ||
reinstalls because of unsatisfied use flag requirements. | ||
""" | ||
ebuilds = { | ||
"dev-libs/A-1": { | ||
"DEPEND": "dev-libs/B", | ||
"RDEPEND": "dev-libs/B", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/B-1": { | ||
"DEPEND": "dev-libs/C[foo]", | ||
"RDEPEND": "dev-libs/C[foo]", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/C-1": { | ||
"IUSE": "foo", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/X-1": { | ||
"DEPEND": "dev-libs/Y[-baz]", | ||
"RDEPEND": "dev-libs/Y[-baz]", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/Y-1": { | ||
"IUSE": "baz", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/Z-1": { | ||
"DEPEND": "dev-libs/W", | ||
"RDEPEND": "dev-libs/W", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/W-1": { | ||
"EAPI": "2", | ||
}, | ||
} | ||
|
||
installed = { | ||
"dev-libs/A-1": { | ||
"DEPEND": "dev-libs/B", | ||
"RDEPEND": "dev-libs/B", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/B-1": { | ||
"DEPEND": "dev-libs/C[foo]", | ||
"RDEPEND": "dev-libs/C[foo]", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/C-1": { | ||
"IUSE": "foo", | ||
"USE": "foo", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/X-1": { | ||
"DEPEND": "dev-libs/Y[-baz]", | ||
"RDEPEND": "dev-libs/Y[-baz]", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/Y-1": { | ||
"IUSE": "baz", | ||
"USE": "-baz", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/Z-1": { | ||
"DEPEND": "dev-libs/W", | ||
"RDEPEND": "dev-libs/W", | ||
"EAPI": "2", | ||
}, | ||
"dev-libs/W-1": { | ||
"EAPI": "2", | ||
}, | ||
} | ||
|
||
user_config = { | ||
"package.use": ("dev-libs/Y baz",), | ||
"package.mask": ("dev-libs/W",), | ||
} | ||
|
||
world = ["dev-libs/X"] | ||
|
||
test_cases = ( | ||
ResolverPlaygroundTestCase( | ||
["dev-libs/A"], | ||
options={"--emptytree": True}, | ||
success=False, | ||
mergelist=["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"], | ||
use_changes={"dev-libs/C-1": {"foo": True}}, | ||
), | ||
ResolverPlaygroundTestCase( | ||
["dev-libs/A"], | ||
options={"--emptytree": True, "--exclude": ["dev-libs/C"]}, | ||
success=True, | ||
mergelist=["dev-libs/B-1", "dev-libs/A-1"], | ||
), | ||
ResolverPlaygroundTestCase( | ||
["@world"], | ||
options={"--emptytree": True}, | ||
success=False, | ||
mergelist=["dev-libs/Y-1", "dev-libs/X-1"], | ||
use_changes={"dev-libs/Y-1": {"baz": False}}, | ||
), | ||
ResolverPlaygroundTestCase( | ||
["dev-libs/Z"], | ||
options={"--emptytree": True}, | ||
success=False, | ||
), | ||
) | ||
|
||
playground = ResolverPlayground( | ||
ebuilds=ebuilds, | ||
installed=installed, | ||
user_config=user_config, | ||
world=world, | ||
) | ||
try: | ||
for test_case in test_cases: | ||
playground.run_TestCase(test_case) | ||
self.assertEqual(test_case.test_success, True, test_case.fail_msg) | ||
finally: | ||
playground.cleanup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters