Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/portage/tests/resolver/soname/, pym/_emerge/
Date: Wed, 08 Mar 2017 19:37:29
Message-Id: 1489001780.7c01a73c5a3ff969ddaa43e91730a7372a8a10c8.zmedico@gentoo
1 commit: 7c01a73c5a3ff969ddaa43e91730a7372a8a10c8
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 8 01:30:05 2017 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 8 19:36:20 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c01a73c
7
8 depgraph: fix backtracking for slot operator rebuilds (bug 612042)
9
10 Fix package selection logic to avoid pulling in undesirable
11 rebuilds/updates during backtracking for slot operator rebuilds.
12 The undesirable rebuilds/updates have sent some calculations off
13 course, by triggering more and more rebuilds/updates with each
14 backtracking run.
15
16 In order to solve the problem, make various adjustments to the
17 package selection logic so that installed packages are preferred
18 over rebuilds/updates when appropriate. Also update unit tests
19 to work with these adjustments.
20
21 Fixes: 5842e87872fd ("Fix slot operator handling bug")
22 X-Gentoo-bug: 612042
23 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=612042
24 Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
25
26 pym/_emerge/depgraph.py | 11 +++++++++--
27 .../resolver/soname/test_slot_conflict_reinstall.py | 16 +++++++++++++++-
28 pym/portage/tests/resolver/test_slot_abi.py | 12 +++++-------
29 pym/portage/tests/resolver/test_slot_conflict_rebuild.py | 8 +++++++-
30 4 files changed, 36 insertions(+), 11 deletions(-)
31
32 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
33 index 02a32260a..bb3e307f0 100644
34 --- a/pym/_emerge/depgraph.py
35 +++ b/pym/_emerge/depgraph.py
36 @@ -2304,7 +2304,7 @@ class depgraph(object):
37 # Check for slot update first, since we don't want to
38 # trigger reinstall of the child package when a newer
39 # slot will be used instead.
40 - if rebuild_if_new_slot:
41 + if rebuild_if_new_slot and dep.want_update:
42 new_dep = self._slot_operator_update_probe(dep,
43 new_child_slot=True)
44 if new_dep is not None:
45 @@ -6241,7 +6241,7 @@ class depgraph(object):
46 if highest_installed is None or pkg.version > highest_installed.version:
47 highest_installed = pkg
48
49 - if highest_installed:
50 + if highest_installed and self._want_update_pkg(parent, highest_installed):
51 non_installed = [pkg for pkg in matched_packages \
52 if not pkg.installed and pkg.version > highest_installed.version]
53
54 @@ -6285,11 +6285,18 @@ class depgraph(object):
55 built_timestamp != installed_timestamp:
56 return built_pkg, existing_node
57
58 + inst_pkg = None
59 for pkg in matched_packages:
60 + if pkg.installed:
61 + inst_pkg = pkg
62 if pkg.installed and pkg.invalid:
63 matched_packages = [x for x in \
64 matched_packages if x is not pkg]
65
66 + if (inst_pkg is not None and parent is not None and
67 + not self._want_update_pkg(parent, inst_pkg)):
68 + return inst_pkg, existing_node
69 +
70 if avoid_update:
71 for pkg in matched_packages:
72 if pkg.installed and self._pkg_visibility_check(pkg, autounmask_level):
73
74 diff --git a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
75 index f4747611f..f7154442e 100644
76 --- a/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
77 +++ b/pym/portage/tests/resolver/soname/test_slot_conflict_reinstall.py
78 @@ -251,13 +251,27 @@ class SonameSlotConflictReinstallTestCase(TestCase):
79 success = True,
80 mergelist = [
81 '[binary]app-misc/B-2',
82 + '[binary]app-misc/A-2',
83 + ]
84 + ),
85 + ResolverPlaygroundTestCase(
86 + ["@world"],
87 + options = {
88 + "--ignore-soname-deps": "n",
89 + "--usepkgonly": True,
90 + "--update": True,
91 + "--deep": True,
92 + },
93 + success = True,
94 + mergelist = [
95 + '[binary]app-misc/B-2',
96 '[binary]app-misc/C-1',
97 '[binary]app-misc/A-2',
98 ]
99 ),
100 )
101
102 - world = []
103 + world = ['app-misc/A']
104
105 playground = ResolverPlayground(binpkgs=binpkgs,
106 installed=installed, world=world, debug=False)
107
108 diff --git a/pym/portage/tests/resolver/test_slot_abi.py b/pym/portage/tests/resolver/test_slot_abi.py
109 index 7263504b8..7dbbebe2f 100644
110 --- a/pym/portage/tests/resolver/test_slot_abi.py
111 +++ b/pym/portage/tests/resolver/test_slot_abi.py
112 @@ -170,23 +170,21 @@ class SlotAbiTestCase(TestCase):
113
114 test_cases = (
115
116 + # The first 2 test cases don't trigger a libreoffice rebuild
117 + # because sys-libs/db is the only package requested, and a
118 + # rebuild is not necessary because the sys-libs/db:4.7 slot
119 + # remains installed.
120 ResolverPlaygroundTestCase(
121 ["sys-libs/db"],
122 options = {"--oneshot": True},
123 success = True,
124 - mergelist = ["sys-libs/db-4.8", "app-office/libreoffice-3.5.4.2"]),
125 -
126 - ResolverPlaygroundTestCase(
127 - ["sys-libs/db"],
128 - options = {"--oneshot": True, "--ignore-built-slot-operator-deps": "y"},
129 - success = True,
130 mergelist = ["sys-libs/db-4.8"]),
131
132 ResolverPlaygroundTestCase(
133 ["sys-libs/db"],
134 options = {"--oneshot": True, "--usepkg": True},
135 success = True,
136 - mergelist = ["[binary]sys-libs/db-4.8", "app-office/libreoffice-3.5.4.2"]),
137 + mergelist = ["[binary]sys-libs/db-4.8"]),
138
139 ResolverPlaygroundTestCase(
140 ["sys-libs/db"],
141
142 diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
143 index 2dfa79cc2..95b6396ba 100644
144 --- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
145 +++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
146 @@ -165,7 +165,7 @@ class SlotConflictRebuildTestCase(TestCase):
147 ["app-misc/A"],
148 ignore_mergelist_order=True,
149 all_permutations=True,
150 - options = {"--backtrack": 3, '--deep': True},
151 + options = {"--backtrack": 3, '--update': True, '--deep': True},
152 success = True,
153 mergelist = expected_mergelist),
154 )
155 @@ -229,6 +229,12 @@ class SlotConflictRebuildTestCase(TestCase):
156 ResolverPlaygroundTestCase(
157 ["app-misc/A"],
158 success = True,
159 + mergelist = ['app-misc/A-2']),
160 +
161 + ResolverPlaygroundTestCase(
162 + ["app-misc/A"],
163 + options={"--update": True, "--deep": True},
164 + success = True,
165 mergelist = ['app-misc/B-2', 'app-misc/C-1', 'app-misc/A-2']),
166 )