commit:     9319dd91222fe5e19af9ce6b6c6a2809aca186ab
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 16 14:42:19 2015 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Oct 14 21:21:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=9319dd91

EAPI 6: die and assert called with -n respect nonfatal.

Bug: 451938

 eapi-differences.tex |  4 ++++
 pkg-mgr-commands.tex | 33 ++++++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/eapi-differences.tex b/eapi-differences.tex
index 6ec5209..2a4f840 100644
--- a/eapi-differences.tex
+++ b/eapi-differences.tex
@@ -169,6 +169,9 @@ Most utilities die & \compactfeatureref{die-on-failure} &
 Option \t{-{}-host-root} & \compactfeatureref{host-root-option} &
     No & No & No & Yes & Yes \\
 
+\t{die -n} & \compactfeatureref{nonfatal-die} &
+    No & No & No & No & Yes \\
+
 \t{econf} arguments & \compactfeatureref{econf-options} &
     &  & disable dependency tracking &
     disable dependency tracking, disable silent rules &
@@ -320,6 +323,7 @@ EAPI 6 is EAPI 5 with the following changes:
 \item Bash version is 4.2, \featureref{bash-version}.
 \item \t{failglob} is enabled in global scope, \featureref{failglob}.
 \item \t{einstall} banned, \featureref{banned-commands}.
+\item \t{die} and \t{assert} called with \t{-n} respect \t{nonfatal}, 
\featureref{nonfatal-die}.
 \end{compactitem}
 
 \ChangeWhenAddingAnEAPI{6}

diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
index 4f8c34f..fce819b 100644
--- a/pkg-mgr-commands.tex
+++ b/pkg-mgr-commands.tex
@@ -18,9 +18,11 @@ The following commands affect this behaviour:
 \begin{description}
 \item[nonfatal] \featurelabel{nonfatal} Executes the remainder of its 
arguments as a command,
     preserving the exit status. If this results in a command being called that 
would normally abort
-    the build process due to a failure (but not due to an explicit \t{die} or 
\t{assert} call),
-    instead a non-zero exit status shall be returned. Only in EAPIs listed in
-    table~\ref{tab:commands-die-table} as supporting \t{nonfatal}.
+    the build process due to a failure, instead a non-zero exit status shall 
be returned. Only in
+    EAPIs listed in table~\ref{tab:commands-die-table} as supporting 
\t{nonfatal}.
+
+    Explicit \t{die} or \t{assert} commands only respect \t{nonfatal} when 
called with the \t{-n}
+    option and in EAPIs supporting this option, see 
table~\ref{tab:nonfatal-die}.
 \end{description}
 
 \ChangeWhenAddingAnEAPI{6}
@@ -117,13 +119,30 @@ stderr or some other appropriate facility.
 These commands are used when an error is detected that will prevent the build 
process from
 completing. Ebuilds must not run any of these commands once the current phase 
function has returned.
 \begin{description}
-\item[die] Displays a failure message provided in its first and only argument, 
and then aborts the
-    build process. \t{die} is \e{not} guaranteed to work correctly if called 
from a subshell
-    environment.
+\item[die] \featurelabel{nonfatal-die} If called under the \t{nonfatal} 
command (as per
+    section~\ref{sec:failure-behaviour}) and with \t{-n} as its first 
parameter, displays a failure
+    message provided in its following argument and then returns a non-zero 
exit status. Only in
+    EAPIs listed in table~\ref{tab:nonfatal-die} as supporting option~\t{-n}. 
Otherwise, displays
+    a failure message provided in its first and only argument, and then aborts 
the build process.
+    \t{die} is \e{not} guaranteed to work correctly if called from a subshell 
environment.
 \item[assert] Checks the value of the shell's pipe status variable, and if any 
component is non-zero
-    (indicating failure), calls \t{die} with its first argument as a failure 
message.
+    (indicating failure), calls \t{die}, passing any parameters to it.
 \end{description}
 
+\ChangeWhenAddingAnEAPI{6}
+\begin{centertable}{EAPIs supporting \t{-n} for \t{die} and \t{assert} 
commands}
+    \label{tab:nonfatal-die}
+    \begin{tabular}{ l l }
+      \toprule
+      \multicolumn{1}{c}{\textbf{EAPI}} &
+      \multicolumn{1}{c}{\textbf{\t{die} and \t{assert} support \t{-n}?}} \\
+      \midrule
+      0, 1, 2, 3, 4, 5  & No  \\
+      6                 & Yes \\
+      \bottomrule
+    \end{tabular}
+\end{centertable}
+
 \subsubsection{Build commands}
 These commands are used during the \t{src\_configure}, \t{src\_compile}, and 
\t{src\_install}
 phases to run the package's build commands. Ebuilds must not run any of these 
commands once the

Reply via email to