Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] emerge: make --binpkg-respect-use=y imply --autounmask-use=n
Date: Mon, 01 Mar 2021 09:39:31
Message-Id: 20210301093907.1541710-1-zmedico@gentoo.org
1 If --binpkg-respect-use=y is given explicitly, then it implies
2 --autounmask-use=n, because these options naturally oppose
3 eachother.
4
5 Bug: https://bugs.gentoo.org/773469
6 Signed-off-by: Zac Medico <zmedico@g.o>
7 ---
8 lib/_emerge/create_depgraph_params.py | 22 ++++++++++-----------
9 lib/portage/tests/resolver/test_useflags.py | 20 +++++++++++++------
10 man/emerge.1 | 11 +++++++----
11 3 files changed, 32 insertions(+), 21 deletions(-)
12
13 diff --git a/lib/_emerge/create_depgraph_params.py b/lib/_emerge/create_depgraph_params.py
14 index 25dd2a1b4..267600fb6 100644
15 --- a/lib/_emerge/create_depgraph_params.py
16 +++ b/lib/_emerge/create_depgraph_params.py
17 @@ -41,12 +41,22 @@ def create_depgraph_params(myopts, myaction):
18 # binpkg_changed_deps: reject binary packages with outdated deps
19 myparams = {"recurse" : True}
20
21 + binpkg_respect_use = myopts.get("--binpkg-respect-use")
22 + if binpkg_respect_use is not None:
23 + myparams["binpkg_respect_use"] = binpkg_respect_use
24 + elif "--usepkgonly" not in myopts:
25 + # If --binpkg-respect-use is not explicitly specified, we enable
26 + # the behavior automatically (like requested in bug #297549), as
27 + # long as it doesn't strongly conflict with other options that
28 + # have been specified.
29 + myparams["binpkg_respect_use"] = "auto"
30 +
31 autounmask_keep_keywords = myopts.get("--autounmask-keep-keywords")
32 autounmask_keep_masks = myopts.get("--autounmask-keep-masks")
33
34 autounmask = myopts.get("--autounmask")
35 autounmask_license = myopts.get('--autounmask-license', 'y' if autounmask is True else 'n')
36 - autounmask_use = myopts.get('--autounmask-use')
37 + autounmask_use = 'n' if myparams.get('binpkg_respect_use') == 'y' else myopts.get('--autounmask-use')
38 if autounmask == 'n':
39 autounmask = False
40 else:
41 @@ -153,16 +163,6 @@ def create_depgraph_params(myopts, myaction):
42 '--update' in myopts:
43 myparams['rebuilt_binaries'] = True
44
45 - binpkg_respect_use = myopts.get('--binpkg-respect-use')
46 - if binpkg_respect_use is not None:
47 - myparams['binpkg_respect_use'] = binpkg_respect_use
48 - elif '--usepkgonly' not in myopts:
49 - # If --binpkg-respect-use is not explicitly specified, we enable
50 - # the behavior automatically (like requested in bug #297549), as
51 - # long as it doesn't strongly conflict with other options that
52 - # have been specified.
53 - myparams['binpkg_respect_use'] = 'auto'
54 -
55 binpkg_changed_deps = myopts.get('--binpkg-changed-deps')
56 if binpkg_changed_deps is not None:
57 myparams['binpkg_changed_deps'] = binpkg_changed_deps
58 diff --git a/lib/portage/tests/resolver/test_useflags.py b/lib/portage/tests/resolver/test_useflags.py
59 index d66da0866..b799e62ff 100644
60 --- a/lib/portage/tests/resolver/test_useflags.py
61 +++ b/lib/portage/tests/resolver/test_useflags.py
62 @@ -46,15 +46,23 @@ class UseFlagsTestCase(TestCase):
63 success = True,
64 mergelist = ["dev-libs/A-1"]),
65
66 - # In the unit test case for bug 773469, the --autounmask-backtrack option
67 - # is needed in order to trigger the --binpkg-respect-use=y behavior that
68 - # appears confusingly similar to --binpkg-respect-use=n behavior.
69 + # For bug 773469, we wanted --binpkg-respect-use=y to trigger a
70 + # slot collision. Instead, a combination of default --autounmask-use
71 + # combined with --autounmask-backtrack=y from EMERGE_DEFAULT_OPTS
72 + # triggered this behavior which appeared confusingly similar to
73 + #--binpkg-respect-use=n behavior.
74 + #ResolverPlaygroundTestCase(
75 + # ["dev-libs/C", "dev-libs/D"],
76 + # options={"--usepkg": True, "--binpkg-respect-use": "y", "--autounmask-backtrack": "y"},
77 + # success=True,
78 + # use_changes={"dev-libs/C-1": {"abi_x86_32": True}},
79 + # mergelist=["[binary]dev-libs/C-1", "[binary]dev-libs/D-1"],
80 ResolverPlaygroundTestCase(
81 ["dev-libs/C", "dev-libs/D"],
82 options={"--usepkg": True, "--binpkg-respect-use": "y", "--autounmask-backtrack": "y"},
83 - success=True,
84 - use_changes={"dev-libs/C-1": {"abi_x86_32": True}},
85 - mergelist=["[binary]dev-libs/C-1", "[binary]dev-libs/D-1"],
86 + success=False,
87 + slot_collision_solutions=[{"dev-libs/C-1": {"abi_x86_32": True}}],
88 + mergelist=["dev-libs/C-1", "[binary]dev-libs/D-1"],
89 ),
90
91 #--binpkg-respect-use=n: use binpkgs with different use flags
92 diff --git a/man/emerge.1 b/man/emerge.1
93 index d9efc74cf..fe13e2145 100644
94 --- a/man/emerge.1
95 +++ b/man/emerge.1
96 @@ -1,4 +1,4 @@
97 -.TH "EMERGE" "1" "Feb 2021" "Portage VERSION" "Portage"
98 +.TH "EMERGE" "1" "Mar 2021" "Portage VERSION" "Portage"
99 .SH "NAME"
100 emerge \- Command\-line interface to the Portage system
101 .SH "SYNOPSIS"
102 @@ -417,7 +417,8 @@ Allow autounmask package.license changes.
103 .TP
104 .BR "\-\-autounmask\-use < y | n >"
105 Allow autounmask package.use changes. This option is enabled by default
106 -(either \fB\-\-autounmask=n\fR or \fB\-\-autounmask\-use=n\fR disables
107 +(any of \fB\-\-autounmask=n\fR, \fB\-\-autounmask\-use=n\fR,
108 +or \fB\-\-binpkg-\-respect\-use=y\fR disables
109 it). The \fBEMERGE_DEFAULT_OPTS\fR variable may be used to
110 disable this option by default in \fBmake.conf\fR(5).
111 .TP
112 @@ -447,8 +448,10 @@ dependencies is controlled by the \fB\-\-with\-bdeps\fR option.
113 Tells emerge to ignore binary packages if their USE flags
114 don't match the current configuration. In order to help avoid issues
115 with resolving inconsistent USE flag settings, this option is
116 -automatically enabled unless the \fB\-\-usepkgonly\fR option
117 -is enabled.
118 +automatically enabled unless the \fB\-\-usepkgonly\fB option
119 +is enabled. If \fB\-\-binpkg\-respect\-use=y\fB is given explicitly,
120 +then it implies \fB\-\-autounmask\-use=n\fB, because these options
121 +naturally oppose eachother.
122 .TP
123 .BR "\-\-buildpkg [ y | n ]" ", " \-b
124 Tells emerge to build binary packages for all ebuilds processed in
125 --
126 2.26.2