Gentoo Archives: gentoo-portage-dev

From: Wynn Wolf Arbor <wolf@××××××.systems>
To: gentoo-portage-dev@l.g.o
Cc: Wynn Wolf Arbor <wolf@××××××.systems>
Subject: [gentoo-portage-dev] [PATCH 1/2] repos.conf: Use consistent list of values for boolean options
Date: Thu, 02 Jul 2020 15:50:57
Message-Id: 20200702155018.82993-2-wolf@oriole.systems
In Reply to: [gentoo-portage-dev] [PATCH 0/2] Use consistent list of booleans & validate verify-commit-signature by Wynn Wolf Arbor
1 Valid values for boolean options in repos.conf are currently not managed
2 in a consistent manner. Some options only support 'true' and 'false',
3 whilst others additionally support 'yes' and 'no'. Using the latter
4 forms on options that do not support them will lead to unexpected
5 behaviour. For example, an option checking for 'true' will be disabled
6 when 'yes' is used. This is counter-intuitive and adds additional
7 burden: the user has to look up in the manual which form is accepted by
8 which option.
9
10 Have all boolean options consistently accept 'yes', 'no', 'true', and
11 'false' and make sure to document this in the portage(5) manual.
12 Additionally, document the default value for each.
13
14 Signed-off-by: Wynn Wolf Arbor <wolf@××××××.systems>
15 ---
16 lib/portage/repository/config.py | 4 +--
17 lib/portage/sync/modules/git/git.py | 2 +-
18 lib/portage/sync/modules/rsync/rsync.py | 2 +-
19 man/portage.5 | 45 ++++++++++++-------------
20 4 files changed, 25 insertions(+), 28 deletions(-)
21
22 diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py
23 index 6155c130a..3a5425be7 100644
24 --- a/lib/portage/repository/config.py
25 +++ b/lib/portage/repository/config.py
26 @@ -220,10 +220,10 @@ class RepoConfig(object):
27 self.sync_depth = repo_opts.get('sync-depth')
28
29 self.sync_hooks_only_on_change = repo_opts.get(
30 - 'sync-hooks-only-on-change', 'false').lower() == 'true'
31 + 'sync-hooks-only-on-change', 'false').lower() in ('true', 'yes')
32
33 self.strict_misc_digests = repo_opts.get(
34 - 'strict-misc-digests', 'true').lower() == 'true'
35 + 'strict-misc-digests', 'true').lower() in ('true', 'yes')
36
37 self.sync_allow_hardlinks = repo_opts.get(
38 'sync-allow-hardlinks', 'true').lower() in ('true', 'yes')
39 diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py
40 index 7df4b6d61..1447dca0e 100644
41 --- a/lib/portage/sync/modules/git/git.py
42 +++ b/lib/portage/sync/modules/git/git.py
43 @@ -204,7 +204,7 @@ class GitSync(NewBase):
44
45 def verify_head(self, revision='-1'):
46 if (self.repo.module_specific_options.get(
47 - 'sync-git-verify-commit-signature', 'false') != 'true'):
48 + 'sync-git-verify-commit-signature', 'false') not in ('true', 'yes')):
49 return True
50
51 if self.repo.sync_openpgp_key_path is not None:
52 diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
53 index a40e1c854..aed8a8dc7 100644
54 --- a/lib/portage/sync/modules/rsync/rsync.py
55 +++ b/lib/portage/sync/modules/rsync/rsync.py
56 @@ -68,7 +68,7 @@ class RsyncSync(NewBase):
57 out = portage.output.EOutput(quiet=quiet)
58 syncuri = self.repo.sync_uri
59 if self.repo.module_specific_options.get(
60 - 'sync-rsync-vcs-ignore', 'false').lower() == 'true':
61 + 'sync-rsync-vcs-ignore', 'false').lower() in ('true', 'yes'):
62 vcs_dirs = ()
63 else:
64 vcs_dirs = frozenset(VCS_DIRS)
65 diff --git a/man/portage.5 b/man/portage.5
66 index 136ebaafe..7a5817134 100644
67 --- a/man/portage.5
68 +++ b/man/portage.5
69 @@ -916,13 +916,11 @@ When 'force = aliases' attribute is not set, \fBegencache\fR(1),
70 since operations performed by these tools are inherently
71 \fBnot\fR \fIsite\-specific\fR.
72 .TP
73 -.B auto\-sync
74 +.B auto\-sync = yes|no|true|false
75 This setting determines if the repo will be synced during "\fBemerge \-\-sync\fR" or
76 "\fBemaint sync \-\-auto\fR" runs. This allows for repositories to be synced only when
77 desired via "\fBemaint sync \-\-repo foo\fR".
78 .br
79 -Valid values: yes, no, true, false.
80 -.br
81 If unset, the repo will be treated as set
82 yes, true.
83 .TP
84 @@ -966,20 +964,18 @@ since operations performed by these tools are inherently
85 .B priority
86 Specifies priority of given repository.
87 .TP
88 -.B strict\-misc\-digests
89 +.B strict\-misc\-digests = yes|no|true|false
90 This setting determines whether digests are checked for files declared
91 in the Manifest with MISC type (includes ChangeLog and metadata.xml
92 -files). Defaults to true.
93 -.br
94 -Valid values: true, false.
95 +files). Defaults to yes, true.
96 .TP
97 -.B sync\-allow\-hardlinks = yes|no
98 +.B sync\-allow\-hardlinks = yes|no|true|false
99 Allow sync plugins to use hardlinks in order to ensure that a repository
100 remains in a valid state if something goes wrong during the sync operation.
101 For example, if signature verification fails during a sync operation,
102 the previous state of the repository will be preserved. This option may
103 conflict with configurations that restrict the use of hardlinks, such as
104 -overlay filesystems.
105 +overlay filesystems. Defaults to yes, true.
106 .TP
107 .B sync\-cvs\-repo
108 Specifies CVS repository.
109 @@ -1016,16 +1012,17 @@ See also example for sync-git-clone-env.
110 .B sync\-git\-pull\-extra\-opts
111 Extra options to give to git when updating repository (git pull).
112 .TP
113 -.B sync\-git\-verify\-commit\-signature = true|false
114 +.B sync\-git\-verify\-commit\-signature = yes|no|true|false
115 Require the top commit in the repository to contain a good OpenPGP
116 -signature. Defaults to false.
117 +signature. Defaults to no, false.
118 .TP
119 -.B sync\-hooks\-only\-on\-change
120 +.B sync\-hooks\-only\-on\-change = yes|no|true|false
121 If set to true, then sync of a given repository will not trigger postsync
122 hooks unless hooks would have executed for a master repository or the
123 -repository has changed since the previous sync operation.
124 +repository has changed since the previous sync operation. Defaults to
125 +no, false.
126 .TP
127 -.B sync\-rcu = yes|no
128 +.B sync\-rcu = yes|no|true|false
129 Enable read\-copy\-update (RCU) behavior for sync operations. The current
130 latest immutable version of a repository will be referenced by a symlink
131 found where the repository would normally be located (see the \fBlocation\fR
132 @@ -1156,10 +1153,10 @@ Pass \fIname\fR as the `gpg \-\-keyserver` argument. Refer to the
133 \fBgpg\fR(1) man page for information about the `gpg \-\-keyserver`
134 \fIname\fR format.
135 .TP
136 -.B sync-rsync-vcs-ignore = true|false
137 +.B sync\-rsync\-vcs\-ignore = yes|no|true|false
138 Ignore vcs directories that may be present in the repository. It is the
139 user's responsibility to set sync-rsync-extra-opts to protect vcs
140 -directories if appropriate.
141 +directories if appropriate. Defaults to no, false.
142 .TP
143 .B sync\-rsync\-verify\-jobs = 1
144 Number of parallel jobs to use when verifying nested Manifests. When
145 @@ -1171,21 +1168,21 @@ Defaults to 1.
146 Warn if repository is older than the specified number of days. Disabled
147 when 0. Defaults to disabled.
148 .TP
149 -.B sync\-rsync\-verify\-metamanifest = yes|no
150 +.B sync\-rsync\-verify\-metamanifest = yes|no|true|false
151 Require the repository to contain a signed MetaManifest and verify
152 -it using \fBapp\-portage/gemato\fR. Defaults to no.
153 +it using \fBapp\-portage/gemato\fR. Defaults to no, false.
154 .TP
155 -.B sync\-webrsync\-delta = true|false
156 +.B sync\-webrsync\-delta = yes|no|true|false
157 Use \fBapp\-portage/emerge\-delta\-webrsync\fR to minimize bandwidth.
158 -Defaults to false.
159 +Defaults to no, false.
160 .TP
161 -.B sync\-webrsync\-keep\-snapshots = true|false
162 -Keep snapshots in \fBDISTDIR\fR (do not delete). Defaults to false.
163 +.B sync\-webrsync\-keep\-snapshots = yes|no|true|false
164 +Keep snapshots in \fBDISTDIR\fR (do not delete). Defaults to no, false.
165 .TP
166 -.B sync\-webrsync\-verify\-signature = true|false
167 +.B sync\-webrsync\-verify\-signature = yes|no|true|false
168 Require the detached tarball signature to contain a good OpenPGP
169 signature. This uses the OpenPGP key(ring) specified by the
170 -sync\-openpgp\-key\-path setting. Defaults to false.
171 +sync\-openpgp\-key\-path setting. Defaults to no, false.
172
173 .RE
174
175
176 base-commit: c36e8dfaf808f68586e7519232e072490ccc51db
177 --
178 2.27.0