1 |
Describing it in English gets a bit messy; this is more verbose, but |
2 |
hopefully more precise. |
3 |
--- |
4 |
names.tex | 221 +++++++++++++++++++++++++++++++++++++++----------- |
5 |
pkg-mgr-commands.tex | 4 +- |
6 |
pms.cls | 2 +- |
7 |
3 files changed, 175 insertions(+), 52 deletions(-) |
8 |
|
9 |
Updated to match the old wording for -scm |
10 |
|
11 |
diff --git a/names.tex b/names.tex |
12 |
index 7bd572d..c75c2c1 100644 |
13 |
--- a/names.tex |
14 |
+++ b/names.tex |
15 |
@@ -93,63 +93,186 @@ This may optionally be followed by the suffix \t{-r} followed immediately by an |
16 |
|
17 |
\section{Version Comparison} |
18 |
|
19 |
-Version specifications are compared component by component, moving from left to right. |
20 |
- |
21 |
-\IFKDEBUILDELSE |
22 |
-{ |
23 |
- If a version starts with \t{scm}, it orders higher than any version that does not |
24 |
- start with \t{scm}. Otherwise, if neither version starts with \t{scm}, the first |
25 |
- component of the number part is compared using strict integer comparison. |
26 |
+Version comparison is defined by Algorithm~\ref{alg:version-comparison} and sub-algorithms. |
27 |
+If a sub-algorithm returns a decision, then that is the result of the whole comparison; |
28 |
+if it terminates without returning a decision, the process continues from the point |
29 |
+from which it was invoked. |
30 |
+ |
31 |
+\begin{algorithm} |
32 |
+\caption{Version comparison top-level logic} \label{alg:version-comparison} |
33 |
+\IFKDEBUILDELSE{ |
34 |
+ \begin{algorithmic}[1] |
35 |
+ \STATE let $A$ and $B$ be the versions to be compared |
36 |
+ \IF{$A$ and $B$ both begin with \t{scm}} |
37 |
+ \STATE compare revision components using Algorithm~\ref{alg:version-comparison-revision} |
38 |
+ \ELSIF{$A$ begins with \t{scm}} |
39 |
+ \RETURN $A>B$ |
40 |
+ \ELSIF{$B$ begins with \t{scm}} |
41 |
+ \RETURN $A<B$ |
42 |
+ \ELSE |
43 |
+ \STATE compare numeric components using Algorithm~\ref{alg:version-comparison-numeric} |
44 |
+ \STATE compare letter components using Algorithm~\ref{alg:version-comparison-letter} |
45 |
+ \STATE compare suffixes using Algorithm~\ref{alg:version-comparison-suffix} |
46 |
+ \STATE compare revision components using Algorithm~\ref{alg:version-comparison-revision} |
47 |
+ \ENDIF |
48 |
+ \RETURN $A=B$ |
49 |
+ \end{algorithmic} |
50 |
}{ |
51 |
- The first component of the number part is compared using strict integer comparison. |
52 |
+ \begin{algorithmic}[1] |
53 |
+ \STATE let $A$ and $B$ be the versions to be compared |
54 |
+ \STATE compare numeric components using Algorithm~\ref{alg:version-comparison-numeric} |
55 |
+ \STATE compare letter components using Algorithm~\ref{alg:version-comparison-letter} |
56 |
+ \STATE compare suffixes using Algorithm~\ref{alg:version-comparison-suffix} |
57 |
+ \STATE compare revision components using Algorithm~\ref{alg:version-comparison-revision} |
58 |
+ \RETURN $A=B$ |
59 |
+ \end{algorithmic} |
60 |
} |
61 |
+\end{algorithm} |
62 |
+ |
63 |
+\begin{algorithm} |
64 |
+\caption{Version comparison logic for numeric components} \label{alg:version-comparison-numeric} |
65 |
+\begin{algorithmic}[1] |
66 |
+ \STATE define the notations $An_k$ and $Bn_k$ to mean the $k$\textsuperscript{th} numeric component of $A$ and $B$ respectively, using $0$-based indexing |
67 |
+ \IF{$An_0>Bn_0$ using integer comparison} |
68 |
+ \RETURN $A>B$ |
69 |
+ \ELSIF{$An_0<Bn_0$ using integer comparison} |
70 |
+ \RETURN $A<B$ |
71 |
+ \ENDIF |
72 |
+ \STATE let $Ann$ be the number of numeric components of $A$ |
73 |
+ \STATE let $Bnn$ be the number of numeric components of $B$ |
74 |
+ \FORALL{$i$ such that $i\geq1$ and $i<Ann$ and $i<Bnn$, in ascending order} |
75 |
+ \STATE compare $An_i$ and $Bn_i$ using Algorithm~\ref{alg:version-comparison-numeric-nonfirst} |
76 |
+ \ENDFOR |
77 |
+ \IF{$Ann>Bnn$} |
78 |
+ \IFKDEBUILDELSE{ |
79 |
+ \IF{$B$ has any suffixes and no letter, and its first suffix is \t{-scm}} |
80 |
+ \RETURN $A<B$ |
81 |
+ \ELSE |
82 |
+ \RETURN $A>B$ |
83 |
+ \ENDIF |
84 |
+ }{ |
85 |
+ \RETURN $A>B$ |
86 |
+ } |
87 |
+ \ELSIF{$Ann<Bnn$} |
88 |
+ \IFKDEBUILDELSE{ |
89 |
+ \IF{$A$ has any suffixes and no letter, and its first suffix is \t{-scm}} |
90 |
+ \RETURN $A>B$ |
91 |
+ \ELSE |
92 |
+ \RETURN $A<B$ |
93 |
+ \ENDIF |
94 |
+ }{ |
95 |
+ \RETURN $A<B$ |
96 |
+ } |
97 |
+ \ENDIF |
98 |
+\end{algorithmic} |
99 |
+\end{algorithm} |
100 |
+ |
101 |
+\begin{algorithm} |
102 |
+\caption{Version comparison logic for each numeric component after the first} \label{alg:version-comparison-numeric-nonfirst} |
103 |
+\begin{algorithmic}[1] |
104 |
+ \IF{either $An_i$ or $Bn_i$ has a leading \t{0}} |
105 |
+ \STATE let $An'_i$ be $An_i$ with any trailing \t{0}s removed |
106 |
+ \STATE let $Bn'_i$ be $Bn_i$ with any trailing \t{0}s removed |
107 |
+ \IF{$An'_i>Bn'_i$ using ASCII stringwise comparison} |
108 |
+ \RETURN $A>B$ |
109 |
+ \ELSIF{$An'_i<Bn'_i$ using ASCII stringwise comparison} |
110 |
+ \RETURN $A<B$ |
111 |
+ \ENDIF |
112 |
+ \ELSE |
113 |
+ \IF{$An_i>Bn_i$ using integer comparison} |
114 |
+ \RETURN $A>B$ |
115 |
+ \ELSIF{$An_i<Bn_i$ using integer comparison} |
116 |
+ \RETURN $A<B$ |
117 |
+ \ENDIF |
118 |
+ \ENDIF |
119 |
+\end{algorithmic} |
120 |
+\end{algorithm} |
121 |
+ |
122 |
+\begin{algorithm} |
123 |
+\caption{Version comparison logic for letter components} \label{alg:version-comparison-letter} |
124 |
+\begin{algorithmic}[1] |
125 |
+ \STATE let $Al$ be the letter component of $A$ if any, otherwise the empty string |
126 |
+ \STATE let $Bl$ be the letter component of $B$ if any, otherwise the empty string |
127 |
+ \IF{$Al>Bl$ using ASCII stringwise comparison} |
128 |
+ \RETURN $A>B$ |
129 |
+ \ELSIF{$Al<Bl$ using ASCII stringwise comparison} |
130 |
+ \RETURN $A<B$ |
131 |
+ \ENDIF |
132 |
+\end{algorithmic} |
133 |
+\end{algorithm} |
134 |
+ |
135 |
+\begin{algorithm} |
136 |
+\caption{Version comparison logic for suffixes} \label{alg:version-comparison-suffix} |
137 |
+\begin{algorithmic}[1] |
138 |
+ \STATE define the notations $As_k$ and $Bs_k$ to mean the $k$\textsuperscript{th} suffix of $A$ and $B$ respectively, using $0$-based indexing |
139 |
+ \STATE let $Asn$ be the number of suffixes of $A$ |
140 |
+ \STATE let $Bsn$ be the number of suffixes of $B$ |
141 |
+ \FORALL{$i$ such that $i\geq0$ and $i<Asn$ and $i<Bsn$, in ascending order} |
142 |
+ \STATE compare $As_i$ and $Bs_i$ using Algorithm~\ref{alg:version-comparison-suffix-each} |
143 |
+ \ENDFOR |
144 |
+ \IF{$Asn>Bsn$} |
145 |
+ \IF{$As_{Bsn}$ is of type \t{\_p} \IFKDEBUILDELSE{or \t{-scm}}{}} |
146 |
+ \RETURN $A>B$ |
147 |
+ \ELSE |
148 |
+ \RETURN $A<B$ |
149 |
+ \ENDIF |
150 |
+ \ELSIF{$Asn<Bsn$} |
151 |
+ \IF{$Bs_{Asn}$ is of type \t{\_p} \IFKDEBUILDELSE{or \t{-scm}}{}} |
152 |
+ \RETURN $A<B$ |
153 |
+ \ELSE |
154 |
+ \RETURN $A>B$ |
155 |
+ \ENDIF |
156 |
+ \ENDIF |
157 |
+\end{algorithmic} |
158 |
+\end{algorithm} |
159 |
+ |
160 |
+\begin{algorithm} |
161 |
+\caption{Version comparison logic for each suffix} \label{alg:version-comparison-suffix-each} |
162 |
+\begin{algorithmic}[1] |
163 |
+ \IF{$As_i$ and $Bs_i$ are of the same type (\t{\_alpha} vs \t{\_beta} etc)} |
164 |
+ \STATE let $As'_i$ be the integer part of $As_i$ if any, otherwise \IFKDEBUILDELSE{as specified by Algorithm~\ref{alg:version-comparison-suffix-missingint}}{\t{0}} |
165 |
+ \STATE let $Bs'_i$ be the integer part of $Bs_i$ if any, otherwise \IFKDEBUILDELSE{as specified by Algorithm~\ref{alg:version-comparison-suffix-missingint}}{\t{0}} |
166 |
+ \IF{$As'_i>Bs'_i$, using integer comparison \IFKDEBUILDELSE{and with $\infty$ greater than any integer}{}} |
167 |
+ \RETURN $A>B$ |
168 |
+ \ELSIF{$As'_i<Bs'_i$, using integer comparison \IFKDEBUILDELSE{and with $\infty$ greater than any integer}{}} |
169 |
+ \RETURN $A<B$ |
170 |
+ \ENDIF |
171 |
+ \ELSIF{the type of $As_i$ is greater than the type of $Bs_i$ using the ordering $\mbox{\t{\_alpha}}<\mbox{\t{\_beta}}<\mbox{\t{\_pre}}<\mbox{\t{\_rc}}<\mbox{\t{\_p}}\IFKDEBUILDELSE{<\mbox{\t{-scm}}}{}$} |
172 |
+ \RETURN $A>B$ |
173 |
+ \ELSE |
174 |
+ \RETURN $A<B$ |
175 |
+ \ENDIF |
176 |
+\end{algorithmic} |
177 |
+\end{algorithm} |
178 |
|
179 |
-Any subsequent components of the number part are compared as follows: |
180 |
- |
181 |
-\begin{compactitem} |
182 |
-\item If neither component has a leading zero, components are compared using strict integer |
183 |
- comparison. |
184 |
-\item Otherwise, if a component has a leading zero, any trailing zeroes in that component |
185 |
- are stripped (if this makes the component empty, proceed as if it were \t{0} instead), |
186 |
- and the components are compared using a stringwise comparison. |
187 |
-\end{compactitem} |
188 |
- |
189 |
-\IFKDEBUILDELSE |
190 |
-{ |
191 |
- If one number part is a prefix of the other, then the version with the longer number |
192 |
- part is greater, unless the shorter part is immediately followed by \t{-scm}, in which |
193 |
- case the version with the shorter part is greater. |
194 |
-}{ |
195 |
- If one number part is a prefix of the other, then the version with the longer number |
196 |
- part is greater. |
197 |
-} |
198 |
-Note in particular that \t{1.0} is less than \t{1.0.0}. |
199 |
- |
200 |
-Letter suffixes are compared alphabetically, with any letter being newer than no letter. |
201 |
- |
202 |
-If the letters are equal, suffixes are compared. |
203 |
-\IFKDEBUILDELSE |
204 |
-{ |
205 |
- The ordering is \t{\_alpha} is less than \t{\_beta} is less than \t{\_pre} is less |
206 |
- than \t{\_rc} is less than no suffix is less than \t{\_p} is less than \t{-scm}. |
207 |
-}{ |
208 |
- The ordering is \t{\_alpha} is less than \t{\_beta} is less than \t{\_pre} is less |
209 |
- than \t{\_rc} is less than no suffix is less than \t{\_p}. |
210 |
-} |
211 |
-If a suffix string is equal, the associated integer parts |
212 |
-\IFKDEBUILDELSE{(except for \t{scm} parts)}{} |
213 |
-are compared using strict integer comparison. |
214 |
\IFKDEBUILDELSE |
215 |
{ |
216 |
- A missing integer part is treated as zero, unless the suffix is directly followed |
217 |
- by \t{-scm}, in which case it is treated as being higher than any integer. |
218 |
+ \begin{algorithm} |
219 |
+ \caption{Deciding an unspecified integer part of a suffix component, for comparison purposes} \label{alg:version-comparison-suffix-missingint} |
220 |
+ \begin{algorithmic}[1] |
221 |
+ \STATE let $X$ refer to either $A$ or $B$, whichever version contains the suffix under question |
222 |
+ \IF{$i+1<Xsn$ and $Xs_{i+1}$ is of type \t{-scm}} |
223 |
+ \STATE let $Xs'_i$ be $\infty$ |
224 |
+ \ELSE |
225 |
+ \STATE let $Xs'_i$ be \t{0} |
226 |
+ \ENDIF |
227 |
+ \end{algorithmic} |
228 |
+ \end{algorithm} |
229 |
}{ |
230 |
- A missing integer part is treated as zero. |
231 |
} |
232 |
|
233 |
-If at this point the two versions are still equal, the revision number is compared using strict |
234 |
-integer comparison as per the previous part. If the revision numbers are equal, so are the two |
235 |
-versions. |
236 |
+\begin{algorithm} |
237 |
+\caption{Version comparison logic for revision components} \label{alg:version-comparison-revision} |
238 |
+\begin{algorithmic}[1] |
239 |
+ \STATE let $Ar$ be the integer part of the revision component of $A$ if any, otherwise $\t{0}$ |
240 |
+ \STATE let $Br$ be the integer part of the revision component of $B$ if any, otherwise $\t{0}$ |
241 |
+ \IF{$Ar>Br$ using integer comparison} |
242 |
+ \RETURN $A>B$ |
243 |
+ \ELSIF{$Ar<Br$ using integer comparison} |
244 |
+ \RETURN $A<B$ |
245 |
+ \ENDIF |
246 |
+\end{algorithmic} |
247 |
+\end{algorithm} |
248 |
|
249 |
\section{Uniqueness of versions} |
250 |
|
251 |
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex |
252 |
index ff2b9a6..7a5fdac 100644 |
253 |
--- a/pkg-mgr-commands.tex |
254 |
+++ b/pkg-mgr-commands.tex |
255 |
@@ -340,8 +340,8 @@ that can be passed to \t{dohtml} are as follows: |
256 |
\t{INSDESTTREE}, by default with file mode \t{0644}. This can be overridden by setting |
257 |
\t{INSOPTIONS} with the \t{insopts} function. If the first argument is \t{-r}, then operates |
258 |
recursively, descending into any directories given. For EAPIs listed in |
259 |
- table~\ref{tab:doins-table}, \t{doins} must install symlinks as symlinks; |
260 |
- for other EAPIs, behaviour is undefined if any symlink is encountered. Failure |
261 |
+ table~\ref{tab:doins-table}, \t{doins} must install symlinks as symlinks when installing |
262 |
+ recursively; for other EAPIs, behaviour is undefined if any symlink is encountered. Failure |
263 |
behaviour is EAPI dependent as per section~\ref{sec:failure-behaviour}. |
264 |
|
265 |
\item[dolib] For each argument, installs it into the appropriate library directory as determined by |
266 |
diff --git a/pms.cls b/pms.cls |
267 |
index 05d44b0..df15108 100644 |
268 |
--- a/pms.cls |
269 |
+++ b/pms.cls |
270 |
@@ -100,7 +100,7 @@ |
271 |
% Enable the below option if you'd like to see both sides of KDEBUILD |
272 |
% conditionals shown in different colours. Disable it to either fully |
273 |
% enable or fully disable KDEBUILD. Not compatible with HTML output. |
274 |
-\setboolean{ENABLE-ALL-OPTIONS}{false} |
275 |
+\setboolean{ENABLE-ALL-OPTIONS}{true} |
276 |
|
277 |
% Enable the below if you'd like to see KDEBUILD things. |
278 |
\setboolean{ENABLE-KDEBUILD}{true} |
279 |
-- |
280 |
1.6.4.4 |