xref: /openbsd-src/share/man/man7/packages-specs.7 (revision b58b253dd2834540bbcecf776e4a518f78f35bd7)
1.\" $OpenBSD: packages-specs.7,v 1.26 2020/03/26 14:58:35 paco Exp $
2.\"
3.\" Copyright (c) 2001 Marc Espie
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: March 26 2020 $
28.Dt PACKAGES-SPECS 7
29.Os
30.Sh NAME
31.Nm packages-specs
32.Nd binary package names specifications
33.Sh DESCRIPTION
34Each package has a name consisting of at most three parts:
35.Bd -literal -offset indent
36stem-version[-flavors]
37.Ed
38.Pp
39The
40.Ar stem
41part identifies the package.
42It may contain some dashes, but its form is mostly conventional.
43For instance, japanese packages usually
44start with a
45.Sq ja
46prefix, e.g.,
47.Qq ja-kterm-6.2.0 .
48.Pp
49The
50.Ar version
51part starts at the first digit that follows a
52.Sq - ,
53and goes on up to the following
54.Sq - ,
55or to the end of the package name, whichever comes first.
56.Pp
57It is followed by the (possibly empty)
58.Op - Ns Ar flavors
59part.
60.Pp
61Thus, version numbers should always start with a digit and cannot contain
62a
63.Sq - ,
64whereas flavors should never start with a digit.
65.Pp
66All packages must have a version number.
67Normally, the version number directly matches the original software
68distribution version number, or release date.
69In case there are substantial changes in the
70.Ox
71package, a patch level marker should be appended, e.g.,
72.Sq p0 ,
73.Sq p1 ...
74For example, assuming that the screen package for release 2.8 was
75named
76.Qq screen-2.9.8
77and that an important security patch led to a newer package,
78the new package would be called
79.Qq screen-2.9.8p0 .
80Obviously, these specific markers are reserved for
81.Ox
82purposes.
83See
84.Ev REVISION
85in
86.Xr bsd.port.mk 5 .
87.Pp
88Version comparison is done using the dewey notation with a few specific rules.
89.Bl -bullet
90.It
91The version number is cut into separate parts on each dot
92.Sq \&. .
93Therefore, replace other upstream separators such as
94.Sq _
95or
96.Sq -
97with dots.
98.It
99Comparison checks each part in turn, the first part that differs yields
100a comparison result.
101.It
102If parts are numbers they are compared numerically.
103.It
104Parts can also be numbers with an optional letter appended.
105The numbers are compared numerically, and in case of equality, the letter
106makes the difference.
107.It
108Other parts are compared alphabetically.
109.It
110The last part may contain an extra suffix matching
111.Ar rc[N] ,
112.Ar beta[N] ,
113.Ar pre[N] ,
114or
115.Ar pl[N] ,
116with
117.Ar N
118an optional number.
119These correspond to traditional notations for
120.Sq release candidate ,
121.Sq beta version ,
122.Sq pre-release ,
123.Sq patch-level ,
124and are ordered accordingly, e.g.,
125.Ar beta
126is oldest,
127.Ar rc
128and
129.Ar pre
130are next (and non-comparable to one another),
131then normal version, and finally
132.Ar pl .
133.Bl -dash
134.It
135"foo-1.01" is equal to "foo-1.1", which can lead to surprises..
136.It
137"foo-1.001" is older than "foo-1.002", which in turns is older than "foo-1.0010"
138.It
139"foo-1.0rc2" is not comparable to "foo-1.0pre3"
140.It
141"bar-1.0beta3" is older than "bar-1.0rc1"
142.It
143"baz-1.0" is older than "baz-1.0pl1"
144.El
145.El
146.Pp
147In some rare cases, a change to a port would cause the version number to
148compare as older than the previous version.
149This happens if an update is reverted, if upstream's numbering scheme changes
150completely, or if their usual scheme does not align with the one used by
151.Ox .
152A version style marker, of the form
153.Sq v0 ,
154.Sq v1 ...
155can be appended to the version number (after the patch level)
156to denote the new numbering scheme.
157This marker is added by setting
158.Ev EPOCH
159in the port Makefile and it takes precedence over the regular package version.
160See
161.Xr bsd.port.mk 5 .
162.Pp
163Flavored packages will also contain a list of flavors after the version
164identifier, in a canonical order determined by
165.Ev FLAVORS
166in the corresponding port's
167.Pa Makefile .
168For instance, kterm has an xaw3d flavor:
169.Qq ja-kterm-xaw3d .
170.Pp
171Note that, to uniquely identify the version part, no flavor shall ever
172start with a digit.
173Usually, flavored packages are slightly different versions of the same
174package that offer very similar functionalities.
175.Sh CONFLICTS
176Most conflicts between packages are handled on a package name basis.
177Unless the packages have been specially prepared, it is
178normally not possible to install two packages with the same
179.Ar stem .
180.Pp
181Note that the
182.Ar stem
183ends at the
184.Ar version
185part.
186So, for instance,
187.Qq kdelibs-1.1.2
188and
189.Qq kdelibs-2.1.1
190conflict.
191But
192.Qq openldap-2.0.7
193and
194.Qq openldap-client-2.0.7
195don't.
196Neither do
197.Qq qt-1.45
198and
199.Qq qt2-3.0 .
200.Sh DEPENDENCIES
201Packages may depend on other packages, as specified by their port's
202Makefile, in a
203.Ev BUILD_DEPENDS ,
204.Ev LIB_DEPENDS ,
205.Ev TEST_DEPENDS
206or
207.Ev RUN_DEPENDS .
208All those conform to
209.Bd -literal -offset indent
210[pkgspec:]pkgpath
211.Ed
212.Pp
213The
214.Xr pkgpath 7
215part of the dependency is always used to obtain the default dependency for
216the given package (the package that will be built and installed if no package
217is found).
218The corresponding package name is also used as a package specification,
219after removing any version and flavor requirements.
220.Pp
221Without a
222.Sq pkgspec:
223part, by default, any package with the right stem will do: in effect,
224the pkgspec used is
225.Sq stem-* .
226.Pp
227In
228.Ox 4.9 ,
229the dependent port may override this default, and set
230.Ev PKGSPEC
231to achieve a more restrictive default, for instance,
232.Pa databases/db/v3
233sets the default to
234.Qq PKGSPEC = db->=3,<4
235to avoid collision with
236.Pa databases/db/v4 .
237Be extra cautious with this functionality: this tweaks the depends line for
238any including package, thus usually requiring a version bump, and is in
239general only required for very messy cases where several incompatible versions
240of the same software coexist as packages with the same stem.
241.Pp
242An explicit specification such as
243.Qq png-1.0.7 .
244may be used to ask for a more specific version number.
245Version numbers may also include ranges, separated by commas, so for
246instance,
247.Qq foo->=1.3
248would match any foo with version at least 1.3, and
249.Qq foo->=1.3,<=1.5
250would match any version of foo between 1.3 and 1.5, inclusive.
251.Pp
252As a convenience, the ports tree recognizes a specification that starts
253with STEM, and will replace this with the correct stem, which can be useful
254for embarrassingly long package names.
255.Pp
256As another convenience, the ports tree recognizes constructs like
257.Qq graphics/png>=1.2.0
258and transforms it into
259.Qq STEM->=1.2.0:graphics/png .
260More specifically, package paths never contain <, >, or =, and those
261characters trigger the transform.
262.Pp
263If the flavor specification is left blank, any flavor will do.
264Note that most default package names don't contain flavor specification,
265which means that any flavor will do
266For instance, in
267.Bd -literal -offset indent
268LIB_DEPENDS = graphics/aalib
269.Ed
270.Pp
271both
272.Qq aalib-1.2
273and
274.Qq aalib-1.2-no_x11
275will do.
276To restrict the specification to packages that match flavor
277.Sq f ,
278append
279.Sq -f .
280To restrict the specification to packages that do not match flavor
281.Sq f ,
282append
283.Sq -!f .
284In the preceding case, one may use
285.Bd -literal -offset indent
286LIB_DEPENDS = aalib-*-!no_x11:graphics/aalib
287.Ed
288.Pp
289to ensure the no_x11 flavor is not picked.
290.Sh DEPENDENCIES RESOLUTION
291Several packages may be specified for a dependency:
292.Qq foo-*|bar-*
293will match either any version of package foo, or any version of package bar.
294In the general case, each package holds a tree of dependencies.
295Resolution occurs at
296.Xr pkg_add 1
297time, and all dependencies are tracked only as far as needed.
298.Pp
299For instance, if package
300.Qq foo-1.0
301depends on either
302.Qq bar-*
303or
304.Qq fuzz-* ,
305and
306.Qq bar-2.0
307depends
308on
309.Qq toughluck-* ,
310.Xr pkg_add 1
311will first check whether
312.Qq bar-*
313or
314.Qq fuzz-*
315is installed.
316If either is there, the
317.Qq toughluck-*
318dependency will never be examined.
319It would only be used in the case where neither
320.Qq bar-*
321nor
322.Qq fuzz-*
323are present, thus
324.Xr pkg_add 1
325would decide to bring in
326.Qq bar-2.0 ,
327and so would check on
328.Qq toughluck-* .
329.Sh SEE ALSO
330.Xr pkg_add 1 ,
331.Xr bsd.port.mk 5 ,
332.Xr library-specs 7 ,
333.Xr packages 7 ,
334.Xr pkgpath 7 ,
335.Xr ports 7
336.Sh HISTORY
337Support for a more complex form of those package specifications first
338appeared in
339.Ox 2.9 .
340The current simplified form was introduced in
341.Ox 4.9 .
342