xref: /openbsd-src/share/man/man7/packages-specs.7 (revision 5a38ef86d0b61900239c7913d24a05e7b88a58f0)
1.\" $OpenBSD: packages-specs.7,v 1.28 2021/11/17 12:53:05 espie 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: November 17 2021 $
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 alpha[N] ,
113.Ar beta[N] ,
114.Ar pre[N] ,
115or
116.Ar pl[N] ,
117with
118.Ar N
119an optional number.
120These correspond to traditional notations for
121.Sq release candidate ,
122.Sq alpha version ,
123.Sq beta version ,
124.Sq pre-release ,
125.Sq patch-level ,
126and are ordered accordingly, e.g.,
127.Ar alpha
128is oldest, then
129.Ar beta ,
130.Ar rc
131and
132.Ar pre
133are next (and non-comparable to one another),
134then normal version, and finally
135.Ar pl .
136.Bl -dash
137.It
138"foo-1.01" is equal to "foo-1.1", which can lead to surprises..
139.It
140"foo-1.001" is older than "foo-1.002", which in turns is older than "foo-1.0010"
141.It
142"foo-1.0rc2" is not comparable to "foo-1.0pre3"
143.It
144"bar-1.0alpha5" is older than "bar-1.0beta3"
145.It
146"bar-1.0beta3" is older than "bar-1.0rc1"
147.It
148"baz-1.0" is older than "baz-1.0pl1"
149.El
150.El
151.Pp
152In some rare cases, a change to a port would cause the version number to
153compare as older than the previous version.
154This happens if an update is reverted, if upstream's numbering scheme changes
155completely, or if their usual scheme does not align with the one used by
156.Ox .
157A version style marker, of the form
158.Sq v0 ,
159.Sq v1 ...
160can be appended to the version number (after the patch level)
161to denote the new numbering scheme.
162This marker is added by setting
163.Ev EPOCH
164in the port Makefile and it takes precedence over the regular package version.
165See
166.Xr bsd.port.mk 5 .
167.Pp
168Flavored packages will also contain a list of flavors after the version
169identifier, in a canonical order determined by
170.Ev FLAVORS
171in the corresponding port's
172.Pa Makefile .
173For instance, kterm has an xaw3d flavor:
174.Qq ja-kterm-xaw3d .
175.Pp
176Note that, to uniquely identify the version part, no flavor shall ever
177start with a digit.
178Usually, flavored packages are slightly different versions of the same
179package that offer very similar functionalities.
180.Pp
181Also note that user commands have short-hands for installing new packages
182that are substantially different from formal
183.Nm
184(branch specifications and explicit flavoring).
185The special character
186.Sq %
187is explicitly forbidden in formal package names and specs.
188.Sh CONFLICTS
189Most conflicts between packages are handled on a package name basis.
190Unless the packages have been specially prepared, it is
191normally not possible to install two packages with the same
192.Ar stem .
193.Pp
194Note that the
195.Ar stem
196ends at the
197.Ar version
198part.
199So, for instance,
200.Qq kdelibs-1.1.2
201and
202.Qq kdelibs-2.1.1
203conflict.
204But
205.Qq openldap-2.0.7
206and
207.Qq openldap-client-2.0.7
208don't.
209Neither do
210.Qq qt-1.45
211and
212.Qq qt2-3.0 .
213.Sh DEPENDENCIES
214Packages may depend on other packages, as specified by their port's
215Makefile, in a
216.Ev BUILD_DEPENDS ,
217.Ev LIB_DEPENDS ,
218.Ev TEST_DEPENDS
219or
220.Ev RUN_DEPENDS .
221All those conform to
222.Bd -literal -offset indent
223[pkgspec:]pkgpath
224.Ed
225.Pp
226The
227.Xr pkgpath 7
228part of the dependency is always used to obtain the default dependency for
229the given package (the package that will be built and installed if no package
230is found).
231The corresponding package name is also used as a package specification,
232after removing any version and flavor requirements.
233.Pp
234Without a
235.Sq pkgspec:
236part, by default, any package with the right stem will do: in effect,
237the pkgspec used is
238.Sq stem-* .
239.Pp
240In
241.Ox 4.9 ,
242the dependent port may override this default, and set
243.Ev PKGSPEC
244to achieve a more restrictive default, for instance,
245.Pa databases/db/v3
246sets the default to
247.Qq PKGSPEC = db->=3,<4
248to avoid collision with
249.Pa databases/db/v4 .
250Be extra cautious with this functionality: this tweaks the depends line for
251any including package, thus usually requiring a version bump, and is in
252general only required for very messy cases where several incompatible versions
253of the same software coexist as packages with the same stem.
254.Pp
255An explicit specification such as
256.Qq png-1.0.7 .
257may be used to ask for a more specific version number.
258Version numbers may also include ranges, separated by commas, so for
259instance,
260.Qq foo->=1.3
261would match any foo with version at least 1.3, and
262.Qq foo->=1.3,<=1.5
263would match any version of foo between 1.3 and 1.5, inclusive.
264.Pp
265As a convenience, the ports tree recognizes a specification that starts
266with STEM, and will replace this with the correct stem, which can be useful
267for embarrassingly long package names.
268.Pp
269As another convenience, the ports tree recognizes constructs like
270.Qq graphics/png>=1.2.0
271and transforms it into
272.Qq STEM->=1.2.0:graphics/png .
273More specifically, package paths never contain <, >, or =, and those
274characters trigger the transform.
275.Pp
276If the flavor specification is left blank, any flavor will do.
277Note that most default package names don't contain flavor specification,
278which means that any flavor will do
279For instance, in
280.Bd -literal -offset indent
281LIB_DEPENDS = graphics/aalib
282.Ed
283.Pp
284both
285.Qq aalib-1.2
286and
287.Qq aalib-1.2-no_x11
288will do.
289To restrict the specification to packages that match flavor
290.Sq f ,
291append
292.Sq -f .
293To restrict the specification to packages that do not match flavor
294.Sq f ,
295append
296.Sq -!f .
297In the preceding case, one may use
298.Bd -literal -offset indent
299LIB_DEPENDS = aalib-*-!no_x11:graphics/aalib
300.Ed
301.Pp
302to ensure the no_x11 flavor is not picked.
303.Sh DEPENDENCIES RESOLUTION
304Several packages may be specified for a dependency:
305.Qq foo-*|bar-*
306will match either any version of package foo, or any version of package bar.
307In the general case, each package holds a tree of dependencies.
308Resolution occurs at
309.Xr pkg_add 1
310time, and all dependencies are tracked only as far as needed.
311.Pp
312For instance, if package
313.Qq foo-1.0
314depends on either
315.Qq bar-*
316or
317.Qq fuzz-* ,
318and
319.Qq bar-2.0
320depends
321on
322.Qq toughluck-* ,
323.Xr pkg_add 1
324will first check whether
325.Qq bar-*
326or
327.Qq fuzz-*
328is installed.
329If either is there, the
330.Qq toughluck-*
331dependency will never be examined.
332It would only be used in the case where neither
333.Qq bar-*
334nor
335.Qq fuzz-*
336are present, thus
337.Xr pkg_add 1
338would decide to bring in
339.Qq bar-2.0 ,
340and so would check on
341.Qq toughluck-* .
342.Sh SEE ALSO
343.Xr pkg_add 1 ,
344.Xr bsd.port.mk 5 ,
345.Xr library-specs 7 ,
346.Xr packages 7 ,
347.Xr pkgpath 7 ,
348.Xr ports 7
349.Sh HISTORY
350Support for a more complex form of those package specifications first
351appeared in
352.Ox 2.9 .
353The current simplified form was introduced in
354.Ox 4.9 .
355