summaryrefslogtreecommitdiff
blob: 3b3f8ebcad91407c859b24a72e9d59b8c9dae011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
\chapter{Names and Versions}

\section{Restrictions upon Names}

No name may be empty. Package managers must not impose fixed upper boundaries upon the length of any
name. A package manager should indicate or reject any name that is invalid according to these rules.

\subsection{Category Names}
A category name may contain any of the characters [\t{A-Za-z0-9+\_.-}]. It must not begin with
a hyphen or a dot.

\note A hyphen is \i{not} required because of the \t{virtual} category. Usually, however, category
names will contain a hyphen.

\subsection{Package Names}
A package name may contain any of the characters [\t{A-Za-z0-9+\_-}]. It must not begin with a
hyphen, and must not end in a hyphen followed by one or more digits.

\note A package name does not include the category. The term \i{qualified package name} is used
where a \t{category/package} pair is meant.

\subsection{Slot Names}
\label{slot-names}
A slot name may contain any of the characters [\t{A-Za-z0-9+\_.-}]. It must not begin with a
hyphen or a dot.

\subsection{USE Flag Names}
A USE flag name may contain any of the characters [\t{A-Za-z0-9+\_@-}]. It must begin with an
alphanumeric character. Underscores should be considered reserved for \t{USE\_EXPAND}, as
described in section \ref{use-expand}.

\note The at-sign is required for \t{LINGUAS}.

\subsection{Repository Names}
\label{repository-names}
A repository name may contain any of the characters [\t{A-Za-z0-9\_-}]. It must not begin with a
hyphen.

\subsection{Keyword Names}
\label{keyword-names}
A keyword name may contain any of the characters [\t{A-Za-z0-9\_-}]. It must not begin with a
hyphen. In contexts where it makes sense to do so, a keyword name may be prefixed by
a tilde or a hyphen. In \t{KEYWORDS}, \t{-*} is also acceptable as a keyword, to indicate that
a package will only work on listed targets.

A tilde prefixed keyword is, by convention, used to indicate a less stable package. It is generally
assumed that any user accepting keyword \t{\textasciitilde{}foo} will also accept \t{foo}.

The exact meaning of any keywords value is beyond the scope of this specification.

\section{Version Specifications}
The package manager must not impose fixed limits upon the number of version components. No
integer part of a version specification may contain more than eight digits.

A version starts with the number part, which is in the form \t{[0-9]+($\backslash$.[0-9]+)*} (a positive
integer, followed by zero or more dot-prefixed positive integers).

This may optionally be followed by one of \t{[a-z]} (a lowercase letter).

This may be followed by zero or more of the suffixes \t{\_alpha}, \t{\_beta}, \t{\_pre},
\t{\_rc} or \t{\_p}, which themselves may be suffixed by an optional integer (if not present,
this integer is assumed to be zero).

This may optionally be followed by the suffix \t{-r} followed immediately by an integer (the
``revision number''). If this suffix is not present, it is assumed to be \t{-r0}.

\TODO{Portage has a really nasty -cvs thing that was designed to work around Portage's lack of
    ability to ignore versions it doesn't recognise. This should probably remain excluded and replaced
    by a proper solution in future EAPIs.}

\section{Version Comparison}

Version specifications are compared component by component, moving from left to right.

The first component of the number part is compared using strict integer comparison.

Any subsequent components of the number part are compared as follows:

\begin{bulletlist}
\item If neither component has a leading zero, components are compared using strict integer
  comparison.
\item Otherwise, if a component has a leading zero, any trailing zeroes in that component
  are stripped (if this makes the component empty, proceed as if it were \t{0} instead),
  and the components are compared using a stringwise comparison.
\end{bulletlist}

Note in particular that \t{1.0} is less than \t{1.0.0}.

Letter suffixes are compared alphabetically, with any letter being newer than no letter.

If the letters are equal, suffixes are compared. The ordering is \t{\_alpha} is less than
\t{\_beta} is less than \t{\_pre} is less than \t{\_rc} is less than no suffix is less than
\t{\_p}. If a suffix string is equal, the associated integer parts (which default to zero)
are compared using strict integer comparison.

If at this point the two versions are still equal, the revision number is compared. The revision
number has an optional integer suffix and is compared using strict integer comparison as per the
previous part. If the revision numbers are equal, so are the two versions.

\section{Uniqueness of versions}

No two packages in a given repository may have the same qualified package name and equal versions.
For example, a repository may not contain more than one of \t{foo-bar/baz-1.0.2},
\t{foo-bar/baz-1.0.2-r0} and \t{foo-bar/baz-1.000.2}.

% vim: set filetype=tex fileencoding=utf8 et tw=100 spell spelllang=en :