1 |
commit: c93d358570ce434f444c0ee59999add7bc9d9a58 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 27 21:23:22 2017 +0000 |
4 |
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 24 12:55:24 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pms.git/commit/?id=c93d3585 |
7 |
|
8 |
EAPI 7 has version manipulation and comparison functions |
9 |
|
10 |
Bug: https://bugs.gentoo.org/482170 |
11 |
|
12 |
eapi-differences.tex | 4 +++ |
13 |
pkg-mgr-commands.tex | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 84 insertions(+) |
15 |
|
16 |
diff --git a/eapi-differences.tex b/eapi-differences.tex |
17 |
index 6a2cab7..8deba55 100644 |
18 |
--- a/eapi-differences.tex |
19 |
+++ b/eapi-differences.tex |
20 |
@@ -302,6 +302,9 @@ Controllable stripping & \compactfeatureref{dostrip} & |
21 |
\t{in_iuse} & \compactfeatureref{in-iuse} & |
22 |
No & No & No & Yes & Yes \\ |
23 |
|
24 |
+\t{ver_*} commands & \compactfeatureref{ver-commands} & |
25 |
+ No & No & No & No & Yes \\ |
26 |
+ |
27 |
\t{unpack} absolute paths & \compactfeatureref{unpack-absolute} & |
28 |
No & No & No & Yes & Yes \\ |
29 |
|
30 |
@@ -484,6 +487,7 @@ EAPI 7 is EAPI 6 with the following changes: |
31 |
\item \t{die} is guaranteed to work in a subshell, \featureref{subshell-die}. |
32 |
\item \t{domo} installs to \t{/usr}, \featureref{domo-path}. |
33 |
\item Controllable stripping and \t{dostrip}, \featureref{dostrip}. |
34 |
+\item Version manipulation and comparison commands, \featureref{ver-commands}. |
35 |
\end{compactitem} |
36 |
|
37 |
\ChangeWhenAddingAnEAPI{7} |
38 |
|
39 |
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex |
40 |
index ed3af1b..b49e9b3 100644 |
41 |
--- a/pkg-mgr-commands.tex |
42 |
+++ b/pkg-mgr-commands.tex |
43 |
@@ -952,6 +952,86 @@ These functions check whitespace-separated lists for a particular value. |
44 |
\item[hasq] Deprecated synonym for \t{has}. |
45 |
\end{description} |
46 |
|
47 |
+\subsection{Version manipulation and comparison commands} |
48 |
+\featurelabel{ver-commands} |
49 |
+These commands provide utilities for working with version strings. Their availability per EAPI is |
50 |
+listed in table~\ref{tab:version-commands}. |
51 |
+ |
52 |
+For the purpose of version manipulation commands, the specification provides a method for splitting |
53 |
+an arbitrary version string (not necessarily conforming to section~\ref{sec:version-spec}) into |
54 |
+a series of version components and version separators. |
55 |
+ |
56 |
+A version component consists either purely of digits (\t{[0-9]+}) or purely of uppercase and |
57 |
+lowercase ASCII letters (\t{[A-Za-z]+}). A version separator is either a string of any other |
58 |
+characters (\t{[\textasciicircum A-Za-z0-9]}) or it occurs at the transition between a sequence |
59 |
+of digits and a sequence of letters, or vice versa. In the latter case, the version separator is |
60 |
+an empty string. |
61 |
+ |
62 |
+The version string is processed left-to-right, with the successive version components being assigned |
63 |
+successive indices starting with 1. The separator following a version component is assigned |
64 |
+the index of the preceding version component. If the first version component is preceded by |
65 |
+a non-empty string of version separator characters, this separator is assigned the index 0. |
66 |
+ |
67 |
+The version components are presumed present if not empty. The version separators between version |
68 |
+components are always presumed present, even if they are empty. The version separators preceding |
69 |
+the first version component and following the last are only presumed present if they are not empty. |
70 |
+ |
71 |
+Whenever the commands support ranges, the range is specified as a non-negative integer, optionally |
72 |
+followed by a hyphen (\t{-}), which in turn is optionally followed by another non-negative integer. |
73 |
+ |
74 |
+A single integer specifies a single component or separator index. An integer followed by a hyphen |
75 |
+specifies all components or separators starting with the one at the specified index. Two integers |
76 |
+separated by a hyphen specify a range of versions starting at the index specified by the first |
77 |
+and ending at the second, inclusively. |
78 |
+ |
79 |
+\begin{description} |
80 |
+\item[ver_cut] Takes a range as the first argument, and optionally a version string as the second. |
81 |
+ Prints a substring of the version string starting at the version component specified as start |
82 |
+ of the range and ending at the version component specified as end of the range. If the version |
83 |
+ string is not specified, \t{\$\{PVR\}} is used. |
84 |
+ |
85 |
+ If the range spans outside the present version components, the missing components and separators |
86 |
+ are presumed empty. In particular, the range starting at zero includes the zeroth version |
87 |
+ separator if present, and the range spanning past the last version component includes the suffix |
88 |
+ following it if present. A range that does not intersect with any present version components |
89 |
+ yields an empty string. |
90 |
+ |
91 |
+\item[ver_rs] Takes one or more pairs of arguments, optionally followed by a version string. |
92 |
+ Every argument pair specifies a range and a replacement string. Prints a version string after |
93 |
+ performing the specified separator substitutions. If the version string is not specified, |
94 |
+ \t{\$\{PVR\}} is used. |
95 |
+ |
96 |
+ For every argument pair specified, each of the version separators present at indices specified |
97 |
+ by the range is replaced with the replacement string, in order. If the range spans outside |
98 |
+ the range of present version separators, it is silently truncated. |
99 |
+ |
100 |
+\item[ver_test] Takes two or three arguments. In the 3-argument form, takes an LHS version string, |
101 |
+ followed by an operator, followed by an RHS version string. In the 2-argument form, the first |
102 |
+ version string is omitted and \t{\$\{PVR\}} is used as LHS version string. The operator can be |
103 |
+ \t{-eq} (equal to), \t{-ne} (not equal to), \t{-gt} (greater than), \t{-ge} (greater than or |
104 |
+ equal to), \t{-lt} (less than) or \t{-le} (less than or equal to). Returns shell true (0) if |
105 |
+ the specified relation between the LHS and RHS version strings is fulfilled. |
106 |
+ |
107 |
+ Both version strings must conform to the version specification in |
108 |
+ section~\ref{sec:version-spec}. Comparison is done using algorithm~\ref{alg:version-comparison}. |
109 |
+\end{description} |
110 |
+ |
111 |
+\ChangeWhenAddingAnEAPI{7} |
112 |
+\begin{centertable}{EAPIs supporting version manipulation commands} |
113 |
+ \label{tab:version-commands} |
114 |
+ \begin{tabular}{llll} |
115 |
+ \toprule |
116 |
+ \multicolumn{1}{c}{\textbf{EAPI}} & |
117 |
+ \multicolumn{1}{c}{\textbf{\t{ver_cut}?}} & |
118 |
+ \multicolumn{1}{c}{\textbf{\t{ver_rs}?}} & |
119 |
+ \multicolumn{1}{c}{\textbf{\t{ver_test}?}} \\ |
120 |
+ \midrule |
121 |
+ 0, 1, 2, 3, 4, 5, 6 & No & No & No \\ |
122 |
+ 7 & Yes & Yes & Yes \\ |
123 |
+ \bottomrule |
124 |
+ \end{tabular} |
125 |
+\end{centertable} |
126 |
+ |
127 |
\subsection{Misc commands} |
128 |
The following commands are always available in the ebuild environment, but don't really fit in any |
129 |
of the above categories. Ebuilds must not run any of these commands once the current phase function |