Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: man/, lib/portage/tests/resolver/, lib/_emerge/
Date: Mon, 08 Feb 2021 04:31:32
Message-Id: 1612758174.3c587280434d7f36a45117ed0732362b9c49018f.zmedico@gentoo
1 commit: 3c587280434d7f36a45117ed0732362b9c49018f
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 24 02:41:41 2021 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 8 04:22:54 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3c587280
7
8 emerge: disable --autounmask-license by default
9
10 Disable --autounmask-license by default, in order to limit user
11 exposure to risks associated with package.license changes.
12 The changes that this option suggests are only intended to be
13 accepted when a user has made a conscious decision to accept
14 the corresponding license(s). Creation of package.license
15 changes introduces a risk that users may erroneously accept the
16 changes due to some kind of accident or misunderstanding,
17 rather than due to conscious decisions about licenses.
18 These risks provide motivation to disable --autounmask-license
19 by default. The --autounmask-use option will remain as the
20 only autounmask option that is still enabled by default.
21
22 The unit tests demonstrate interactions between --autounmask
23 and --autounmask-license options. The --autounmask option
24 enables --autounmask-license unless --autounmask-license=n
25 has been specified. If --autounmask=n is used to disable
26 autounmask, then --autounmask-license=y has no effect.
27
28 Bug: https://bugs.gentoo.org/766773
29 Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>
30 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
31
32 lib/_emerge/create_depgraph_params.py | 8 ++++----
33 lib/portage/tests/resolver/test_autounmask.py | 25 +++++++++++++++++++++++--
34 man/emerge.1 | 11 ++++-------
35 3 files changed, 31 insertions(+), 13 deletions(-)
36
37 diff --git a/lib/_emerge/create_depgraph_params.py b/lib/_emerge/create_depgraph_params.py
38 index 0d0e07b9c..25dd2a1b4 100644
39 --- a/lib/_emerge/create_depgraph_params.py
40 +++ b/lib/_emerge/create_depgraph_params.py
41 @@ -1,4 +1,4 @@
42 -# Copyright 1999-2018 Gentoo Foundation
43 +# Copyright 1999-2021 Gentoo Authors
44 # Distributed under the terms of the GNU General Public License v2
45
46 import logging
47 @@ -45,7 +45,7 @@ def create_depgraph_params(myopts, myaction):
48 autounmask_keep_masks = myopts.get("--autounmask-keep-masks")
49
50 autounmask = myopts.get("--autounmask")
51 - autounmask_license = myopts.get('--autounmask-license')
52 + autounmask_license = myopts.get('--autounmask-license', 'y' if autounmask is True else 'n')
53 autounmask_use = myopts.get('--autounmask-use')
54 if autounmask == 'n':
55 autounmask = False
56 @@ -53,7 +53,7 @@ def create_depgraph_params(myopts, myaction):
57 if autounmask is None:
58 if autounmask_use in (None, 'y'):
59 autounmask = True
60 - elif autounmask_license in (None, 'y'):
61 + if autounmask_license in ('y',):
62 autounmask = True
63
64 # Do not enable package.accept_keywords or package.mask
65 @@ -67,7 +67,7 @@ def create_depgraph_params(myopts, myaction):
66
67 myparams['autounmask'] = autounmask
68 myparams['autounmask_keep_use'] = True if autounmask_use == 'n' else False
69 - myparams['autounmask_keep_license'] = True if autounmask_license == 'n' else False
70 + myparams['autounmask_keep_license'] = False if autounmask_license == 'y' else True
71 myparams['autounmask_keep_keywords'] = False if autounmask_keep_keywords in (None, 'n') else True
72 myparams['autounmask_keep_masks'] = False if autounmask_keep_masks in (None, 'n') else True
73
74
75 diff --git a/lib/portage/tests/resolver/test_autounmask.py b/lib/portage/tests/resolver/test_autounmask.py
76 index a3bf0ff94..86ae4bbf6 100644
77 --- a/lib/portage/tests/resolver/test_autounmask.py
78 +++ b/lib/portage/tests/resolver/test_autounmask.py
79 @@ -1,4 +1,4 @@
80 -# Copyright 2010-2019 Gentoo Authors
81 +# Copyright 2010-2021 Gentoo Authors
82 # Distributed under the terms of the GNU General Public License v2
83
84 from portage.tests import TestCase
85 @@ -440,13 +440,34 @@ class AutounmaskTestCase(TestCase):
86 mergelist=["dev-libs/A-1"],
87 license_changes={ "dev-libs/A-1": set(["TEST"]) }),
88
89 - # Test default --autounmask-license
90 + # Test that --autounmask enables --autounmask-license
91 ResolverPlaygroundTestCase(
92 ["=dev-libs/A-1"],
93 + options={"--autounmask": True},
94 success=False,
95 mergelist=["dev-libs/A-1"],
96 license_changes={ "dev-libs/A-1": set(["TEST"]) }),
97
98 + # Test that --autounmask-license is not enabled by default
99 + ResolverPlaygroundTestCase(
100 + ["=dev-libs/A-1"],
101 + success=False,
102 + ),
103 +
104 + # Test that --autounmask does not override --autounmask-license=n
105 + ResolverPlaygroundTestCase(
106 + ["=dev-libs/A-1"],
107 + options={"--autounmask": True, "--autounmask-license": "n"},
108 + success=False,
109 + ),
110 +
111 + # Test that --autounmask=n overrides --autounmask-license=y
112 + ResolverPlaygroundTestCase(
113 + ["=dev-libs/A-1"],
114 + options={"--autounmask": "n", "--autounmask-license": "y"},
115 + success=False,
116 + ),
117 +
118 ResolverPlaygroundTestCase(
119 ["=dev-libs/A-1"],
120 options={"--autounmask-license": "n"},
121
122 diff --git a/man/emerge.1 b/man/emerge.1
123 index 1a2a3fd3d..d9efc74cf 100644
124 --- a/man/emerge.1
125 +++ b/man/emerge.1
126 @@ -1,4 +1,4 @@
127 -.TH "EMERGE" "1" "Nov 2020" "Portage VERSION" "Portage"
128 +.TH "EMERGE" "1" "Feb 2021" "Portage VERSION" "Portage"
129 .SH "NAME"
130 emerge \- Command\-line interface to the Portage system
131 .SH "SYNOPSIS"
132 @@ -356,8 +356,8 @@ intended to be set in the \fBmake.conf\fR(5)
133 Automatically unmask packages and generate package.use
134 settings as necessary to satisfy dependencies. This option
135 is disabled by default, except for portions of behavior
136 -which are controlled by the \fB\-\-autounmask\-use\fR and
137 -\fB\-\-autounmask\-license\fR options (\fB\-\-autounmask=n\fR
138 +which are controlled by the \fB\-\-autounmask\-use\fR
139 +(\fB\-\-autounmask=n\fR
140 disables autounmask behavior entirely). If any configuration
141 changes are required, then they will be displayed
142 after the merge list and emerge will immediately
143 @@ -413,10 +413,7 @@ will be created. This leads to unsatisfied dependencies if
144 no other solution exists.
145 .TP
146 .BR "\-\-autounmask\-license < y | n >"
147 -Allow autounmask package.license changes. This option is enabled by default
148 -(either \fB\-\-autounmask=n\fR or \fB\-\-autounmask\-license=n\fR disables
149 -it). The \fBEMERGE_DEFAULT_OPTS\fR variable may be used to
150 -disable this option by default in \fBmake.conf\fR(5).
151 +Allow autounmask package.license changes.
152 .TP
153 .BR "\-\-autounmask\-use < y | n >"
154 Allow autounmask package.use changes. This option is enabled by default