1 |
commit: 0c06ff5f8f3e86592bbaeb38f274797505c45b2a |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 3 05:21:01 2016 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 3 20:03:41 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c06ff5f |
7 |
|
8 |
bin/ebuild: fix EBUILD_FORCE_TEST / RESTRICT interaction (bug 601466) |
9 |
|
10 |
Ensure that config adjustments are applied to all relevant |
11 |
config instances, in order to prevent inconsistencies like |
12 |
the one that triggered bug 601466. Move the "Forcing test" |
13 |
message from config to bin/ebuild, in order to avoid |
14 |
duplicate messages. |
15 |
|
16 |
X-Gentoo-Bug: 601466 |
17 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=601466 |
18 |
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org> |
19 |
|
20 |
bin/ebuild | 25 ++++++++++++++++++------- |
21 |
pym/portage/package/ebuild/config.py | 5 ----- |
22 |
2 files changed, 18 insertions(+), 12 deletions(-) |
23 |
|
24 |
diff --git a/bin/ebuild b/bin/ebuild |
25 |
index 1f99177..7930b41 100755 |
26 |
--- a/bin/ebuild |
27 |
+++ b/bin/ebuild |
28 |
@@ -53,6 +53,7 @@ from portage import _unicode_encode |
29 |
from portage.const import VDB_PATH |
30 |
from portage.exception import PermissionDenied, PortageKeyError, \ |
31 |
PortagePackageException, UnsupportedAPIException |
32 |
+from portage.localization import _ |
33 |
import portage.util |
34 |
from _emerge.Package import Package |
35 |
from _emerge.RootConfig import RootConfig |
36 |
@@ -244,7 +245,11 @@ if mytree == "porttree" and build_dir_phases.intersection(pargs): |
37 |
ebuild_changed = \ |
38 |
portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir)[0] is None |
39 |
|
40 |
-tmpsettings = portage.config(clone=portage.settings) |
41 |
+# Make configuration adjustments to portage.portdb.doebuild_settings, |
42 |
+# in order to enforce consistency for EBUILD_FORCE_TEST support |
43 |
+# (see bug 601466). |
44 |
+tmpsettings = portage.portdb.doebuild_settings |
45 |
+ |
46 |
tmpsettings["PORTAGE_VERBOSE"] = "1" |
47 |
tmpsettings.backup_changes("PORTAGE_VERBOSE") |
48 |
|
49 |
@@ -265,6 +270,7 @@ if "test" in pargs: |
50 |
tmpsettings["EBUILD_FORCE_TEST"] = "1" |
51 |
tmpsettings.backup_changes("EBUILD_FORCE_TEST") |
52 |
tmpsettings.features.add("test") |
53 |
+ portage.writemsg(_("Forcing test.\n"), noiselevel=-1) |
54 |
|
55 |
tmpsettings.features.discard("fail-clean") |
56 |
|
57 |
@@ -272,6 +278,17 @@ if "merge" in pargs and "noauto" in tmpsettings.features: |
58 |
print("Disabling noauto in features... merge disables it. (qmerge doesn't)") |
59 |
tmpsettings.features.discard("noauto") |
60 |
|
61 |
+if 'digest' in tmpsettings.features: |
62 |
+ if pargs and pargs[0] not in ("digest", "manifest"): |
63 |
+ pargs = ['digest'] + pargs |
64 |
+ # We only need to build digests on the first pass. |
65 |
+ tmpsettings.features.discard('digest') |
66 |
+ |
67 |
+# Now that configuration adjustments are complete, create a clone of |
68 |
+# tmpsettings. The current instance refers to portdb.doebuild_settings, |
69 |
+# and we want to avoid the possibility of unintended side-effects. |
70 |
+tmpsettings = portage.config(clone=tmpsettings) |
71 |
+ |
72 |
try: |
73 |
metadata = dict(zip(Package.metadata_keys, |
74 |
portage.db[portage.settings['EROOT']][mytree].dbapi.aux_get( |
75 |
@@ -315,12 +332,6 @@ def stale_env_warning(): |
76 |
open(os.path.join(tmpsettings['PORTAGE_BUILDDIR'], |
77 |
'.ebuild_changed'), 'w').close() |
78 |
|
79 |
-if 'digest' in tmpsettings.features: |
80 |
- if pargs and pargs[0] not in ("digest", "manifest"): |
81 |
- pargs = ['digest'] + pargs |
82 |
- # We only need to build digests on the first pass. |
83 |
- tmpsettings.features.discard('digest') |
84 |
- |
85 |
checked_for_stale_env = False |
86 |
|
87 |
for arg in pargs: |
88 |
|
89 |
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py |
90 |
index 505c7a2..4f7e5c9 100644 |
91 |
--- a/pym/portage/package/ebuild/config.py |
92 |
+++ b/pym/portage/package/ebuild/config.py |
93 |
@@ -1699,11 +1699,6 @@ class config(object): |
94 |
ebuild_force_test = not restrict_test and \ |
95 |
self.get("EBUILD_FORCE_TEST") == "1" |
96 |
|
97 |
- if ebuild_force_test and \ |
98 |
- not hasattr(self, "_ebuild_force_test_msg_shown"): |
99 |
- self._ebuild_force_test_msg_shown = True |
100 |
- writemsg(_("Forcing test.\n"), noiselevel=-1) |
101 |
- |
102 |
if "test" in explicit_iuse or iuse_implicit_match("test"): |
103 |
if "test" not in self.features: |
104 |
use.discard("test") |