* [gentoo-portage-dev] [PATCH] dep_zapdeps: avoid use.mask/force changes (515584)
@ 2014-11-12 1:55 Zac Medico
2014-11-18 5:09 ` [gentoo-portage-dev] " Zac Medico
0 siblings, 1 reply; 4+ messages in thread
From: Zac Medico @ 2014-11-12 1:55 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
This patch causes dep_zapdeps to check which USE flags cause a match
to fail, and uses that information to prioritize choices that do not
require changes to use.mask or use.force.
X-Gentoo-Bug: 515584
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515584
---
pym/portage/dep/dep_check.py | 36 ++++++++++++++++-
pym/portage/tests/resolver/test_or_choices.py | 58 ++++++++++++++++++++++++++-
2 files changed, 91 insertions(+), 3 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 62f42ac..ccdda59 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -317,6 +317,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
priority = trees[myroot].get("priority")
graph_db = trees[myroot].get("graph_db")
graph = trees[myroot].get("graph")
+ pkg_use_enabled = trees[myroot].get("pkg_use_enabled")
want_update_pkg = trees[myroot].get("want_update_pkg")
vardb = None
if "vartree" in trees[myroot]:
@@ -349,6 +350,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
all_available = True
all_use_satisfied = True
+ all_use_unmasked = True
slot_map = {}
cp_map = {}
for atom in atoms:
@@ -369,6 +371,32 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg_use = mydbapi_match_pkgs(atom)
if not avail_pkg_use:
all_use_satisfied = False
+
+ if pkg_use_enabled is not None:
+ # Check which USE flags cause the match to fail,
+ # so we can prioritize choices that do not
+ # require changes to use.mask or use.force
+ # (see bug #515584).
+ violated_atom = atom.violated_conditionals(
+ pkg_use_enabled(avail_pkg),
+ avail_pkg.iuse.is_valid_flag)
+
+ # Note that violated_atom.use can be None here,
+ # since evaluation can collapse conditional USE
+ # deps that cause the match to fail due to
+ # missing IUSE (match uses atom.unevaluated_atom
+ # to detect such missing IUSE).
+ if violated_atom.use is not None:
+ for flag in violated_atom.use.enabled:
+ if flag in avail_pkg.use.mask:
+ all_use_unmasked = False
+ break
+ else:
+ for flag in violated_atom.use.disabled:
+ if flag in avail_pkg.use.force and \
+ flag not in avail_pkg.use.mask:
+ all_use_unmasked = False
+ break
else:
# highest (ascending order)
avail_pkg_use = avail_pkg_use[-1]
@@ -416,7 +444,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
else:
preferred_non_installed.append(this_choice)
else:
- if all_installed_slots:
+ if not all_use_unmasked:
+ other.append(this_choice)
+ elif all_installed_slots:
unsat_use_installed.append(this_choice)
else:
unsat_use_non_installed.append(this_choice)
@@ -490,7 +520,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
else:
preferred_non_installed.append(this_choice)
else:
- if all_in_graph:
+ if not all_use_unmasked:
+ other.append(this_choice)
+ elif all_in_graph:
unsat_use_in_graph.append(this_choice)
elif all_installed_slots:
unsat_use_installed.append(this_choice)
diff --git a/pym/portage/tests/resolver/test_or_choices.py b/pym/portage/tests/resolver/test_or_choices.py
index d9d14f0..bdf1f5c 100644
--- a/pym/portage/tests/resolver/test_or_choices.py
+++ b/pym/portage/tests/resolver/test_or_choices.py
@@ -1,4 +1,4 @@
-# Copyright 2013 Gentoo Foundation
+# Copyright 2013-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -205,3 +205,59 @@ class OrChoicesTestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+
+ def testUseMask(self):
+
+ profile = {
+ "use.mask":
+ (
+ "abi_ppc_32",
+ ),
+ }
+
+ ebuilds = {
+
+ "sys-libs/A-1" : {
+ "EAPI": "5",
+ "RDEPEND": "|| ( sys-libs/zlib[abi_ppc_32(-)] " + \
+ "sys-libs/zlib[abi_x86_32(-)] )"
+ },
+
+ "sys-libs/zlib-1.2.8-r1" : {
+ "EAPI": "5",
+ "IUSE": "abi_ppc_32 abi_x86_32"
+ },
+
+ "sys-libs/zlib-1.2.8" : {
+ "EAPI": "5",
+ "IUSE": ""
+ },
+ }
+
+ test_cases = (
+
+ # bug #515584: We want to prefer choices that do
+ # not require changes to use.mask or use.force.
+ # In this case, abi_ppc_32 is use.masked in the
+ # profile, so we want to avoid that choice.
+ ResolverPlaygroundTestCase(
+ ["sys-libs/A"],
+ options = {},
+ success = False,
+ use_changes = {
+ 'sys-libs/zlib-1.2.8-r1': {'abi_x86_32': True}
+ },
+ mergelist = ["sys-libs/zlib-1.2.8-r1", "sys-libs/A-1"]
+ ),
+
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds,
+ profile=profile, 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.cleanup()
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-portage-dev] Re: [PATCH] dep_zapdeps: avoid use.mask/force changes (515584)
2014-11-12 1:55 [gentoo-portage-dev] [PATCH] dep_zapdeps: avoid use.mask/force changes (515584) Zac Medico
@ 2014-11-18 5:09 ` Zac Medico
2014-11-18 6:06 ` Brian Dolbec
0 siblings, 1 reply; 4+ messages in thread
From: Zac Medico @ 2014-11-18 5:09 UTC (permalink / raw
To: gentoo-portage-dev
On 11/11/2014 05:55 PM, Zac Medico wrote:
> This patch causes dep_zapdeps to check which USE flags cause a match
> to fail, and uses that information to prioritize choices that do not
> require changes to use.mask or use.force.
>
> X-Gentoo-Bug: 515584
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515584
Any issues with this? I think this one is good to merge.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] Re: [PATCH] dep_zapdeps: avoid use.mask/force changes (515584)
2014-11-18 5:09 ` [gentoo-portage-dev] " Zac Medico
@ 2014-11-18 6:06 ` Brian Dolbec
2014-11-18 6:17 ` Brian Dolbec
0 siblings, 1 reply; 4+ messages in thread
From: Brian Dolbec @ 2014-11-18 6:06 UTC (permalink / raw
To: gentoo-portage-dev
On Mon, 17 Nov 2014 21:09:42 -0800
Zac Medico <zmedico@gentoo.org> wrote:
> On 11/11/2014 05:55 PM, Zac Medico wrote:
> > This patch causes dep_zapdeps to check which USE flags cause a match
> > to fail, and uses that information to prioritize choices that do not
> > require changes to use.mask or use.force.
> >
> > X-Gentoo-Bug: 515584
> > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515584
>
> Any issues with this? I think this one is good to merge.
I thought this was merged already... I'll recheck in the morning
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] Re: [PATCH] dep_zapdeps: avoid use.mask/force changes (515584)
2014-11-18 6:06 ` Brian Dolbec
@ 2014-11-18 6:17 ` Brian Dolbec
0 siblings, 0 replies; 4+ messages in thread
From: Brian Dolbec @ 2014-11-18 6:17 UTC (permalink / raw
To: gentoo-portage-dev
On Mon, 17 Nov 2014 22:06:41 -0800
Brian Dolbec <dolsen@gentoo.org> wrote:
> On Mon, 17 Nov 2014 21:09:42 -0800
> Zac Medico <zmedico@gentoo.org> wrote:
>
> > On 11/11/2014 05:55 PM, Zac Medico wrote:
> > > This patch causes dep_zapdeps to check which USE flags cause a
> > > match to fail, and uses that information to prioritize choices
> > > that do not require changes to use.mask or use.force.
> > >
> > > X-Gentoo-Bug: 515584
> > > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515584
> >
> > Any issues with this? I think this one is good to merge.
>
>
> I thought this was merged already... I'll recheck in the morning
>
ok, I was confusing it with:
dep_zapdeps: handle circular deps with --onlydeps
I looked it over, looks fine, I don't know all the reasoning why ;)
but your the expert in that area of code :)
merge approved :)
/me needs to loose a few projects to spend more time on portage...
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-18 6:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12 1:55 [gentoo-portage-dev] [PATCH] dep_zapdeps: avoid use.mask/force changes (515584) Zac Medico
2014-11-18 5:09 ` [gentoo-portage-dev] " Zac Medico
2014-11-18 6:06 ` Brian Dolbec
2014-11-18 6:17 ` Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox