summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-02-02 13:29:42 -0800
committerZac Medico <zmedico@gentoo.org>2011-02-02 13:29:42 -0800
commit3e343a2e66053dc6375ba7ea04c6966afef995f7 (patch)
tree4371395fecf5fdc0ba41989be040997966186895 /pym
parent6709704ffe68937e35d6e945043b5da50b5941c2 (diff)
downloadportage-3e343a2e66053dc6375ba7ea04c6966afef995f7.tar.gz
portage-3e343a2e66053dc6375ba7ea04c6966afef995f7.tar.bz2
portage-3e343a2e66053dc6375ba7ea04c6966afef995f7.zip
Make || choices independent of REQUIRED_USE.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/depgraph.py71
-rw-r--r--pym/portage/tests/resolver/test_required_use.py26
2 files changed, 60 insertions, 37 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index bcbc41dd4..957f4477f 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -197,8 +197,6 @@ class _dynamic_depgraph_config(object):
self._initially_unsatisfied_deps = []
self._ignored_deps = []
self._highest_pkg_cache = {}
-
- self._unsat_req_use = {}
self._pkg_config_issues = {}
self._needed_unstable_keywords = backtrack_parameters.needed_unstable_keywords
@@ -827,6 +825,34 @@ class depgraph(object):
raise
del e
+ # NOTE: REQUIRED_USE checks are delayed until after
+ # package selection, since want to prompt the user
+ # for USE adjustment rather than have REQUIRED_USE
+ # affect package selection and || dep choices.
+ if not pkg.built and pkg.metadata["REQUIRED_USE"] and \
+ eapi_has_required_use(pkg.metadata["EAPI"]):
+ required_use_is_sat = check_required_use(
+ pkg.metadata["REQUIRED_USE"],
+ self._pkg_use_enabled(pkg),
+ pkg.iuse.is_valid_flag)
+ if not required_use_is_sat:
+ if dep.atom is not None and dep.parent is not None:
+ self._add_parent_atom(pkg, (dep.parent, dep.atom))
+
+ if arg_atoms:
+ for parent_atom in arg_atoms:
+ parent, atom = parent_atom
+ self._add_parent_atom(pkg, parent_atom)
+
+ config_issues = \
+ self._dynamic_config._pkg_config_issues.setdefault(pkg, {})
+ parent_atoms = config_issues.setdefault("required use", set())
+ all_parent_atoms = self._dynamic_config._parent_atoms.get(pkg)
+ if all_parent_atoms is not None:
+ for parent, atom in all_parent_atoms:
+ parent_atoms.add((parent, pkg.root, atom))
+ return 0
+
if not pkg.onlydeps:
if not pkg.installed and \
"empty" not in self._dynamic_config.myparams and \
@@ -1902,14 +1928,8 @@ class depgraph(object):
self._dynamic_config._unsatisfied_deps_for_display.append(
((myroot, atom), {"myparent" : arg}))
return 0, myfavorites
- pkg = self._dynamic_config._unsat_req_use.get((myroot, atom))
- if pkg is not None:
- config_issues = \
- self._dynamic_config._pkg_config_issues.setdefault(pkg, {})
- parent_atoms = config_issues.setdefault("required use", set())
- parent_atoms.add((arg, myroot, atom))
- else:
- self._dynamic_config._missing_args.append((arg, atom))
+
+ self._dynamic_config._missing_args.append((arg, atom))
continue
if atom.cp != pkg.cp:
# For old-style virtuals, we need to repeat the
@@ -1942,12 +1962,13 @@ class depgraph(object):
if self._dynamic_config._need_restart:
pass
elif isinstance(arg, SetArg):
- sys.stderr.write(("\n\n!!! Problem resolving " + \
+ writemsg(("\n\n!!! Problem resolving " + \
"dependencies for %s from %s\n") % \
- (atom, arg.arg))
+ (atom, arg.arg), noiselevel=-1)
else:
- sys.stderr.write(("\n\n!!! Problem resolving " + \
- "dependencies for %s\n") % atom)
+ writemsg(("\n\n!!! Problem resolving " + \
+ "dependencies for %s\n") % \
+ (atom,), noiselevel=-1)
return 0, myfavorites
except portage.exception.MissingSignature as e:
@@ -3051,7 +3072,6 @@ class depgraph(object):
# represented by the found_available_arg flag.
found_available_arg = False
packages_with_invalid_use_config = []
- pkgs_with_unsat_req_use = []
for find_existing_node in True, False:
if existing_node:
break
@@ -3252,24 +3272,6 @@ class depgraph(object):
packages_with_invalid_use_config.append(pkg)
continue
- #check REQUIRED_USE constraints
- if not pkg.built and pkg.metadata["REQUIRED_USE"] and \
- eapi_has_required_use(pkg.metadata["EAPI"]):
- required_use = pkg.metadata["REQUIRED_USE"]
- use = self._pkg_use_enabled(pkg)
- try:
- required_use_is_sat = check_required_use(
- pkg.metadata["REQUIRED_USE"], use, pkg.iuse.is_valid_flag)
- except portage.exception.InvalidDependString as e:
- portage.writemsg("!!! Invalid REQUIRED_USE specified by " + \
- "'%s': %s\n" % (pkg.cpv, str(e)), noiselevel=-1)
- del e
- continue
- if not required_use_is_sat:
- packages_with_invalid_use_config.append(pkg)
- pkgs_with_unsat_req_use.append(pkg)
- continue
-
if pkg.cp == atom_cp:
if highest_version is None:
highest_version = pkg
@@ -3351,9 +3353,6 @@ class depgraph(object):
break
if not matched_packages:
- if pkgs_with_unsat_req_use:
- self._dynamic_config._unsat_req_use[(root, atom)] = \
- pkgs_with_unsat_req_use[0]
return None, None
if "--debug" in self._frozen_config.myopts:
diff --git a/pym/portage/tests/resolver/test_required_use.py b/pym/portage/tests/resolver/test_required_use.py
index 90ccb3da0..c8810faef 100644
--- a/pym/portage/tests/resolver/test_required_use.py
+++ b/pym/portage/tests/resolver/test_required_use.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -88,3 +88,27 @@ class RequiredUSETestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+ def testRequiredUseOrDeps(self):
+
+ ebuilds = {
+ "dev-libs/A-1": { "IUSE": "+x +y", "REQUIRED_USE": "^^ ( x y )", "EAPI": "4" },
+ "dev-libs/B-1": { "IUSE": "+x +y", "REQUIRED_USE": "", "EAPI": "4" },
+ "app-misc/p-1": { "RDEPEND": "|| ( =dev-libs/A-1 =dev-libs/B-1 )" },
+ }
+
+ test_cases = (
+ # This should fail and show a REQUIRED_USE error for
+ # dev-libs/A-1, since this choice it preferred.
+ ResolverPlaygroundTestCase(
+ ["=app-misc/p-1"],
+ success = False),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds)
+ 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()