commit:     83161067ec7fd04a0a3d8dbd403732b72bf99238
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 30 21:59:50 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Oct  1 07:11:21 2017 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=83161067

[WIP] EAPI 7 limits dependency group nesting.

Restrict allowed dependency group nesting in EAPI 7. Most of the groups
can only be used at top-level and inside USE-conditional groups (which
can be reduced predictably). All-of groups are only permitted where they
are really meaningful -- in any-of groups. Any more complex nesting is
forbidden.

This not only ensures that the dependency syntax variables stay more
readable but also put lower requirements on the dependency parser
and other mechanisms working with the variables.

[TODO: add label & update eapi-differences]

Bug: https://bugs.gentoo.org/632000

 dependencies.tex | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/dependencies.tex b/dependencies.tex
index fa818b7..fd142bb 100644
--- a/dependencies.tex
+++ b/dependencies.tex
@@ -88,31 +88,36 @@ be surrounded on both sides by whitespace, except at the 
start and end of the st
     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} \t{::=} \t{'(' whitespace (item whitespace)* ')'}. Permitted in 
all specification
-    style variables.
+    style variables. Permitted inside groups listed in 
table~\ref{tab:depend-nesting}.
 \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} \t{::=} \t{'||' whitespace '(' whitespace (item 
whitespace)* ')'}.
     Permitted in \t{DEPEND}, \t{RDEPEND}, \t{PDEPEND}, \t{LICENSE}, 
\t{REQUIRED_USE}.
+    Permitted inside groups listed in table~\ref{tab:depend-nesting}.
 \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} \t{::=} 
\t{'\textasciicircum\textasciicircum'
     whitespace '(' whitespace (item whitespace)* ')'}.
-    Permitted in \t{REQUIRED_USE}.
+    Permitted in \t{REQUIRED_USE}. Permitted inside groups listed in 
table~\ref{tab:depend-nesting}.
 \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{at-most-one-of} \t{::=} \t{'??'\ 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.
+    table~\ref{tab:at-most-one-of-table} as supporting \t{REQUIRED_USE ??}\ 
groups. Permitted inside
+    groups listed in table~\ref{tab:depend-nesting}.
+
+    In EAPIs blah blah permitted only at top-level and inside USE-conditional 
group.
 \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} \t{::=} \t{'!'?\ flag-name '?'\ whitespace '(' 
whitespace (item
     whitespace)* ')'}.
-    Permitted in all specification style variables.
+    Permitted in all specification style variables. Permitted inside groups 
listed
+    in table~\ref{tab:depend-nesting}.
 \end{compactitem}
 
 In particular, note that whitespace is not optional.
@@ -159,6 +164,30 @@ In particular, note that whitespace is not optional.
     \end{tabular}
 \end{centertable}
 
+\ChangeWhenAddingAnEAPI{7}
+\begin{centertable}{EAPI-specific group nesting restrictions}
+    \label{tab:depend-nesting}
+    \begin{tabular}{lP{4em}P{4em}P{4em}P{4em}P{4em}}
+      \toprule
+      \multicolumn{1}{c}{\textbf{EAPI}} &
+      \multicolumn{1}{c}{\textbf{all-of}} &
+      \multicolumn{1}{c}{\textbf{any-of}} &
+      \multicolumn{1}{c}{\textbf{exactly-one-of}} &
+      \multicolumn{1}{c}{\textbf{at-most-one-of}} &
+      \multicolumn{1}{c}{\textbf{use-conditional}} \\
+      & \multicolumn{5}{c}{\textbf{permitted inside}} \\
+      \midrule
+      0, 1, 2, 3, 4       & all groups & all groups & all groups & n/a        
& all groups \\
+      5, 6                & all groups & all groups & all groups & all groups 
& all groups \\
+      7                   & any-of
+                          & top, use-conditional
+                          & top, use-conditional
+                          & top, use-conditional
+                          & top, use-conditional \\
+      \bottomrule
+    \end{tabular}
+\end{centertable}
+
 \subsection{All-of dependency specifications}
 
 In an all-of group, all of the child elements must be matched.

Reply via email to