1 |
This is similar to --changed-deps, but for SLOT metadata. |
2 |
|
3 |
Bug: https://bugs.gentoo.org/631358 |
4 |
--- |
5 |
man/emerge.1 | 7 +++++++ |
6 |
pym/_emerge/create_depgraph_params.py | 6 ++++++ |
7 |
pym/_emerge/depgraph.py | 11 +++++++++++ |
8 |
pym/_emerge/main.py | 13 +++++++++++++ |
9 |
.../resolver/test_slot_change_without_revbump.py | 19 +++++++++++++++++++ |
10 |
5 files changed, 56 insertions(+) |
11 |
|
12 |
diff --git a/man/emerge.1 b/man/emerge.1 |
13 |
index 27a1193fe..a3c8dd7cd 100644 |
14 |
--- a/man/emerge.1 |
15 |
+++ b/man/emerge.1 |
16 |
@@ -471,6 +471,13 @@ changed since the installed instance was built. Behavior with respect to |
17 |
changed build\-time dependencies is controlled by the |
18 |
\fB\-\-with\-bdeps\fR option. |
19 |
.TP |
20 |
+.BR "\-\-changed\-slot [ y | n ]" |
21 |
+Tells emerge to replace installed packages for which the corresponding |
22 |
+ebuild SLOT metadata has changed since the packages were built. This |
23 |
+option also implies the \fB\-\-selective\fR option. This may also result |
24 |
+in rebuilds for any installed packages that have slot/sub\-slot := |
25 |
+operator dependencies that are sensitive to the relevant SLOT metadata. |
26 |
+.TP |
27 |
.BR \-\-changed\-use ", " \-U |
28 |
Tells emerge to include installed packages where USE flags have |
29 |
changed since installation. This option also implies the |
30 |
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py |
31 |
index ff18f3acc..1fd1f5e36 100644 |
32 |
--- a/pym/_emerge/create_depgraph_params.py |
33 |
+++ b/pym/_emerge/create_depgraph_params.py |
34 |
@@ -30,6 +30,7 @@ def create_depgraph_params(myopts, myaction): |
35 |
# with_test_deps: pull in test deps for packages matched by arguments |
36 |
# changed_deps: rebuild installed packages with outdated deps |
37 |
# changed_deps_report: report installed packages with outdated deps |
38 |
+ # changed_slot: rebuild installed packages with outdated SLOT metadata |
39 |
# binpkg_changed_deps: reject binary packages with outdated deps |
40 |
myparams = {"recurse" : True} |
41 |
|
42 |
@@ -64,12 +65,17 @@ def create_depgraph_params(myopts, myaction): |
43 |
if rebuild_if_new_slot is not None: |
44 |
myparams['rebuild_if_new_slot'] = rebuild_if_new_slot |
45 |
|
46 |
+ changed_slot = myopts.get('--changed-slot') is True |
47 |
+ if changed_slot: |
48 |
+ myparams["changed_slot"] = True |
49 |
+ |
50 |
if "--update" in myopts or \ |
51 |
"--newrepo" in myopts or \ |
52 |
"--newuse" in myopts or \ |
53 |
"--reinstall" in myopts or \ |
54 |
"--noreplace" in myopts or \ |
55 |
myopts.get("--changed-deps", "n") != "n" or \ |
56 |
+ changed_slot or \ |
57 |
myopts.get("--selective", "n") != "n": |
58 |
myparams["selective"] = True |
59 |
|
60 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
61 |
index f7ea27c37..dcf3938d8 100644 |
62 |
--- a/pym/_emerge/depgraph.py |
63 |
+++ b/pym/_emerge/depgraph.py |
64 |
@@ -2660,6 +2660,10 @@ class depgraph(object): |
65 |
|
66 |
return changed |
67 |
|
68 |
+ def _changed_slot(self, pkg): |
69 |
+ ebuild = self._equiv_ebuild(pkg) |
70 |
+ return ebuild is not None and (ebuild.slot, ebuild.sub_slot) != (pkg.slot, pkg.sub_slot) |
71 |
+ |
72 |
def _create_graph(self, allow_unsatisfied=False): |
73 |
dep_stack = self._dynamic_config._dep_stack |
74 |
dep_disjunctive_stack = self._dynamic_config._dep_disjunctive_stack |
75 |
@@ -6464,6 +6468,13 @@ class depgraph(object): |
76 |
modified_use=self._pkg_use_enabled(pkg))): |
77 |
if myeb and "--newrepo" in self._frozen_config.myopts and myeb.repo != pkg.repo: |
78 |
break |
79 |
+ elif self._dynamic_config.myparams.get("changed_slot") and self._changed_slot(pkg): |
80 |
+ if installed: |
81 |
+ break |
82 |
+ else: |
83 |
+ # Continue searching for a binary package |
84 |
+ # with the desired SLOT metadata. |
85 |
+ continue |
86 |
elif reinstall_use or (not installed and respect_use): |
87 |
iuses = pkg.iuse.all |
88 |
old_use = self._pkg_use_enabled(pkg) |
89 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
90 |
index 147472cbd..4aa9585fa 100644 |
91 |
--- a/pym/_emerge/main.py |
92 |
+++ b/pym/_emerge/main.py |
93 |
@@ -136,6 +136,7 @@ def insert_optional_args(args): |
94 |
'--binpkg-changed-deps' : y_or_n, |
95 |
'--buildpkg' : y_or_n, |
96 |
'--changed-deps' : y_or_n, |
97 |
+ '--changed-slot' : y_or_n, |
98 |
'--changed-deps-report' : y_or_n, |
99 |
'--complete-graph' : y_or_n, |
100 |
'--deep' : valid_integers, |
101 |
@@ -416,6 +417,12 @@ def parse_opts(tmpcmdline, silent=False): |
102 |
"choices" : true_y_or_n |
103 |
}, |
104 |
|
105 |
+ "--changed-slot": { |
106 |
+ "help" : ("replace installed packages with " |
107 |
+ "outdated SLOT metadata"), |
108 |
+ "choices" : true_y_or_n |
109 |
+ }, |
110 |
+ |
111 |
"--config-root": { |
112 |
"help":"specify the location for portage configuration files", |
113 |
"action":"store" |
114 |
@@ -852,6 +859,12 @@ def parse_opts(tmpcmdline, silent=False): |
115 |
else: |
116 |
myoptions.changed_deps_report = 'n' |
117 |
|
118 |
+ if myoptions.changed_slot is not None: |
119 |
+ if myoptions.changed_slot in true_y: |
120 |
+ myoptions.changed_slot = True |
121 |
+ else: |
122 |
+ myoptions.changed_slot = None |
123 |
+ |
124 |
if myoptions.changed_use is not False: |
125 |
myoptions.reinstall = "changed-use" |
126 |
myoptions.changed_use = False |
127 |
diff --git a/pym/portage/tests/resolver/test_slot_change_without_revbump.py b/pym/portage/tests/resolver/test_slot_change_without_revbump.py |
128 |
index d85ff7e05..5cd8c53d1 100644 |
129 |
--- a/pym/portage/tests/resolver/test_slot_change_without_revbump.py |
130 |
+++ b/pym/portage/tests/resolver/test_slot_change_without_revbump.py |
131 |
@@ -57,6 +57,25 @@ class SlotChangeWithoutRevBumpTestCase(TestCase): |
132 |
success = True, |
133 |
mergelist = ['app-arch/libarchive-3.1.1', "kde-base/ark-4.10.0"]), |
134 |
|
135 |
+ ResolverPlaygroundTestCase( |
136 |
+ ["app-arch/libarchive"], |
137 |
+ options = {"--noreplace": True, "--usepkg": True}, |
138 |
+ success = True, |
139 |
+ mergelist = []), |
140 |
+ |
141 |
+ ResolverPlaygroundTestCase( |
142 |
+ ["app-arch/libarchive"], |
143 |
+ options = {"--usepkg": True}, |
144 |
+ success = True, |
145 |
+ mergelist = ["[binary]app-arch/libarchive-3.1.1"]), |
146 |
+ |
147 |
+ # Test --changed-slot |
148 |
+ ResolverPlaygroundTestCase( |
149 |
+ ["app-arch/libarchive"], |
150 |
+ options = {"--changed-slot": True, "--usepkg": True}, |
151 |
+ success = True, |
152 |
+ mergelist = ["app-arch/libarchive-3.1.1", "kde-base/ark-4.10.0"]), |
153 |
+ |
154 |
) |
155 |
|
156 |
playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs, |
157 |
-- |
158 |
2.13.6 |