Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-pms
 `Describing it in English gets a bit messy; this is more verbose, but hopefully more precise. --- names.tex | 221 +++++++++++++++++++++++++++++++++++++++----------- pkg-mgr-commands.tex | 4 +- pms.cls | 2 +- 3 files changed, 175 insertions(+), 52 deletions(-) Updated to match the old wording for -scm diff --git a/names.tex b/names.tex index 7bd572d..c75c2c1 100644 --- a/names.tex +++ b/names.tex @@ -93,63 +93,186 @@ This may optionally be followed by the suffix \t{-r} followed immediately by an \section{Version Comparison} -Version specifications are compared component by component, moving from left to right. - -\IFKDEBUILDELSE -{ - If a version starts with \t{scm}, it orders higher than any version that does not - start with \t{scm}. Otherwise, if neither version starts with \t{scm}, the first - component of the number part is compared using strict integer comparison. +Version comparison is defined by Algorithm~\ref{alg:version-comparison} and sub-algorithms. +If a sub-algorithm returns a decision, then that is the result of the whole comparison; +if it terminates without returning a decision, the process continues from the point +from which it was invoked. + +\begin{algorithm} +\caption{Version comparison top-level logic} \label{alg:version-comparison} +\IFKDEBUILDELSE{ + \begin{algorithmic}[1] + \STATE let $A$ and $B$ be the versions to be compared + \IF{$A$ and $B$ both begin with \t{scm}} + \STATE compare revision components using Algorithm~\ref{alg:version-comparison-revision} + \ELSIF{$A$ begins with \t{scm}} + \RETURN $A>B$ + \ELSIF{$B$ begins with \t{scm}} + \RETURN $ABn_0$ using integer comparison} + \RETURN $A>B$ + \ELSIF{$An_0Bnn$} + \IFKDEBUILDELSE{ + \IF{$B$ has any suffixes and no letter, and its first suffix is \t{-scm}} + \RETURN $AB$ + \ENDIF + }{ + \RETURN $A>B$ + } + \ELSIF{$AnnB$ + \ELSE + \RETURN $ABn'_i$ using ASCII stringwise comparison} + \RETURN $A>B$ + \ELSIF{$An'_iBn_i$ using integer comparison} + \RETURN $A>B$ + \ELSIF{$An_iBl$ using ASCII stringwise comparison} + \RETURN $A>B$ + \ELSIF{$AlBsn$} + \IF{$As_{Bsn}$ is of type \t{\_p} \IFKDEBUILDELSE{or \t{-scm}}{}} + \RETURN $A>B$ + \ELSE + \RETURN $AB$ + \ENDIF + \ENDIF +\end{algorithmic} +\end{algorithm} + +\begin{algorithm} +\caption{Version comparison logic for each suffix} \label{alg:version-comparison-suffix-each} +\begin{algorithmic}[1] + \IF{$As_i$ and $Bs_i$ are of the same type (\t{\_alpha} vs \t{\_beta} etc)} + \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}} + \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}} + \IF{$As'_i>Bs'_i$, using integer comparison \IFKDEBUILDELSE{and with $\infty$ greater than any integer}{}} + \RETURN $A>B$ + \ELSIF{$As'_iB$ + \ELSE + \RETURN $ABr$ using integer comparison} + \RETURN $A>B$ + \ELSIF{\$Ar