Gentoo Archives: gentoo-dev

From: "Wolfgang E. Sanyer" <wolfgangesanyer@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [pre-GLEP] Repository configuration file (layout.conf)
Date: Wed, 19 May 2021 15:22:59
Message-Id: CACwN4LyGOMLqkM3OeZfKF=Li6=HYFg=zcXnmapCmEanWqLmjxw@mail.gmail.com
In Reply to: Re: [gentoo-dev] [pre-GLEP] Repository configuration file (layout.conf) by "Michał Górny"
1 On Wed, May 19, 2021 at 11:02 AM Michał Górny <mgorny@g.o> wrote:
2 >
3 > On Wed, 2021-05-19 at 10:37 -0400, Wolfgang E. Sanyer wrote:
4 > > See some comments in-line below.
5 > >
6 > >
7 > > On Wed, May 19, 2021 at 8:33 AM Michał Górny <mgorny@g.o> wrote:
8 > > >
9 > > > Hi,
10 > > >
11 > > > Please review the pre-GLEP inlined below. Its purpose is to formally
12 > > > define the format of layout.conf. It's pretty much inevitable these
13 > > > days, so we should specify it. However, it doesn't really fit into PMS,
14 > > > and other formats (Manifests, metadata.xml) are already defined
15 > > > in GLEPs, so this just follows suit.
16 > > >
17 > > > Pre-GLEP follows.
18 > > >
19 > > > ---
20 > > > GLEP: 9999
21 > > > Title: Repository configuration file (layout.conf)
22 > > > Author: Michał Górny <mgorny@g.o>
23 > > > Type: Standards Track
24 > > > Status: Draft
25 > > > Version: 1.0
26 > > > Created: 2021-05-19
27 > > > Last-Modified: 2021-05-19
28 > > > Post-History: 2021-05-19
29 > > > Content-Type: text/x-rst
30 > > > ---
31 > > >
32 > > > Abstract
33 > > > ========
34 > > >
35 > > > The ``metadata/layout.conf`` file format is specified as used by Portage
36 > > > and PkgCore. A standard set of configuration keys is described
37 > > > including the keys currently used in the Gentoo repository.
38 > > >
39 > > >
40 > > > Motivation
41 > > > ==========
42 > > >
43 > > > The ``metadata/layout.conf`` file was first added to the Gentoo
44 > > > repository in Oct 2011, to facilitate setting of hashes used
45 > > > in Manifest2 files. In Mar 2012, it was used to indicate the transition
46 > > > to the new ``md5-dict`` cache format. In Jul 2013, it started being
47 > > > used to indicate the repository's masters and effectively became
48 > > > obligatory for all repositories.
49 > > >
50 > > > Today, ``layout.conf`` is used for various repository configuration
51 > > > knobs that can be expressed as simple values and therefore
52 > > > do not justify adding new files to the repository. This primarily
53 > > > involves the configuration of development tools but also includes a few
54 > > > keys relevant to the behavior of the package manager.
55 > > >
56 > > > However, ``layout.conf`` is currently not covered by any formal
57 > > > specification. The PMS neglects its existence entirely, and the keys
58 > > > used are roughly defined by their first use of Portage or PkgCore.
59 > > > This GLEP aims to overcome this by providing a formal specification
60 > > > for the file, as well as an up-to-date list of permitted configuration
61 > > > keys.
62 > > >
63 > > >
64 > > > Specification
65 > > > =============
66 > > >
67 > > > layout.conf file format
68 > > > -----------------------
69 > > >
70 > > > Every ebuild repository must contain a ``metadata/layout.conf`` file.
71 > > > The file uses a line-oriented text format. Lines starting with ``#``
72 > > > represent comments and are ignored, as are lines consisting entirely
73 > > > of whitespace. The remaining lines must contain a key followed
74 > > > by equals sign (``=``), followed by a (possibly empty) value. Each of
75 > > > these elements can be surrounded by additional whitespace that
76 > > > is stripped.
77 > >
78 > > Is a space around the "=" optional? I see it used below, but here it sounds
79 > > like there should be no space.
80 >
81 > The last sentence says you can add extra space and it will be stripped.
82 > If you can think of a better way of wording that (I really wanted to
83 > avoid 'optional whitespace, followed by key, followed by optional
84 > whitespace... ' ;-).
85
86 🤦‍♂️ ofc I would miss that.
87
88 I always thought that python did a pretty good job
89 [explaining their format mini-language][1]. That's obviously overkill for what
90 you're describing here, but maybe something like this would be helpful?
91
92 # comments are allowed
93 <key> = [<value1> [<value2>...]]
94
95 Any lines starting with a ``#`` represents a comment and are ignored, as are
96 lines consisting entirely of whitespace.
97
98 A valid line consists of key and an equal sign. (A valid key is a
99 string containing
100 any character except for a space)[^1]. The list of space-separated
101 values is optional.
102
103 Note: any additional spaces are ultimately stripped
104
105 [1]: https://docs.python.org/3/library/string.html#format-specification-mini-language
106 [^1]: Should we include this or nah?
107
108 > >
109 > > > Configuration keys
110 > > > ------------------
111 > > >
112 > > > The ``layout.conf`` file must contain the ``masters`` key. Other keys
113 > > > listed in this specification are entirely optional. The package
114 > > > managers may choose to implement a subset of listed keys. Unknown keys
115 > > > must be ignored.
116 > > >
117 > > > The following keys are currently defined:
118 > >
119 > > Is the intent for the GLEP to define and specify every possible key-value
120 > > combination? If not, then perhaps this section should be truncated a bit? i.e.
121 > > "here are some examples of currently defined keys" and then list a handful.
122 > >
123 > > Additionally, maybe the spec should include some sort of requirement for
124 > > documentation of variables, similar to what you've done below.
125 > >
126 > > Edit: ok, nevermind I see your recommendation at the bottom. But still,
127 > > I would probably either (1) insist that new keys be added to this GLEP, or
128 > > (2) insist that new keys are documented properly.
129 >
130 > Let's put it like this: the goal is to document all the useful keys.
131 > I can live with some ancient-not-really-useful keys not being documented
132 > (e.g. Portage has some stale/redundant Manifest-related keys, I think).
133
134 Perhaps then some sort of use of the word "reserved" should be in here?
135 i.e. "The following keys are reserved for use by portage and pkgcheck.
136 any other keys may be defined and used at will"
137
138 > >
139 > > > masters = <space-separated values>
140 > > > Specifies the master repositories of this repository. For stand-alone
141 > > > repositories, this must be set to an empty value. Otherwise, it can
142 > > > list one or more repositories, separated by spaces. This key must
143 > > > be specified.
144 > >
145 > > I realize this is the only compulsory key, but perhaps it should still go in
146 > > a separate section in order to ensure that it stands out? i.e. "The following
147 > > keys are mandory..." and then later "the following optional keys are
148 > > currently defined"
149 >
150 > I'm not sure, to be honest. I didn't really want to add a section for
151 > one key ;-).
152
153 np, just a thought.
154
155 > >
156 > > > manifest-hashes = <space-separated values>
157 > > > Specifies the list of hashes that should be used for new distfiles
158 > > > in the Manifest files. The development tools may create a subset
159 > > > of the specified hashes if it is not updating the checksums for
160 > > > the specified distfile, or does not support the hash in question.
161 > > > The hash names are specified in GLEP 74. [#GLEP74]_ The default
162 > > > set of hashes is implementation-defined.
163 > > >
164 > > > manifest-required-hashes = <space-separated values>
165 > > > Specifies the list of hashes that must be used in Manifest files.
166 > > > The development tools must support all the hashes listed there,
167 > > > and update distfile checksums to use these hashes (refetching
168 > > > if necessary). This must be a subset of manifest-hashes. If not
169 > > > specified, all hashes from manifest-hashes (or the default set)
170 > > > are considered required.
171 > > >
172 > > > use-manifests = ``strict``, ``true`` or ``false``
173 > > > Indicates the policy for creating and using Manifest files. If set
174 > > > to ``strict``, Manifest files are created and files are required to
175 > > > match digests found in Manifests. If set to ``true``, Manifests
176 > > > are created but digest mismatches are ignored. If set to ``false``,
177 > > > Manifests are not used at all. The default is ``strict``.
178 > > >
179 > > > update-changelog = ``true`` or ``false``
180 > > > Indicates whether the development tools should write ChangeLog files.
181 > > > The default is ``false``.
182 > > >
183 > > > cache-formats = <space-separated values>
184 > > > Specifies one or more cache formats used by the repository.
185 > > > The currently defined values are ``pms`` for the original format
186 > > > specified in the PMS and ``md5-dict`` for the md5-dict format
187 > > > introduced in Portage 2.2.0_alpha68. The default is
188 > > > implementation-defined.
189 > > >
190 > > > eapis-deprecated = <space-separated values>
191 > > > Specifies one or more EAPIs that are to be considered deprecated
192 > > > by the development tools for use in ebuilds, i.e. their use should
193 > > > trigger a warning. If not specified, no EAPIs are deprecated.
194 > > >
195 > > > eapis-banned = <space-separated values>
196 > > > Specifies one or more EAPIs that are to be considered banned
197 > > > by the development tools for use in ebuilds, i.e. their use should
198 > > > be blocked. If not specified, no EAPIs are banned.
199 > > >
200 > > > repo-name = <string>
201 > > > Specifies the repository name. If specified, it must be equal
202 > > > to the contents of ``profiles/repo_name``. If not specified,
203 > > > it defaults to the same value. Discouraged.
204 > > >
205 > > > aliases = <space-separated values>
206 > > > Specified one or more additional names that can be used to reference
207 > > > the repository (e.g. in repository dependencies). If not specified,
208 > > > no aliases are defined.
209 > > >
210 > > > thin-manifests = ``true`` or ``false``
211 > > > If enabled, Manifest files in the package directory must contain only
212 > > > ``DIST`` entries. If disabled, Manifest files in the package
213 > > > directory must list digests for all files found in the package
214 > > > directory and the files directory. The default is ``false``.
215 > > >
216 > > > sign-commits = ``true`` or ``false``
217 > > > Indicates whether git commits are to be signed (using ``git commit
218 > > > --gpg-sign``. The default is ``false``.
219 > > >
220 > > > sign-manifests = ``true`` or ``false``
221 > > > Indicates whether individual package Manifests should be PGP-signed.
222 > > > Note that this refers to the historical behavior of signing individual
223 > > > Manifests, not the GLEP 74 behavior of signing the top-level Manifest.
224 > > > [#GLEP74]_ The default is ``true`` if PGP signing is configured.
225 > > >
226 > > > properties-allowed = <space-separated values>
227 > > > Specifies the list of ``PROPERTIES`` tokens that are permitted
228 > > > to be used in ebuilds. If present, the development tools should issue
229 > > > a warning if ``PROPERTIES`` contains any tokens that are not listed
230 > > > here. If not specified, all tokens are permitted.
231 > > >
232 > > > restrict-allowed = <space-separated values>
233 > > > Same as properties-allowed, except for ``RESTRICT``.
234 > > >
235 > > > profile-formats = <space-separated values>
236 > > > Specifies the format used by profiles and/or extensions to it.
237 > > > The default is ``pms`` indicating the format specified in the PMS.
238 > > > Other values are implementation-defined.
239 > > >
240 > > >
241 > > > It is recommended that any future keys are added to this GLEP before
242 > > > being implemented.
243 > > >
244 > > >
245 > > > Example
246 > > > -------
247 > > >
248 > > > The following is an example configuration for a git repository with
249 > > > Gentoo set as a master::
250 > > >
251 > > > masters = gentoo
252 > > >
253 > > > # git: do not use ChangeLog, use thin, unsigned Manifests
254 > > > update-changelog = false
255 > > > thin-manifests = true
256 > > > sign-manifests = false
257 > > >
258 > > > # force the new md5-dict cache format
259 > > > cache-formats = md5-dict
260 > > >
261 > > >
262 > > > Rationale
263 > > > =========
264 > > >
265 > > > This GLEP is written almost 10 years after ``layout.conf`` was
266 > > > originally introduced. This made it necessary to write it in such a way
267 > > > that both the modern and historical implementations in Portage
268 > > > and PkgCore, as well as the use in the Gentoo repository
269 > > > and a reasonably large subset of the other repositories would remain
270 > > > compliant.
271 > > >
272 > > > The historical default of assuming ``masters = gentoo`` when unspecified
273 > > > is omitted as it is not portable and verbosely deprecated for many
274 > > > years in Portage. All repositories are required to explicitly specify
275 > > > their masters, or an empty value if they are stand-alone.
276 > > >
277 > > > The default for Manifest hashes and cache formats are left to be
278 > > > implementation-defined, as the defaults changed over time and do not
279 > > > match between package managers. In particular, Portage attempts to
280 > > > autodetect the cache format currently used in a given repository.
281 > > >
282 > > > The repo-name key has been originally added as an alternative to
283 > > > ``profiles/repo_name``. However, the latter file is still required
284 > > > for PMS compliance. Furthermore, given that it is much easier to parse,
285 > > > there seems to be no appealing reason to work towards replacing that
286 > > > file. This means that for all practical reasons, the repo-name key
287 > > > is redundant and is listed here for completeness only.
288 > > >
289 > > > The profile-formats key has been introduced to permit Portage-specific
290 > > > extensions to the profile directory without having to introduce custom
291 > > > EAPIs. The exact extensions are considered outside the scope of this
292 > > > specification.
293 > > >
294 > > >
295 > > > Backwards Compatibility
296 > > > =======================
297 > > >
298 > > > The existing implementations found in Portage and PkgCore conform
299 > > > to this specification, so does the ``metadata/layout.conf`` file
300 > > > found in the Gentoo repository.
301 > > >
302 > > >
303 > > > Reference Implementation
304 > > > ========================
305 > > >
306 > > > The support for ``metadata/layout.conf`` is already a part of Portage
307 > > > and PkgCore.
308 > > >
309 > > >
310 > > > References
311 > > > ==========
312 > > >
313 > > > .. [#GLEP74] GLEP 74: Full-tree verification using Manifest files
314 > > > (https://www.gentoo.org/glep/glep-0074.html)
315 > > >
316 > > >
317 > > > Copyright
318 > > > =========
319 > > >
320 > > > This work is licensed under the Creative Commons Attribution-ShareAlike
321 > > > 4.0
322 > > > International License. To view a copy of this license, visit
323 > > > https://creativecommons.org/licenses/by-sa/4.0/.
324 > > >
325 > > >
326 > > > --
327 > > > Best regards,
328 > > > Michał Górny
329 > > >
330 > > >
331 > > >
332 > >
333 >
334 > --
335 > Best regards,
336 > Michał Górny
337 >
338 >
339 >

Replies