* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/
@ 2018-01-21 0:22 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2018-01-21 0:22 UTC (permalink / raw
To: gentoo-commits
commit: 74d0f516a346c7fb6c52a2508ca16b8949b3b65f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 00:00:02 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 00:09:11 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=74d0f516
dep_zapdeps: exclude virtuals from new_slot_count (bug 645190)
Fix new_slot_count to exclude virtual packages, since they are considered
to have zero-cost. This solves an issue where the catalyst stage1 build
would unexpectedly pull in static-dev to satisfy virtual/dev-manager,
but eudev is the preferred choice.
Bug: https://bugs.gentoo.org/645190
Fixes: 9fdaf9bdbdf5 ("dep_check: use DNF to optimize overlapping virtual || deps (bug 632026)")
Reported-by: Ben Kohler <bkohler <AT> gmail.com>
pym/portage/dep/dep_check.py | 3 +-
.../resolver/test_virtual_minimize_children.py | 61 ++++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 7cf338819..c56f545ec 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -499,7 +499,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
cp_map[avail_pkg.cp] = avail_pkg
new_slot_count = (len(slot_map) if graph_db is None else
- sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map))
+ sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map
+ if not slot_atom.cp.startswith("virtual/")))
this_choice = _dep_choice(atoms=atoms, slot_map=slot_map,
cp_map=cp_map, all_available=all_available,
diff --git a/pym/portage/tests/resolver/test_virtual_minimize_children.py b/pym/portage/tests/resolver/test_virtual_minimize_children.py
index 6eb0409f2..287445e58 100644
--- a/pym/portage/tests/resolver/test_virtual_minimize_children.py
+++ b/pym/portage/tests/resolver/test_virtual_minimize_children.py
@@ -226,3 +226,64 @@ class VirtualMinimizeChildrenTestCase(TestCase):
finally:
playground.debug = False
playground.cleanup()
+
+ def testVirtualDevManager(self):
+ ebuilds = {
+ 'sys-fs/eudev-3.1.5': {},
+ 'sys-fs/static-dev-0.1': {},
+ 'sys-fs/udev-233': {},
+ 'virtual/dev-manager-0': {
+ 'RDEPEND': '''
+ || (
+ virtual/udev
+ sys-fs/static-dev
+ )'''
+ },
+ 'virtual/udev-0': {
+ 'RDEPEND': '''
+ || (
+ >=sys-fs/eudev-2.1.1
+ >=sys-fs/udev-217
+ )'''
+ },
+ }
+
+ test_cases = (
+ # Test bug 645190, where static-dev was pulled in instead
+ # of eudev.
+ ResolverPlaygroundTestCase(
+ [
+ 'virtual/dev-manager',
+ ],
+ success=True,
+ mergelist=(
+ 'sys-fs/eudev-3.1.5',
+ 'virtual/udev-0',
+ 'virtual/dev-manager-0',
+ ),
+ ),
+ # Test static-dev preference.
+ ResolverPlaygroundTestCase(
+ [
+ 'sys-fs/static-dev',
+ 'virtual/dev-manager',
+ ],
+ all_permutations=True,
+ success=True,
+ mergelist=(
+ 'sys-fs/static-dev-0.1',
+ 'virtual/dev-manager-0',
+ ),
+ ),
+ )
+
+ playground = ResolverPlayground(debug=False, 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.debug = False
+ playground.cleanup()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/
@ 2018-03-04 21:05 Michał Górny
0 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2018-03-04 21:05 UTC (permalink / raw
To: gentoo-commits
commit: 9ebd5865559aa17186c23c90c6a90894449dc3ac
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 26 13:09:32 2018 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar 4 21:03:52 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ebd5865
Empty || *DEPEND group no longer satisfy deps in EAPI 7
Bug: https://bugs.gentoo.org/636596
pym/portage/dep/__init__.py | 3 +++
pym/portage/tests/resolver/test_eapi.py | 9 ++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 2a081f3d8..3d4bca08f 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -562,6 +562,9 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
basestring):
if stack[level][-1] == "||" and not l:
#Optimize: || ( ) -> .
+ if not eapi_attrs.empty_groups_always_true:
+ # in EAPI 7+, we need to fail here
+ l.append((token_class or _unicode)("__const__/empty-any-of"))
stack[level].pop()
elif stack[level][-1][-1] == "?":
#The last token before the '(' that matches the current ')'
diff --git a/pym/portage/tests/resolver/test_eapi.py b/pym/portage/tests/resolver/test_eapi.py
index 525b58532..fce05890b 100644
--- a/pym/portage/tests/resolver/test_eapi.py
+++ b/pym/portage/tests/resolver/test_eapi.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -59,6 +59,10 @@ class EAPITestCase(TestCase):
"dev-libs/A-7.4": { "EAPI": "4", "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" },
"dev-libs/B-1": {"EAPI": 1, "IUSE": "+foo"},
+
+ #EAPI-7: implicit || ( ) no longer satisfies deps
+ "dev-libs/C-1": { "EAPI": "6", "IUSE": "foo", "RDEPEND": "|| ( foo? ( dev-libs/B ) )" },
+ "dev-libs/C-2": { "EAPI": "7_pre1", "IUSE": "foo", "RDEPEND": "|| ( foo? ( dev-libs/B ) )" },
}
test_cases = (
@@ -104,6 +108,9 @@ class EAPITestCase(TestCase):
ResolverPlaygroundTestCase(["=dev-libs/A-7.2"], success = False),
ResolverPlaygroundTestCase(["=dev-libs/A-7.3"], success = False),
ResolverPlaygroundTestCase(["=dev-libs/A-7.4"], success = True, mergelist = ["dev-libs/A-7.4"]),
+
+ ResolverPlaygroundTestCase(["=dev-libs/C-1"], success = True, mergelist = ["dev-libs/C-1"]),
+ ResolverPlaygroundTestCase(["=dev-libs/C-2"], success = False),
)
playground = ResolverPlayground(ebuilds=ebuilds)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/
@ 2018-01-20 23:14 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2018-01-20 23:14 UTC (permalink / raw
To: gentoo-commits
commit: e2134e9f72a86734552bb67e9414a017cfc4ea51
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 00:28:42 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 23:08:42 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e2134e9f
dep_zapdeps: prefer choices with fewer new slots (bug 645002)
Prefer choices with fewer new slots, rather than choices with the lowest
total number of slots. This fixes a case triggered by the catalyst stage1
build, where paludis was selected to satisfy perl-cleaner dependencies
because that choice happened to have a smaller number of slots:
|| (
( sys-apps/portage app-portage/portage-utils )
sys-apps/pkgcore
sys-apps/paludis
)
Bug: https://bugs.gentoo.org/645002
Fixes: 9fdaf9bdbdf5 ("dep_check: use DNF to optimize overlapping virtual || deps (bug 632026)")
Tested-by: Ben Kohler <bkohler <AT> gmail.com>
pym/portage/dep/dep_check.py | 14 ++--
.../resolver/test_virtual_minimize_children.py | 85 +++++++++++++++++++++-
2 files changed, 93 insertions(+), 6 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 291626f56..7cf338819 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2015 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -296,7 +296,7 @@ def dep_eval(deplist):
class _dep_choice(SlotObject):
__slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
- 'all_installed_slots')
+ 'all_installed_slots', 'new_slot_count')
def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
"""
@@ -498,9 +498,13 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
if current_higher or (all_match_current and not all_match_previous):
cp_map[avail_pkg.cp] = avail_pkg
+ new_slot_count = (len(slot_map) if graph_db is None else
+ sum(not graph_db.match_pkgs(slot_atom) for slot_atom in slot_map))
+
this_choice = _dep_choice(atoms=atoms, slot_map=slot_map,
cp_map=cp_map, all_available=all_available,
- all_installed_slots=False)
+ all_installed_slots=False,
+ new_slot_count=new_slot_count)
if all_available:
# The "all installed" criterion is not version or slot specific.
# If any version of a package is already in the graph then we
@@ -655,8 +659,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
if len(choices) < 2:
continue
# Prefer choices with all_installed_slots for bug #480736, and
- # choices with a smaller number of packages for bug #632026.
- choices.sort(key=lambda x: (not x.all_installed_slots, len(x.slot_map)))
+ # choices with a smaller number of new slots for bug #632026.
+ choices.sort(key=lambda x: (not x.all_installed_slots, x.new_slot_count))
for choice_1 in choices[1:]:
cps = set(choice_1.cp_map)
for choice_2 in choices:
diff --git a/pym/portage/tests/resolver/test_virtual_minimize_children.py b/pym/portage/tests/resolver/test_virtual_minimize_children.py
index 83ae34e77..6eb0409f2 100644
--- a/pym/portage/tests/resolver/test_virtual_minimize_children.py
+++ b/pym/portage/tests/resolver/test_virtual_minimize_children.py
@@ -1,4 +1,4 @@
-# Copyright 2017 Gentoo Foundation
+# Copyright 2017-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -143,3 +143,86 @@ class VirtualMinimizeChildrenTestCase(TestCase):
finally:
playground.debug = False
playground.cleanup()
+
+ def testVirtualPackageManager(self):
+ ebuilds = {
+ 'app-admin/perl-cleaner-2.25': {
+ 'RDEPEND': '''
+ || (
+ ( sys-apps/portage app-portage/portage-utils )
+ sys-apps/pkgcore
+ sys-apps/paludis
+ )'''
+ },
+ 'app-portage/portage-utils-0.64': {},
+ 'sys-apps/paludis-2.6.0': {},
+ 'sys-apps/portage-2.3.19-r1': {},
+ 'virtual/package-manager-0': {
+ 'RDEPEND': '''
+ || (
+ sys-apps/portage
+ sys-apps/paludis
+ sys-apps/pkgcore
+ )'''
+ },
+ }
+
+ test_cases = (
+ # Test bug 645002, where we want to prefer choices
+ # based on the number of new slots rather than the total
+ # number of slots. This is necessary so that perl-cleaner's
+ # deps are satisfied by the ( portage portage-utils )
+ # choice which has a larger total number of slots than the
+ # paludis choice.
+ ResolverPlaygroundTestCase(
+ [
+ 'app-admin/perl-cleaner',
+ 'virtual/package-manager',
+ 'app-portage/portage-utils',
+ ],
+ all_permutations=True,
+ success=True,
+ ambiguous_merge_order=True,
+ mergelist=(
+ (
+ 'sys-apps/portage-2.3.19-r1',
+ 'app-portage/portage-utils-0.64',
+ 'app-admin/perl-cleaner-2.25',
+ 'virtual/package-manager-0',
+ ),
+ )
+ ),
+ # Test paludis preference. In this case, if paludis is not
+ # included in the argument atoms then the result varies
+ # depending on whether the app-admin/perl-cleaner or
+ # virtual/package-manager dependencies are evaluated first!
+ # Therefore, include paludis in the argument atoms.
+ ResolverPlaygroundTestCase(
+ [
+ 'app-admin/perl-cleaner',
+ 'virtual/package-manager',
+ 'sys-apps/paludis',
+ ],
+ all_permutations=True,
+ success=True,
+ ambiguous_merge_order=True,
+ mergelist=(
+ 'sys-apps/paludis-2.6.0',
+ (
+ 'app-admin/perl-cleaner-2.25',
+ 'virtual/package-manager-0',
+ ),
+ )
+ ),
+ )
+
+ playground = ResolverPlayground(debug=False, 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.debug = False
+ playground.cleanup()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/
@ 2018-01-11 19:24 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2018-01-11 19:24 UTC (permalink / raw
To: gentoo-commits
commit: 86ba22da7a2f34848cdb5a6f1090c22c264e577e
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 9 03:34:22 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jan 11 19:23:34 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=86ba22da
dep_zapdeps: install new package, allow upgrade (bug 643974)
Prefer to install a new package in order to allow upgrade of an
installed package. This generalizes the code from bug 635540 so
that it both allows desirable upgrades and prevents unwanted
downgrades.
Fixes: 7c58e3737616 ("dep_zapdeps: install new package, avoid downgrade (bug 635540)")
Bug: https://bugs.gentoo.org/643974
Reviewed-by: Alec Warner <antarus <AT> gentoo.org>
pym/portage/dep/dep_check.py | 11 +--
.../tests/resolver/test_or_upgrade_installed.py | 101 +++++++++++++++++++++
2 files changed, 106 insertions(+), 6 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 2bb9dc339..291626f56 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -366,10 +366,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
want_update_pkg = trees[myroot].get("want_update_pkg")
downgrade_probe = trees[myroot].get("downgrade_probe")
vardb = None
- vardb_match_pkgs = None
if "vartree" in trees[myroot]:
vardb = trees[myroot]["vartree"].dbapi
- vardb_match_pkgs = getattr(vardb, 'match_pkgs', None)
if use_binaries:
mydbapi = trees[myroot]["bintree"].dbapi
else:
@@ -465,10 +463,11 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg = avail_pkg_use
avail_slot = Atom("%s:%s" % (atom.cp, avail_pkg.slot))
- if vardb_match_pkgs is not None and downgrade_probe is not None:
- inst_pkg = vardb_match_pkgs(avail_slot)
- if (inst_pkg and avail_pkg < inst_pkg[-1] and
- not downgrade_probe(inst_pkg[-1])):
+ if downgrade_probe is not None:
+ highest_in_slot = mydbapi_match_pkgs(avail_slot)
+ if (avail_pkg and highest_in_slot and
+ avail_pkg < highest_in_slot[-1] and
+ not downgrade_probe(avail_pkg)):
installed_downgrade = True
slot_map[avail_slot] = avail_pkg
diff --git a/pym/portage/tests/resolver/test_or_upgrade_installed.py b/pym/portage/tests/resolver/test_or_upgrade_installed.py
new file mode 100644
index 000000000..6e01d321d
--- /dev/null
+++ b/pym/portage/tests/resolver/test_or_upgrade_installed.py
@@ -0,0 +1,101 @@
+# Copyright 2018 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 OrUpgradeInstalledTestCase(TestCase):
+
+ def testOrUpgradeInstalled(self):
+ ebuilds = {
+ 'net-misc/foo-1': {
+ 'EAPI': '6',
+ 'RDEPEND': '|| ( sys-libs/glibc[rpc(-)] net-libs/libtirpc )'
+ },
+ 'net-libs/libtirpc-1': {
+ 'EAPI': '6',
+ },
+ 'sys-libs/glibc-2.26': {
+ 'EAPI': '6',
+ 'IUSE': ''
+ },
+ 'sys-libs/glibc-2.24': {
+ 'EAPI': '6',
+ 'IUSE': '+rpc'
+ },
+ }
+
+ installed = {
+ 'sys-libs/glibc-2.24': {
+ 'EAPI': '6',
+ 'IUSE': '+rpc',
+ 'USE': 'rpc',
+ },
+ }
+
+ world = ['sys-libs/glibc']
+
+ test_cases = (
+ # Test bug 643974, where we need to install libtirpc
+ # in order to upgrade glibc.
+ ResolverPlaygroundTestCase(
+ ['net-misc/foo', '@world'],
+ options={'--update': True, '--deep': True},
+ success=True,
+ ambiguous_merge_order=True,
+ mergelist=(
+ (
+ 'net-libs/libtirpc-1',
+ 'sys-libs/glibc-2.26',
+ 'net-misc/foo-1',
+ ),
+ )
+ ),
+ )
+
+ playground = ResolverPlayground(debug=False,
+ ebuilds=ebuilds, installed=installed, 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.debug = False
+ playground.cleanup()
+
+ # In some cases it's necessary to avoid upgrade due to
+ # the package being masked.
+ user_config = {
+ "package.mask" : (
+ ">=sys-libs/glibc-2.26",
+ ),
+ }
+
+ test_cases = (
+ ResolverPlaygroundTestCase(
+ ['net-misc/foo', '@world'],
+ options={'--update': True, '--deep': True},
+ success=True,
+ mergelist=[
+ 'net-misc/foo-1',
+ ]
+ ),
+ )
+
+ playground = ResolverPlayground(debug=False,
+ ebuilds=ebuilds, installed=installed, world=world,
+ user_config=user_config)
+
+ 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()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/
@ 2014-09-15 5:00 Brian Dolbec
0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-09-15 5:00 UTC (permalink / raw
To: gentoo-commits
commit: d1e8d3468d0cee24480f6cbe16b2ca82ec7dc9fa
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 13 00:32:53 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Sep 15 04:00:15 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d1e8d346
dep_zapdeps: fix bug #522652
For cases such as || ( X <A-2 ), where X is unsatisfiable and A-1 is
installed, fix dep_zapdeps to make the correct choice.
---
pym/portage/dep/dep_check.py | 10 ++++
pym/portage/tests/resolver/test_or_choices.py | 73 +++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 22eed96..4386b5e 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -287,6 +287,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
unsat_use_non_installed = []
other_installed = []
other_installed_some = []
+ other_installed_any_slot = []
other = []
# unsat_use_* must come after preferred_non_installed
@@ -301,6 +302,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
unsat_use_non_installed,
other_installed,
other_installed_some,
+ other_installed_any_slot,
other,
)
@@ -504,6 +506,14 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
other_installed.append(this_choice)
elif some_installed:
other_installed_some.append(this_choice)
+
+ # Use Atom(atom.cp) for a somewhat "fuzzy" match, since
+ # the whole atom may be too specific. For example, see
+ # bug #522652, where using the whole atom leads to an
+ # unsatisfiable choice.
+ elif any(vardb.match(Atom(atom.cp)) for atom in atoms
+ if not atom.blocker):
+ other_installed_any_slot.append(this_choice)
else:
other.append(this_choice)
diff --git a/pym/portage/tests/resolver/test_or_choices.py b/pym/portage/tests/resolver/test_or_choices.py
index 90e6814..d9d14f0 100644
--- a/pym/portage/tests/resolver/test_or_choices.py
+++ b/pym/portage/tests/resolver/test_or_choices.py
@@ -132,3 +132,76 @@ class OrChoicesTestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+
+ def testInitiallyUnsatisfied(self):
+
+ ebuilds = {
+
+ "app-misc/A-1" : {
+ "EAPI": "5",
+ "SLOT": "0/1"
+ },
+
+ "app-misc/A-2" : {
+ "EAPI": "5",
+ "SLOT": "0/2"
+ },
+
+ "app-misc/B-0" : {
+ "EAPI": "5",
+ "RDEPEND": "app-misc/A:="
+ },
+
+ "app-misc/C-0" : {
+ "EAPI": "5",
+ "RDEPEND": "|| ( app-misc/X <app-misc/A-2 )"
+ },
+
+ }
+
+ installed = {
+
+ "app-misc/A-1" : {
+ "EAPI": "5",
+ "SLOT": "0/1"
+ },
+
+ "app-misc/B-0" : {
+ "EAPI": "5",
+ "RDEPEND": "app-misc/A:0/1="
+ },
+
+ "app-misc/C-0" : {
+ "EAPI": "5",
+ "RDEPEND": "|| ( app-misc/X <app-misc/A-2 )"
+ },
+
+ }
+
+ world = ["app-misc/B", "app-misc/C"]
+
+ test_cases = (
+
+ # Test bug #522652, where the unsatisfiable app-misc/X
+ # atom is selected, and the dependency is placed into
+ # _initially_unsatisfied_deps where it is ignored, causing
+ # upgrade to app-misc/A-2 (breaking a dependency of
+ # app-misc/C-0).
+ ResolverPlaygroundTestCase(
+ ["app-misc/A"],
+ options = {},
+ success = True,
+ mergelist = ['app-misc/A-1']
+ ),
+
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds,
+ installed=installed, world=world, 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()
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/
@ 2013-08-22 1:34 Zac Medico
0 siblings, 0 replies; 6+ messages in thread
From: Zac Medico @ 2013-08-22 1:34 UTC (permalink / raw
To: gentoo-commits
commit: c08402d745eef26b99091f62556f48aa9b60345a
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 22 01:32:22 2013 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug 22 01:32:22 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c08402d7
dep_zapdeps: prefer all_installed_slots choices
This will fix bug #480736, by preferring libpostproc in deps like
|| ( ffmpeg:0 libpostproc ) where libpostproc is already installed and
ffmpeg:0 is not.
---
pym/portage/dep/dep_check.py | 29 +++++++++-----
pym/portage/tests/resolver/test_or_choices.py | 55 +++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 86112a2..07d6d1e 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -6,12 +6,14 @@ from __future__ import unicode_literals
__all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']
import logging
+import operator
import portage
from portage.dep import Atom, match_from_list, use_reduce
from portage.exception import InvalidDependString, ParseError
from portage.localization import _
from portage.util import writemsg, writemsg_level
+from portage.util.SlotObject import SlotObject
from portage.versions import vercmp, _pkg_str
def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
@@ -255,6 +257,10 @@ def dep_eval(deplist):
return 0
return 1
+class _dep_choice(SlotObject):
+ __slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
+ 'all_installed_slots')
+
def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
"""
Takes an unreduced and reduced deplist and removes satisfied dependencies.
@@ -382,7 +388,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
vercmp(avail_pkg.version, highest_cpv.version) > 0:
cp_map[avail_pkg.cp] = avail_pkg
- this_choice = (atoms, slot_map, cp_map, all_available)
+ this_choice = _dep_choice(atoms=atoms, slot_map=slot_map,
+ cp_map=cp_map, all_available=all_available,
+ all_installed_slots=False)
if all_available:
# The "all installed" criterion is not version or slot specific.
# If any version of a package is already in the graph then we
@@ -403,6 +411,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
not slot_atom.startswith("virtual/"):
all_installed_slots = False
break
+ this_choice.all_installed_slots = all_installed_slots
if graph_db is None:
if all_use_satisfied:
if all_installed:
@@ -505,6 +514,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
all_installed = False
if all_installed:
+ this_choice.all_installed_slots = True
other_installed.append(this_choice)
elif some_installed:
other_installed_some.append(this_choice)
@@ -521,22 +531,23 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
for choices in choice_bins:
if len(choices) < 2:
continue
+ # Prefer choices with all_installed_slots for bug #480736.
+ choices.sort(key=operator.attrgetter('all_installed_slots'),
+ reverse=True)
for choice_1 in choices[1:]:
- atoms_1, slot_map_1, cp_map_1, all_available_1 = choice_1
- cps = set(cp_map_1)
+ cps = set(choice_1.cp_map)
for choice_2 in choices:
if choice_1 is choice_2:
# choice_1 will not be promoted, so move on
break
- atoms_2, slot_map_2, cp_map_2, all_available_2 = choice_2
- intersecting_cps = cps.intersection(cp_map_2)
+ intersecting_cps = cps.intersection(choice_2.cp_map)
if not intersecting_cps:
continue
has_upgrade = False
has_downgrade = False
for cp in intersecting_cps:
- version_1 = cp_map_1[cp]
- version_2 = cp_map_2[cp]
+ version_1 = choice_1.cp_map[cp]
+ version_2 = choice_2.cp_map[cp]
difference = vercmp(version_1.version, version_2.version)
if difference != 0:
if difference > 0:
@@ -553,9 +564,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
for allow_masked in (False, True):
for choices in choice_bins:
- for atoms, slot_map, cp_map, all_available in choices:
+ for choice in choices:
if all_available or allow_masked:
- return atoms
+ return choice.atoms
assert(False) # This point should not be reachable
diff --git a/pym/portage/tests/resolver/test_or_choices.py b/pym/portage/tests/resolver/test_or_choices.py
index ca02112..90e6814 100644
--- a/pym/portage/tests/resolver/test_or_choices.py
+++ b/pym/portage/tests/resolver/test_or_choices.py
@@ -77,3 +77,58 @@ class OrChoicesTestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+ def testOrChoicesLibpostproc(self):
+ ebuilds = {
+ "media-video/ffmpeg-0.10" : {
+ "EAPI": "5",
+ "SLOT": "0.10"
+ },
+ "media-video/ffmpeg-1.2.2" : {
+ "EAPI": "5",
+ "SLOT": "0"
+ },
+ "media-libs/libpostproc-0.8.0.20121125" : {
+ "EAPI": "5"
+ },
+ "media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : {
+ "EAPI": "5",
+ "RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )"
+ },
+ }
+
+ installed = {
+ "media-video/ffmpeg-0.10" : {
+ "EAPI": "5",
+ "SLOT": "0.10"
+ },
+ "media-libs/libpostproc-0.8.0.20121125" : {
+ "EAPI": "5"
+ },
+ "media-plugins/gst-plugins-ffmpeg-0.10.13_p201211-r1" : {
+ "EAPI": "5",
+ "RDEPEND" : "|| ( media-video/ffmpeg:0 media-libs/libpostproc )"
+ },
+ }
+
+ world = ["media-plugins/gst-plugins-ffmpeg"]
+
+ test_cases = (
+ # Demonstrate that libpostproc is preferred
+ # over ffmpeg:0 for bug #480736.
+ ResolverPlaygroundTestCase(
+ ["@world"],
+ options = {"--update": True, "--deep": True},
+ success=True,
+ all_permutations = True,
+ mergelist = []),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds, installed=installed,
+ world=world, 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()
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-03-04 21:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-21 0:22 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/dep/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2018-03-04 21:05 Michał Górny
2018-01-20 23:14 Zac Medico
2018-01-11 19:24 Zac Medico
2014-09-15 5:00 Brian Dolbec
2013-08-22 1:34 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox