1 |
Bug: https://bugs.gentoo.org/482170 |
2 |
--- |
3 |
eapi-differences.tex | 4 +++ |
4 |
pkg-mgr-commands.tex | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 |
2 files changed, 84 insertions(+) |
6 |
|
7 |
diff --git a/eapi-differences.tex b/eapi-differences.tex |
8 |
index 44869c0..a56f1ff 100644 |
9 |
--- a/eapi-differences.tex |
10 |
+++ b/eapi-differences.tex |
11 |
@@ -41,6 +41,9 @@ of this document for a complete table of previous EAPIs. |
12 |
\bottomrule |
13 |
\endlastfoot |
14 |
|
15 |
+\t{ver_*} functions & \compactfeatureref{ver-functions} & |
16 |
+ No & No & No & No & Yes \\ |
17 |
+ |
18 |
\t{package.mask} directory & \compactfeatureref{package-mask-dir} & |
19 |
No & No & No & No & Yes \\ |
20 |
|
21 |
@@ -383,6 +386,7 @@ EAPI 7 is EAPI 6 with the following changes: |
22 |
\item \t{package.mask}, \t{package.use}, \t{use.*} and \t{package.use.*} in a profile can be |
23 |
directories, \featureref{profile-file-dirs}. |
24 |
\item \t{dohtml} banned, \featureref{banned-commands}. |
25 |
+\item Version manipulation and comparison functions added, \featureref{ver-functions}. |
26 |
\end{compactitem} |
27 |
|
28 |
\ChangeWhenAddingAnEAPI{7} |
29 |
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex |
30 |
index e8a6555..15bfcde 100644 |
31 |
--- a/pkg-mgr-commands.tex |
32 |
+++ b/pkg-mgr-commands.tex |
33 |
@@ -817,6 +817,86 @@ These functions check whitespace-separated lists for a particular value. |
34 |
\item[hasq] Deprecated synonym for \t{has}. |
35 |
\end{description} |
36 |
|
37 |
+\subsubsection{Version manipulation and comparison commands} |
38 |
+\featurelabel{ver-functions} |
39 |
+Those functions provide routines to work with version strings. Their availability per EAPI is listed |
40 |
+in table~\ref{tab:version-functions}. |
41 |
+ |
42 |
+For the purpose of version manipulation functions, the specification provides a method for splitting |
43 |
+an arbitrary version string (not necessarily conforming to \ref{sec:version-spec}) into a series of |
44 |
+version components and version separators. |
45 |
+ |
46 |
+A version component consists either purely of digits (\t{[0-9]+}) or purely of a combination of |
47 |
+uppercase and lowercase letters (\t{[a-zA-Z]+}). A version separator is either a string of any other |
48 |
+characters (\t{[\textasciicircum 0-9a-zA-Z]}) or it occurs at the transition between a sequence of digits |
49 |
+and a sequence of letters, or vice versa. In the latter case, the version separator is an empty |
50 |
+string. |
51 |
+ |
52 |
+The version string is processed left-to-right, with the successive version components being assigned |
53 |
+successive indices starting with 1. The separator following a version component is assigned |
54 |
+the index of the preceding version component. If the first version component is preceded by |
55 |
+a non-null string of version separator characters, this separator is assigned the index 0. |
56 |
+ |
57 |
+The version components are presumed present if not empty. The version separators between version |
58 |
+components are always presumed present, even if they are empty. The version separators preceding |
59 |
+the first version component and following the last are only presumed present if they are not empty. |
60 |
+ |
61 |
+Whenever the functions support ranges, the range is specified as a non-negative integer, optionally |
62 |
+followed by a hyphen (\t{-}), which in turn is optionally followed by another non-negative integer. |
63 |
+ |
64 |
+A single integer specifies a single component or separator index. An integer followed by a hyphen |
65 |
+specifies all components or separators starting with the one at specified index. Two integers |
66 |
+separated by a hyphen specify a range of versions starting at the index specified by the first |
67 |
+and ending at the second, inclusively. |
68 |
+ |
69 |
+\begin{description} |
70 |
+\item[ver_cut] Takes a range as the first argument, and optionally a version string as the second. |
71 |
+ Prints a substring of the version string starting at the version component specified as start |
72 |
+ of the range and ending at the version component specified as end of the range. If the version |
73 |
+ string is not specified, \t{\$\{PVR\}} is used. |
74 |
+ |
75 |
+ If the range spans outside the present version components, the missing components and separators |
76 |
+ are presumed empty. In particular, the range starting at zero includes zeroth version separator |
77 |
+ if present, and the range spanning past the last version component includes the suffix following |
78 |
+ it if present. A range that does not intersect with any present version components yields empty |
79 |
+ string. |
80 |
+ |
81 |
+\item[ver_rs] Takes one or more pairs of arguments, optionally followed by a version string. Every |
82 |
+ argument pair specifies a range and a replacement string. Prints a version string after |
83 |
+ performing the specified separator substitutions. If the version string is not specified, |
84 |
+ \t{\$\{PVR\}} is used. |
85 |
+ |
86 |
+ For every argument pair specified, each of the version separators present at indices specified |
87 |
+ by the range is replaced with the replacement string, in order. If the range spans outside |
88 |
+ the range of present version separators, it is silently truncated. |
89 |
+ |
90 |
+\item[ver_test] Takes two or three arguments. In the 3-argument form, it takes a LHS version string, |
91 |
+ followed by an operator, followed by RHS version string. In the 2-argument form, the first |
92 |
+ version string is omitted and \t{\$\{PVR\}} is used as LHS version string. Returns 0 |
93 |
+ if the specified relation between LHS and RHS version strings is true. |
94 |
+ |
95 |
+ The operator can be \t{-lt}, \t{-le}, \t{-eq}, \t{-ne}, \t{-ge} and \t{-gt} to test whether |
96 |
+ LHS is respectively older than, older or equal, equal, not equal, newer or equal, and newer |
97 |
+ than RHS. Both version strings must conform to the version specification |
98 |
+ at~\ref{sec:version-spec}, the comparison is done using algorithm~\ref{alg:version-comparison}. |
99 |
+\end{description} |
100 |
+ |
101 |
+\ChangeWhenAddingAnEAPI{7} |
102 |
+\begin{centertable}{EAPIs supporting version manipulation commands} |
103 |
+ \label{tab:version-functions} |
104 |
+ \begin{tabular}{llll} |
105 |
+ \toprule |
106 |
+ \multicolumn{1}{c}{\textbf{EAPI}} & |
107 |
+ \multicolumn{1}{c}{\textbf{\t{ver_cut}?}} & |
108 |
+ \multicolumn{1}{c}{\textbf{\t{ver_rs}?}} & |
109 |
+ \multicolumn{1}{c}{\textbf{\t{ver_test}?}} \\ |
110 |
+ \midrule |
111 |
+ 0, 1, 2, 3, 4, 5, 6 & No & No & No \\ |
112 |
+ 7 & Yes & Yes & Yes \\ |
113 |
+ \bottomrule |
114 |
+ \end{tabular} |
115 |
+\end{centertable} |
116 |
+ |
117 |
\subsubsection{Misc commands} |
118 |
The following commands are always available in the ebuild environment, but don't really fit in any |
119 |
of the above categories. Ebuilds must not run any of these commands once the current phase function |
120 |
-- |
121 |
2.14.2 |