summaryrefslogtreecommitdiff
blob: ff122993aab2b8328adefa00f0ff17461aded8f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
\chapter{Dependencies}
\label{sec:dependencies}

\section{Dependency Classes}
\label{sec:dependency-classes}

\begin{centertable}{Dependency classes required to be satisfied for a particular phase function} \label{tab:phase-function-dependency-classes}
    \begin{tabular}{ p{0.2\textwidth} p{0.7\textwidth} }
        \toprule
        \multicolumn{1}{c}{\textbf{Phase function}} &
        \multicolumn{1}{c}{\textbf{Satisfied dependency classes}} \\
        \midrule
        \t{pkg\_pretend}, \t{pkg\_setup}, \t{pkg\_info}, \t{pkg\_nofetch} & None (ebuilds can rely only on the packages in the system set) \\
        \t{src\_unpack}, \t{src\_prepare}, \t{src\_configure}, \t{src\_compile}, \t{src\_test}, \t{src\_install} & \t{DEPEND} \\
        \t{pkg\_preinst}, \t{pkg\_postinst}, \t{pkg\_prerm}, \t{pkg\_postrm} & \t{RDEPEND} (unless the particular dependency results in a circular dependency, in which case it may be installed later) \\
        \t{pkg\_config} & \t{RDEPEND}, \t{PDEPEND} \\
    \bottomrule
    \end{tabular}
\end{centertable}

There are three classes of dependencies supported by ebuilds:

\begin{compactitem}
\item Build dependencies (\t{DEPEND}). These must be installed and usable before any of
    the ebuild \t{src\_*} phase functions is executed. These may not be installed at all
    if a binary package is being merged.
\item Runtime dependencies (\t{RDEPEND}). These must be installed and usable before
    the results of an ebuild merging are treated as usable.
\item Post dependencies (\t{PDEPEND}). These must be installed at some point before
    the package manager finishes the batch of installs.
\end{compactitem}

Table~\ref{tab:phase-function-dependency-classes} lists dependencies which must be satisfied before a particular phase function is executed.

In addition, \t{SRC\_URI}, \t{HOMEPAGE}, \t{RESTRICT}, \t{PROPERTIES}, \t{LICENSE} and
\t{REQUIRED\_USE} use dependency-style specifications to specify their values.

\section{Dependency Specification Format}

The following elements are recognised in at least one class of specification. All elements must
be surrounded on both sides by whitespace, except at the start and end of the string.

\begin{compactitem}
\item A package dependency specification. Permitted in \t{DEPEND}, \t{RDEPEND}, \t{PDEPEND}.
\item A URI, in the form \t{proto://host/path}. Permitted in \t{SRC\_URI} and \t{HOMEPAGE}. In EAPIs
    listed in table~\ref{tab:uri-arrows-table} as supporting \t{SRC\_URI} arrows, may optionally be
    followed by whitespace, then \t{->}, then whitespace, then a simple filename when in
    \t{SRC\_URI}.  For \t{SRC\_URI} behaviour, see section~\ref{sec:src-uri-behaviour}.
\item A flat filename. Permitted in \t{SRC\_URI}.
\item A license name (e.\,g.\ \t{GPL-2}). Permitted in \t{LICENSE}.
\item A use flag name, optionally preceded by an exclamation mark. Permitted in \t{REQUIRED\_USE}.
\item A simple string. Permitted in \t{RESTRICT} and \t{PROPERTIES}.
\item An all-of group, which consists of an open parenthesis, followed by whitespace,
    followed by zero or more of (a dependency item of any kind followed by whitespace), followed
    by a close parenthesis. More formally:
    \t{all-of ::= '(' whitespace (item whitespace)* ')'}. Permitted in all specification style
    variables.
\item An any-of group, which consists of the string \t{||}, followed by whitespace,
    followed by an open parenthesis, followed by whitespace, followed by zero or more
    of (a dependency item of any kind followed by whitespace), followed by a close parenthesis.
    More formally: \t{any-of ::= '||' whitespace '(' whitespace (item whitespace)* ')'}.
    Permitted in \t{DEPEND}, \t{RDEPEND}, \t{PDEPEND}, \t{LICENSE}, \t{REQUIRED\_USE}.
\item An exactly-one-of group, which consists of the string \t{\textasciicircum\textasciicircum},
    followed by whitespace, followed by an open parenthesis, followed by whitespace, followed by
    zero or more of (a dependency item of any kind followed by whitespace), followed by a close
    parenthesis. More formally: \t{exactly-one-of ::= '\textasciicircum\textasciicircum' whitespace
    '(' whitespace (item whitespace)* ')'}.
    Permitted in \t{REQUIRED\_USE}.
\item \featurelabel{at-most-one-of} An at-most-one-of group, which consists of the string \t{??},
    followed by whitespace, followed by an open parenthesis, followed by whitespace, followed by
    zero or more of (a dependency item of any kind followed by whitespace), followed by a close
    parenthesis. More formally: \t{exactly-one-of ::= '??' whitespace '(' whitespace (item
    whitespace)* ')'}. Permitted in \t{REQUIRED\_USE} in EAPIs listed in
    table~\ref{tab:at-most-one-of-table} as supporting \t{REQUIRED\_USE ??}\ groups.
\item A use-conditional group, which consists of an optional exclamation mark, followed by
    a use flag name, followed by a question mark, followed by whitespace, followed by
    an open parenthesis, followed by whitespace, followed by zero or more of (a dependency item
    of any kind followed by whitespace), followed by a close parenthesis. More formally:
    \t{use-conditional ::= '!'? flag-name '?' whitespace '(' whitespace (item whitespace)* ')'}.
    Permitted in all specification style variables.
\end{compactitem}

In particular, note that whitespace is not optional.

\ChangeWhenAddingAnEAPI{5}
\begin{centertable}{EAPIs supporting \t{SRC\_URI} arrows} \label{tab:uri-arrows-table}
    \begin{tabular}{ l l }
        \toprule
        \multicolumn{1}{c}{\textbf{EAPI}} &
        \multicolumn{1}{c}{\textbf{Supports \t{SRC\_URI} arrows?}} \\
        \midrule
    \t{0} & No \\
    \t{1} & No \\
    \t{2} & Yes \\
    \t{3} & Yes \\
    \t{4} & Yes \\
    \t{5} & Yes \\
    \bottomrule
    \end{tabular}
\end{centertable}

\ChangeWhenAddingAnEAPI{5}
\begin{centertable}{EAPIs supporting \t{REQUIRED\_USE ??}\ groups} \label{tab:at-most-one-of-table}
    \begin{tabular}{ l l }
        \toprule
        \multicolumn{1}{c}{\textbf{EAPI}} &
        \multicolumn{1}{c}{\textbf{Supports \t{REQUIRED\_USE ??}\ groups?}} \\
        \midrule
    \t{0} & No \\
    \t{1} & No \\
    \t{2} & No \\
    \t{3} & No \\
    \t{4} & No \\
    \t{5} & Yes \\
    \bottomrule
    \end{tabular}
\end{centertable}

\subsection{All-of Dependency Specifications}

In an all-of group, all of the child elements must be matched.

\subsection{Use-conditional Dependency Specifications}

In a use-conditional group, if the associated use flag is enabled (or disabled if it has an
exclamation mark prefix), all of the child elements must be matched.

It is an error for a flag to be used if it is not included in \t{IUSE\_EFFECTIVE} as described in
section~\ref{sec:use-iuse-handling}.

\subsection{Any-of Dependency Specifications}

Any use-conditional group that is an immediate child of an any-of group, if not enabled (disabled
for an exclamation mark prefixed use flag name), is not considered a member of the any-of group
for match purposes.

In an any-of group, at least one immediate child element must be matched. A blocker is
considered to be matched if its associated package dependency specification is not matched.

An empty any-of group counts as being matched.

\subsection{Exactly-one-of Dependency Specifications}

Any use-conditional group that is an immediate child of an exactly-one-of group, if not enabled
(disabled for an exclamation mark prefixed use flag name), is not considered a member of the
exactly-one-of group for match purposes.

In an exactly-one-of group, exactly one immediate child element must be matched.

An empty exactly-one-of group counts as being matched.

\subsection{At-most-one-of Dependency Specifications}

Any use-conditional group that is an immediate child of an at-most-one-of group, if not enabled
(disabled for an exclamation mark prefixed use flag name), is not considered a member of the
at-most-one-of group for match purposes.

In an at-most-one-of group, at most one immediate child element must be matched.

An empty at-most-one-of group counts as being matched.

\subsection{Package Dependency Specifications}

A package dependency can be in one of the following base formats. A package manager must warn or
error on non-compliant input.

\begin{compactitem}
\item A simple \t{category/package} name.
\item An operator, as described in section~\ref{sec:dep-operator}, followed immediately by
    \t{category/package}, followed by a hyphen, followed by a version specification.
\end{compactitem}

In EAPIs shown in table~\ref{tab:slot-deps-table} as supporting \t{SLOT} dependencies, either of the
above formats may additionally be suffixed by a \t{:slot} restriction, as described in
section~\ref{sec:slot-dep}. A package manager must warn or error if slot dependencies are used with an
EAPI not supporting \t{SLOT} dependencies.

\featurelabel{use-deps} In EAPIs shown in table~\ref{tab:use-deps-table} as supporting 2-style
or 4-style \t{USE} dependencies, a specification may additionally be suffixed by at most one
2-style or 4-style \t{[use]} restriction, as described in section~\ref{sec:use-dep}. A package
manager must warn or error if this feature is used with an EAPI not supporting use dependencies.

\note Order is important. The slot restriction must come before use dependencies.

\ChangeWhenAddingAnEAPI{5}
\begin{centertable}{EAPIs supporting \t{SLOT} dependencies} \label{tab:slot-deps-table}
    \begin{tabular}{ l l }
        \toprule
            \multicolumn{1}{c}{\textbf{EAPI}} &
            \multicolumn{1}{c}{\textbf{Supports \t{SLOT} dependencies?}} \\
            \midrule
    \t{0} & No \\
    \t{1} & Named only \\
    \t{2} & Named only \\
    \t{3} & Named only \\
    \t{4} & Named only \\
    \t{5} & Named and operator \\
    \bottomrule
    \end{tabular}
\end{centertable}

\ChangeWhenAddingAnEAPI{5}
\begin{centertable}{EAPIs supporting \t{USE} dependencies} \label{tab:use-deps-table}
    \begin{tabular}{ l l }
        \toprule
        \multicolumn{1}{c}{\textbf{EAPI}} &
        \multicolumn{1}{c}{\textbf{Supports \t{USE} dependencies?}} \\
        \midrule
    \t{0} & No \\
    \t{1} & No \\
    \t{2} & 2-style \\
    \t{3} & 2-style \\
    \t{4} & 4-style \\
    \t{5} & 4-style \\
    \bottomrule
    \end{tabular}
\end{centertable}

\subsubsection{Operators}
\label{sec:dep-operator}

The following operators are available:

\begin{description}
\item[\t{<}] Strictly less than the specified version.
\item[\t{<=}] Less than or equal to the specified version.
\item[\t{=}] Exactly equal to the specified version. Special exception: if the version
    specified has an asterisk immediately following it, a string prefix comparison is
    used instead. When an asterisk is used, the specification must remain valid if the
    asterisk were removed. (An asterisk used with any other operator is illegal.)
\item[\t{\textasciitilde}] Equal to the specified version, except the revision part of the matching
    package may be greater than the revision part of the specified version (\t{-r0} is
    assumed if no revision is explicitly stated).
\item[\t{>=}] Greater than or equal to the specified version.
\item[\t{>}] Strictly greater than the specified version.
\end{description}

\subsubsection{Block Operator}

If the specification is prefixed with one or two exclamation marks, the named dependency is a block
rather than a requirement---that is to say, the specified package must not be installed, with the
following exceptions:

\begin{compactitem}
\item Blocks on a package provided exclusively by the ebuild do not count. \label{provided-blocks}
\item Weak blocks on the package version of the ebuild itself do not count.
\end{compactitem}

\featurelabel{bang-strength} There are two strengths of block: weak and strong. A weak block may be
ignored by the package manager, so long as any blocked package will be uninstalled later on. A
strong block must not be ignored. The mapping from one or two exclamation marks to strength is
described in table~\ref{tab:bang-strength-table}.

\ChangeWhenAddingAnEAPI{5}
\begin{centertable}{Exclamation mark strengths for EAPIs} \label{tab:bang-strength-table}
    \begin{tabular}{ l l l }
        \toprule
            \multicolumn{1}{c}{\textbf{EAPI}} &
            \multicolumn{1}{c}{\textbf{\t{!}}} &
            \multicolumn{1}{c}{\textbf{\t{!!}}} \\
            \midrule
    \t{0} & Unspecified & Forbidden \\
    \t{1} & Unspecified & Forbidden \\
    \t{2} & Weak & Strong \\
    \t{3} & Weak & Strong \\
    \t{4} & Weak & Strong \\
    \t{5} & Weak & Strong \\
    \bottomrule
    \end{tabular}
\end{centertable}

\subsubsection{Slot Dependencies}
\label{sec:slot-dep}

\featurelabel{slot-deps} A named slot dependency consists of a colon followed by a slot name. A
specification with a named slot dependency matches only if the slot of the matched package is equal
to the slot specified. If the slot of the package to match cannot be determined (e.\,g.\ because it
is not a supported \t{EAPI}), the match is treated as unsuccessful.

\featurelabel{slot-operator-deps} An operator slot dependency consists of a colon followed by one of
the following operators:

\begin{description}
\item[*] Indicates that any slot value is acceptable. In addition, for runtime dependencies,
indicates that the package will not break if the matched package is uninstalled and replaced by
a different matching package in a different slot.
\item[=] Indicates that any slot value is acceptable. In addition, for runtime dependencies,
indicates that the package will break unless a matching package with slot equal to the slot of
the best installed version at the time the package was installed is available.
\end{description}

To implement the equals slot operator, the package manager will need to store the slot of the
best installed version of the matching package. The package manager may do this by appending
the appropriate slot after the equals sign when saving the package's dependencies. This syntax
is only for package manager use and must not be used by ebuilds.

\subsubsection{2-Style and 4-Style Use Dependencies}
\label{sec:use-dep}

A 2-style or 4-style use dependency consists of one of the following:

\begin{description}
\item[{[opt]}] The flag must be enabled.
\item[{[opt=]}] The flag must be enabled if the flag is enabled for the package with the
    dependency, or disabled otherwise.
\item[{[!opt=]}] The flag must be disabled if the flag is enabled for the package with the
    dependency, or enabled otherwise.
\item[{[opt?]}] The flag must be enabled if the flag is enabled for the package with the
    dependency.
\item[{[!opt?]}] The flag must be disabled if the use flag is disabled for the package with the
    dependency.
\item[{[-opt]}] The flag must be disabled.
\end{description}

Multiple requirements may be combined using commas, e.\,g.\ \t{[first,-second,third?]}.

When multiple requirements are specified, all must match for a successful match.

\featurelabel{use-dep-defaults} In a 4-style use dependency, the flag name may immediately be
followed by a \e{default} specified by either \t{(+)} or \t{(-)}. The former indicates that, when
applying the use dependency to a package that does not have the flag in question in
\t{IUSE\_REFERENCEABLE}, the package manager shall behave as if the flag were present and enabled;
the latter, present and disabled.

Unless a 4-style default is specified, it is an error for a use dependency to be applied to an
ebuild which does not have the flag in question in \t{IUSE\_REFERENCEABLE}.

\note By extension of the above, a default that could reference an ebuild using an EAPI not
supporting profile \t{IUSE} injections cannot rely upon any particular behaviour for flags that
would not have to be part of \t{IUSE}.

It is an error for an ebuild to use a conditional use dependency when that ebuild does not have the
flag in \t{IUSE\_EFFECTIVE}.

\subsection{Use State Constraints}
\label{sec:required-use}
\t{REQUIRED\_USE} contains a list of assertions that must be met by the configuration of \t{USE}
flags to be valid for this ebuild. In order to be matched, a \t{USE} flag in a terminal element
must be enabled (or disabled if it has an exclamation mark prefix).

If the package manager encounters a package version where \t{REQUIRED\_USE} assertions are not met,
it must treat this package version as if it was masked. No phase functions must be called.

It is an error for a flag to be used if it is not included in \t{IUSE\_EFFECTIVE}.

\subsection{Restrict}
\label{sec:restrict}

The following tokens are permitted inside \t{RESTRICT}:

\begin{description}
\item[mirror] The package's \t{SRC\_URI} entries may not be mirrored, and mirrors should not
    be checked when fetching.
\item[fetch] The package's \t{SRC\_URI} entries may not be downloaded automatically. If
    entries are not available, \t{pkg\_nofetch} is called.
\item[strip] No stripping of debug symbols from files to be installed may be performed.
\item[userpriv] The package manager may not drop root privileges when building the package.
\item[test] The \t{src\_test} phase must not be run.
\item[sandbox] The \t{sandbox} tool must not be used when building the package.
\end{description}

Package managers may recognise other tokens, but ebuilds may not rely upon them being supported.

\subsection{Properties}
\label{sec:properties}

The following tokens are permitted inside \t{PROPERTIES}:

\begin{description}
\item[interactive] The package may require interaction with the user via the tty.
\end{description}

Ebuilds may not rely upon any token being supported.

\subsection{SRC\_URI}
\label{sec:src-uri-behaviour}

All filename components that are enabled (i.\,e.\ not inside a use-conditional block that is not
matched) in \t{SRC\_URI} must be available in the \t{DISTDIR} directory. In addition, these
components are used to make the \t{A} and \t{AA} variables.

If a component contains a full URI with protocol, that download location must be used. Package
managers may also consult mirrors for their files.

The special \t{mirror://} protocol must be supported. See section~\ref{sec:thirdpartymirrors} for mirror
details.

If a simple filename rather than a full URI is provided, the package manager can only use mirrors to
download the file.

The \t{RESTRICT} metadata key can be used to impose additional restrictions upon downloading---see
section~\ref{sec:restrict} for details.

\featurelabel{src-uri-arrows} In EAPIs supporting arrows, if an arrow is used, the filename used
when saving to \t{DISTDIR} shall instead be the name on the right of the arrow. When consulting
mirrors (except for those explicitly listed on the left of the arrow, if \t{mirror://} is used), the
filename to the right of the arrow shall be requested instead of the filename in the URI.

% vim: set filetype=tex fileencoding=utf8 et tw=100 spell spelllang=en :

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "pms"
%%% LaTeX-indent-level: 4
%%% LaTeX-item-indent: 0
%%% TeX-brace-indent-level: 4
%%% End: