From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/
Date: Tue, 26 Nov 2019 20:35:58 +0000 (UTC) [thread overview]
Message-ID: <1574800493.1b3131db0e22085dba7d0fb9fc6e5ec70c8c577d.zmedico@gentoo> (raw)
commit: 1b3131db0e22085dba7d0fb9fc6e5ec70c8c577d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 26 18:05:47 2019 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 26 20:34:53 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1b3131db
emerge --buildpkgonly: respect buildtime hard blockers
Bug: https://bugs.gentoo.org/689226
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
lib/_emerge/depgraph.py | 24 ++++++---
lib/portage/tests/resolver/test_blocker.py | 87 +++++++++++++++++++++++++++++-
2 files changed, 102 insertions(+), 9 deletions(-)
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 68b5bdb2e..1127a6234 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -2791,7 +2791,6 @@ class depgraph(object):
def _add_dep(self, dep, allow_unsatisfied=False):
debug = "--debug" in self._frozen_config.myopts
- buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts
nodeps = "--nodeps" in self._frozen_config.myopts
if dep.blocker:
@@ -2799,8 +2798,7 @@ class depgraph(object):
# blocker validation is only able to account for one package per slot.
is_slot_conflict_parent = any(dep.parent in conflict.pkgs[1:] for conflict in \
self._dynamic_config._package_tracker.slot_conflicts())
- if not buildpkgonly and \
- not nodeps and \
+ if not nodeps and \
not dep.collapsed_priority.ignored and \
not dep.collapsed_priority.optional and \
not is_slot_conflict_parent:
@@ -6805,8 +6803,7 @@ class depgraph(object):
for depclean and prune removal operations)
@type required_sets: dict
"""
- if "--buildpkgonly" in self._frozen_config.myopts or \
- "recurse" not in self._dynamic_config.myparams:
+ if "recurse" not in self._dynamic_config.myparams:
return 1
complete_if_new_use = self._dynamic_config.myparams.get(
@@ -7061,8 +7058,7 @@ class depgraph(object):
# has been called before it, by checking that it is not None.
self._dynamic_config._blocked_pkgs = digraph()
- if "--buildpkgonly" in self._frozen_config.myopts or \
- "--nodeps" in self._frozen_config.myopts:
+ if "--nodeps" in self._frozen_config.myopts:
return True
if True:
@@ -7338,6 +7334,10 @@ class depgraph(object):
# so apparently this one is unresolvable.
unresolved_blocks = True
+ if "--buildpkgonly" in self._frozen_config.myopts and not (
+ blocker.priority.buildtime and blocker.atom.blocker.overlap.forbid):
+ depends_on_order.clear()
+
# Make sure we don't unmerge any package that have been pulled
# into the graph.
if not unresolved_blocks and depends_on_order:
@@ -8292,9 +8292,17 @@ class depgraph(object):
retlist.extend(unsolvable_blockers)
retlist = tuple(retlist)
+ buildtime_blockers = []
+ if unsolvable_blockers and "--buildpkgonly" in self._frozen_config.myopts:
+ for blocker in unsolvable_blockers:
+ if blocker.priority.buildtime and blocker.atom.blocker.overlap.forbid:
+ buildtime_blockers.append(blocker)
+
if unsolvable_blockers and \
+ not buildtime_blockers and \
not self._accept_blocker_conflicts():
- self._dynamic_config._unsatisfied_blockers_for_display = unsolvable_blockers
+ self._dynamic_config._unsatisfied_blockers_for_display = (tuple(buildtime_blockers)
+ if buildtime_blockers else unsolvable_blockers)
self._dynamic_config._serialized_tasks_cache = retlist
self._dynamic_config._scheduler_graph = scheduler_graph
# Blockers don't trigger the _skip_restart flag, since
diff --git a/lib/portage/tests/resolver/test_blocker.py b/lib/portage/tests/resolver/test_blocker.py
index 94a88b8b4..6534f99e6 100644
--- a/lib/portage/tests/resolver/test_blocker.py
+++ b/lib/portage/tests/resolver/test_blocker.py
@@ -1,4 +1,4 @@
-# Copyright 2014 Gentoo Foundation
+# Copyright 2014-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -46,3 +46,88 @@ class SlotConflictWithBlockerTestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+ def testBlockerBuildpkgonly(self):
+ ebuilds = {
+ 'dev-libs/A-1': {
+ 'EAPI': '7',
+ 'DEPEND': '!!dev-libs/X'
+ },
+
+ 'dev-libs/B-1': {
+ 'EAPI': '7',
+ 'BDEPEND': '!!dev-libs/X'
+ },
+
+ 'dev-libs/C-1': {
+ 'EAPI': '7',
+ 'BDEPEND': '!dev-libs/X'
+ },
+
+ 'dev-libs/D-1': {
+ 'EAPI': '7',
+ 'DEPEND': '!dev-libs/X'
+ },
+
+ 'dev-libs/E-1': {
+ 'EAPI': '7',
+ 'RDEPEND': '!dev-libs/X !!dev-libs/X'
+ },
+
+ 'dev-libs/F-1': {
+ 'EAPI': '7',
+ 'PDEPEND': '!dev-libs/X !!dev-libs/X'
+ },
+ }
+
+ installed = {
+ 'dev-libs/X-1': {},
+ }
+
+ test_cases = (
+ ResolverPlaygroundTestCase(
+ ['dev-libs/A'],
+ success = False,
+ options = {'--buildpkgonly': True},
+ mergelist = ['dev-libs/A-1', '!!dev-libs/X']),
+
+ ResolverPlaygroundTestCase(
+ ['dev-libs/B'],
+ success = False,
+ options = {'--buildpkgonly': True},
+ mergelist = ['dev-libs/B-1', '!!dev-libs/X']),
+
+ ResolverPlaygroundTestCase(
+ ['dev-libs/C'],
+ success = True,
+ options = {'--buildpkgonly': True},
+ mergelist = ['dev-libs/C-1']),
+
+ ResolverPlaygroundTestCase(
+ ['dev-libs/D'],
+ success = True,
+ options = {'--buildpkgonly': True},
+ mergelist = ['dev-libs/D-1']),
+
+ ResolverPlaygroundTestCase(
+ ['dev-libs/E'],
+ success = True,
+ options = {'--buildpkgonly': True},
+ mergelist = ['dev-libs/E-1']),
+
+ ResolverPlaygroundTestCase(
+ ['dev-libs/F'],
+ success = True,
+ options = {'--buildpkgonly': True},
+ mergelist = ['dev-libs/F-1']),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds,
+ installed=installed, debug=False)
+ 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.debug = False
+ playground.cleanup()
next reply other threads:[~2019-11-26 20:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 20:35 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-12-06 4:06 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/_emerge/ Zac Medico
2019-12-26 23:00 Zac Medico
2020-02-15 0:58 Zac Medico
2020-03-14 20:57 Zac Medico
2020-04-12 1:52 Zac Medico
2020-08-31 6:22 Zac Medico
2020-12-02 8:32 Zac Medico
2021-01-11 7:27 Zac Medico
2023-11-25 6:30 Zac Medico
2023-11-29 19:55 Zac Medico
2023-12-26 21:05 Zac Medico
2024-01-08 8:58 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1574800493.1b3131db0e22085dba7d0fb9fc6e5ec70c8c577d.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox