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

Replies