Gentoo Archives: gentoo-pms

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-pms@l.g.o
Subject: [gentoo-pms] [PATCH 09/22] EAPI 6: die and assert called with -n respect nonfatal.
Date: Thu, 15 Oct 2015 10:50:39
Message-Id: 1444906221-30505-10-git-send-email-ulm@gentoo.org
In Reply to: [gentoo-pms] EAPI 6 draft for review by "Ulrich Müller"
1 Bug: 451938
2 ---
3 eapi-differences.tex | 4 ++++
4 pkg-mgr-commands.tex | 33 ++++++++++++++++++++++++++-------
5 2 files changed, 30 insertions(+), 7 deletions(-)
6
7 diff --git a/eapi-differences.tex b/eapi-differences.tex
8 index 6ec5209..2a4f840 100644
9 --- a/eapi-differences.tex
10 +++ b/eapi-differences.tex
11 @@ -169,6 +169,9 @@ Most utilities die & \compactfeatureref{die-on-failure} &
12 Option \t{-{}-host-root} & \compactfeatureref{host-root-option} &
13 No & No & No & Yes & Yes \\
14
15 +\t{die -n} & \compactfeatureref{nonfatal-die} &
16 + No & No & No & No & Yes \\
17 +
18 \t{econf} arguments & \compactfeatureref{econf-options} &
19 & & disable dependency tracking &
20 disable dependency tracking, disable silent rules &
21 @@ -320,6 +323,7 @@ EAPI 6 is EAPI 5 with the following changes:
22 \item Bash version is 4.2, \featureref{bash-version}.
23 \item \t{failglob} is enabled in global scope, \featureref{failglob}.
24 \item \t{einstall} banned, \featureref{banned-commands}.
25 +\item \t{die} and \t{assert} called with \t{-n} respect \t{nonfatal}, \featureref{nonfatal-die}.
26 \end{compactitem}
27
28 \ChangeWhenAddingAnEAPI{6}
29 diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
30 index 4f8c34f..fce819b 100644
31 --- a/pkg-mgr-commands.tex
32 +++ b/pkg-mgr-commands.tex
33 @@ -18,9 +18,11 @@ The following commands affect this behaviour:
34 \begin{description}
35 \item[nonfatal] \featurelabel{nonfatal} Executes the remainder of its arguments as a command,
36 preserving the exit status. If this results in a command being called that would normally abort
37 - the build process due to a failure (but not due to an explicit \t{die} or \t{assert} call),
38 - instead a non-zero exit status shall be returned. Only in EAPIs listed in
39 - table~\ref{tab:commands-die-table} as supporting \t{nonfatal}.
40 + the build process due to a failure, instead a non-zero exit status shall be returned. Only in
41 + EAPIs listed in table~\ref{tab:commands-die-table} as supporting \t{nonfatal}.
42 +
43 + Explicit \t{die} or \t{assert} commands only respect \t{nonfatal} when called with the \t{-n}
44 + option and in EAPIs supporting this option, see table~\ref{tab:nonfatal-die}.
45 \end{description}
46
47 \ChangeWhenAddingAnEAPI{6}
48 @@ -117,13 +119,30 @@ stderr or some other appropriate facility.
49 These commands are used when an error is detected that will prevent the build process from
50 completing. Ebuilds must not run any of these commands once the current phase function has returned.
51 \begin{description}
52 -\item[die] Displays a failure message provided in its first and only argument, and then aborts the
53 - build process. \t{die} is \e{not} guaranteed to work correctly if called from a subshell
54 - environment.
55 +\item[die] \featurelabel{nonfatal-die} If called under the \t{nonfatal} command (as per
56 + section~\ref{sec:failure-behaviour}) and with \t{-n} as its first parameter, displays a failure
57 + message provided in its following argument and then returns a non-zero exit status. Only in
58 + EAPIs listed in table~\ref{tab:nonfatal-die} as supporting option~\t{-n}. Otherwise, displays
59 + a failure message provided in its first and only argument, and then aborts the build process.
60 + \t{die} is \e{not} guaranteed to work correctly if called from a subshell environment.
61 \item[assert] Checks the value of the shell's pipe status variable, and if any component is non-zero
62 - (indicating failure), calls \t{die} with its first argument as a failure message.
63 + (indicating failure), calls \t{die}, passing any parameters to it.
64 \end{description}
65
66 +\ChangeWhenAddingAnEAPI{6}
67 +\begin{centertable}{EAPIs supporting \t{-n} for \t{die} and \t{assert} commands}
68 + \label{tab:nonfatal-die}
69 + \begin{tabular}{ l l }
70 + \toprule
71 + \multicolumn{1}{c}{\textbf{EAPI}} &
72 + \multicolumn{1}{c}{\textbf{\t{die} and \t{assert} support \t{-n}?}} \\
73 + \midrule
74 + 0, 1, 2, 3, 4, 5 & No \\
75 + 6 & Yes \\
76 + \bottomrule
77 + \end{tabular}
78 +\end{centertable}
79 +
80 \subsubsection{Build commands}
81 These commands are used during the \t{src\_configure}, \t{src\_compile}, and \t{src\_install}
82 phases to run the package's build commands. Ebuilds must not run any of these commands once the
83 --
84 2.6.1