xref: /openbsd-src/share/man/man7/packages-specs.7 (revision bcc953340d3a77ddd01c2565bd38a80ef0d197b7)
1*bcc95334Stb.\" $OpenBSD: packages-specs.7,v 1.31 2024/10/09 07:25:35 tb Exp $
2fcf14fc5Sespie.\"
3fcf14fc5Sespie.\" Copyright (c) 2001 Marc Espie
4fcf14fc5Sespie.\"
5fcf14fc5Sespie.\" All rights reserved.
6fcf14fc5Sespie.\"
7fcf14fc5Sespie.\" Redistribution and use in source and binary forms, with or without
8fcf14fc5Sespie.\" modification, are permitted provided that the following conditions
9fcf14fc5Sespie.\" are met:
10fcf14fc5Sespie.\" 1. Redistributions of source code must retain the above copyright
11fcf14fc5Sespie.\"    notice, this list of conditions and the following disclaimer.
12fcf14fc5Sespie.\" 2. Redistributions in binary form must reproduce the above copyright
13fcf14fc5Sespie.\"    notice, this list of conditions and the following disclaimer in the
14fcf14fc5Sespie.\"    documentation and/or other materials provided with the distribution.
15fcf14fc5Sespie.\"
16fcf14fc5Sespie.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17fcf14fc5Sespie.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18fcf14fc5Sespie.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19fcf14fc5Sespie.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20fcf14fc5Sespie.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21fcf14fc5Sespie.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22fcf14fc5Sespie.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23fcf14fc5Sespie.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24fcf14fc5Sespie.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25fcf14fc5Sespie.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26fcf14fc5Sespie.\"
277b7a4ab2Ssemarie.Dd $Mdocdate: October 9 2024 $
28fcf14fc5Sespie.Dt PACKAGES-SPECS 7
29fcf14fc5Sespie.Os
30fcf14fc5Sespie.Sh NAME
31fcf14fc5Sespie.Nm packages-specs
32fcf14fc5Sespie.Nd binary package names specifications
33fcf14fc5Sespie.Sh DESCRIPTION
34fcf14fc5SespieEach package has a name consisting of at most three parts:
35fcf14fc5Sespie.Bd -literal -offset indent
36fcf14fc5Sespiestem-version[-flavors]
37fcf14fc5Sespie.Ed
38fcf14fc5Sespie.Pp
39fcf14fc5SespieThe
40fcf14fc5Sespie.Ar stem
41fcf14fc5Sespiepart identifies the package.
42fcf14fc5SespieIt may contain some dashes, but its form is mostly conventional.
43fcf14fc5SespieFor instance, japanese packages usually
44fcf14fc5Sespiestart with a
45fcf14fc5Sespie.Sq ja
46fcf14fc5Sespieprefix, e.g.,
47fcf14fc5Sespie.Qq ja-kterm-6.2.0 .
48fcf14fc5Sespie.Pp
49fcf14fc5SespieThe
50fcf14fc5Sespie.Ar version
51fcf14fc5Sespiepart starts at the first digit that follows a
52fcf14fc5Sespie.Sq - ,
53fcf14fc5Sespieand goes on up to the following
54fcf14fc5Sespie.Sq - ,
55bc04cc2dSespieor to the end of the package name, whichever comes first.
56bc04cc2dSespie.Pp
57bc04cc2dSespieIt is followed by the (possibly empty)
58bc04cc2dSespie.Op - Ns Ar flavors
59bc04cc2dSespiepart.
60bc04cc2dSespie.Pp
61bc04cc2dSespieThus, version numbers should always start with a digit and cannot contain
62bc04cc2dSespiea
63bc04cc2dSespie.Sq - ,
64bc04cc2dSespiewhereas flavors should never start with a digit.
65bc04cc2dSespie.Pp
66ca4914a2SespieAll packages must have a version number.
67fcf14fc5SespieNormally, the version number directly matches the original software
68fcf14fc5Sespiedistribution version number, or release date.
69fcf14fc5SespieIn case there are substantial changes in the
70fcf14fc5Sespie.Ox
71fcf14fc5Sespiepackage, a patch level marker should be appended, e.g.,
726a48d88cSlandry.Sq p0 ,
736a48d88cSlandry.Sq p1 ...
74fcf14fc5SespieFor example, assuming that the screen package for release 2.8 was
75fcf14fc5Sespienamed
76fcf14fc5Sespie.Qq screen-2.9.8
77fcf14fc5Sespieand that an important security patch led to a newer package,
78fcf14fc5Sespiethe new package would be called
796a48d88cSlandry.Qq screen-2.9.8p0 .
80fcf14fc5SespieObviously, these specific markers are reserved for
81fcf14fc5Sespie.Ox
82fcf14fc5Sespiepurposes.
8311fa7134SespieSee
8411fa7134Sespie.Ev REVISION
8511fa7134Sespiein
8611fa7134Sespie.Xr bsd.port.mk 5 .
87fcf14fc5Sespie.Pp
889e42a63bSespieVersion comparison is done using the dewey notation with a few specific rules.
899e42a63bSespie.Bl -bullet
909e42a63bSespie.It
919e42a63bSespieThe version number is cut into separate parts on each dot
929e42a63bSespie.Sq \&. .
93bc04cc2dSespieTherefore, replace other upstream separators such as
94bc04cc2dSespie.Sq _
95bc04cc2dSespieor
96bc04cc2dSespie.Sq -
97bc04cc2dSespiewith dots.
989e42a63bSespie.It
999e42a63bSespieComparison checks each part in turn, the first part that differs yields
1009e42a63bSespiea comparison result.
1019e42a63bSespie.It
10241ce3b17SnaddyIf parts are numbers, they are compared numerically.
1039e42a63bSespie.It
1049e42a63bSespieParts can also be numbers with an optional letter appended.
1059e42a63bSespieThe numbers are compared numerically, and in case of equality, the letter
1069e42a63bSespiemakes the difference.
1079e42a63bSespie.It
1089e42a63bSespieOther parts are compared alphabetically.
1099e42a63bSespie.It
1109e42a63bSespieThe last part may contain an extra suffix matching
1119e42a63bSespie.Ar rc[N] ,
112044f8b13Sjca.Ar alpha[N] ,
1139e42a63bSespie.Ar beta[N] ,
1149e42a63bSespie.Ar pre[N] ,
1159e42a63bSespieor
1169e42a63bSespie.Ar pl[N] ,
1179e42a63bSespiewith
1189e42a63bSespie.Ar N
1199e42a63bSespiean optional number.
1209e42a63bSespieThese correspond to traditional notations for
1219e42a63bSespie.Sq release candidate ,
122044f8b13Sjca.Sq alpha version ,
1239e42a63bSespie.Sq beta version ,
1249e42a63bSespie.Sq pre-release ,
1259e42a63bSespie.Sq patch-level ,
1269e42a63bSespieand are ordered accordingly, e.g.,
127044f8b13Sjca.Ar alpha
128044f8b13Sjcais oldest, then
129044f8b13Sjca.Ar beta ,
1309e42a63bSespie.Ar rc
1319e42a63bSespieand
1329e42a63bSespie.Ar pre
1339e42a63bSespieare next (and non-comparable to one another),
1349e42a63bSespiethen normal version, and finally
1359e42a63bSespie.Ar pl .
136cf81926aSlandry.Bl -dash
137cf81926aSlandry.It
138cf81926aSlandry"foo-1.01" is equal to "foo-1.1", which can lead to surprises..
139cf81926aSlandry.It
140cf81926aSlandry"foo-1.001" is older than "foo-1.002", which in turns is older than "foo-1.0010"
141cf81926aSlandry.It
142cf81926aSlandry"foo-1.0rc2" is not comparable to "foo-1.0pre3"
143cf81926aSlandry.It
144044f8b13Sjca"bar-1.0alpha5" is older than "bar-1.0beta3"
145044f8b13Sjca.It
146cf81926aSlandry"bar-1.0beta3" is older than "bar-1.0rc1"
147cf81926aSlandry.It
148cf81926aSlandry"baz-1.0" is older than "baz-1.0pl1"
149cf81926aSlandry.El
1509e42a63bSespie.El
1519e42a63bSespie.Pp
152b58b253dSpacoIn some rare cases, a change to a port would cause the version number to
153b58b253dSpacocompare as older than the previous version.
154b58b253dSpacoThis happens if an update is reverted, if upstream's numbering scheme changes
155b58b253dSpacocompletely, or if their usual scheme does not align with the one used by
156b58b253dSpaco.Ox .
157ca4914a2SespieA version style marker, of the form
158ca4914a2Sespie.Sq v0 ,
159ca4914a2Sespie.Sq v1 ...
160ca4914a2Sespiecan be appended to the version number (after the patch level)
161ca4914a2Sespieto denote the new numbering scheme.
162b58b253dSpacoThis marker is added by setting
16311fa7134Sespie.Ev EPOCH
164b58b253dSpacoin the port Makefile and it takes precedence over the regular package version.
165b58b253dSpacoSee
16611fa7134Sespie.Xr bsd.port.mk 5 .
167ca4914a2Sespie.Pp
168fcf14fc5SespieFlavored packages will also contain a list of flavors after the version
169fcf14fc5Sespieidentifier, in a canonical order determined by
170fcf14fc5Sespie.Ev FLAVORS
171fcf14fc5Sespiein the corresponding port's
172fcf14fc5Sespie.Pa Makefile .
173fcf14fc5SespieFor instance, kterm has an xaw3d flavor:
174fcf14fc5Sespie.Qq ja-kterm-xaw3d .
175fcf14fc5Sespie.Pp
176fcf14fc5SespieNote that, to uniquely identify the version part, no flavor shall ever
177fcf14fc5Sespiestart with a digit.
178fcf14fc5SespieUsually, flavored packages are slightly different versions of the same
179fcf14fc5Sespiepackage that offer very similar functionalities.
180deab12e5Sespie.Pp
181deab12e5SespieAlso note that user commands have short-hands for installing new packages
182deab12e5Sespiethat are substantially different from formal
183deab12e5Sespie.Nm
184deab12e5Sespie(branch specifications and explicit flavoring).
185deab12e5SespieThe special character
186deab12e5Sespie.Sq %
187deab12e5Sespieis explicitly forbidden in formal package names and specs.
1887b7a4ab2Ssemarie.Pp
1897b7a4ab2Ssemarie.Xr pkg_check-version 1
1907b7a4ab2Ssemariecan be used to verify the ordering of package names.
191fcf14fc5Sespie.Sh CONFLICTS
192b3c75b6fSmpechMost conflicts between packages are handled on a package name basis.
193b3c75b6fSmpechUnless the packages have been specially prepared, it is
194fcf14fc5Sespienormally not possible to install two packages with the same
195fcf14fc5Sespie.Ar stem .
196fcf14fc5Sespie.Pp
197fcf14fc5SespieNote that the
198fcf14fc5Sespie.Ar stem
199fcf14fc5Sespieends at the
200fcf14fc5Sespie.Ar version
201b3c75b6fSmpechpart.
202b3c75b6fSmpechSo, for instance,
203fcf14fc5Sespie.Qq kdelibs-1.1.2
204fcf14fc5Sespieand
205fcf14fc5Sespie.Qq kdelibs-2.1.1
206fcf14fc5Sespieconflict.
207fcf14fc5SespieBut
208fcf14fc5Sespie.Qq openldap-2.0.7
209fcf14fc5Sespieand
210fcf14fc5Sespie.Qq openldap-client-2.0.7
211fcf14fc5Sespiedon't.
212fcf14fc5SespieNeither do
213fcf14fc5Sespie.Qq qt-1.45
214fcf14fc5Sespieand
215fcf14fc5Sespie.Qq qt2-3.0 .
216fcf14fc5Sespie.Sh DEPENDENCIES
217fcf14fc5SespiePackages may depend on other packages, as specified by their port's
218c4a184d2SespieMakefile, in a
219c4a184d2Sespie.Ev BUILD_DEPENDS ,
220c4a184d2Sespie.Ev LIB_DEPENDS ,
221702eb08cSgsoares.Ev TEST_DEPENDS
222c4a184d2Sespieor
223c4a184d2Sespie.Ev RUN_DEPENDS .
224c4a184d2SespieAll those conform to
225c4a184d2Sespie.Bd -literal -offset indent
226f55bf397Sespie[pkgspec:]pkgpath
227c4a184d2Sespie.Ed
228c4a184d2Sespie.Pp
229c4a184d2SespieThe
230f55bf397Sespie.Xr pkgpath 7
231fcf14fc5Sespiepart of the dependency is always used to obtain the default dependency for
232ca4914a2Sespiethe given package (the package that will be built and installed if no package
233fcf14fc5Sespieis found).
234fcf14fc5SespieThe corresponding package name is also used as a package specification,
235ca4914a2Sespieafter removing any version and flavor requirements.
236fcf14fc5Sespie.Pp
2372975809cSespieWithout a
238*bcc95334Stb.Sq pkgspec\&:
239e7488df5Sespiepart, by default, any package with the right stem will do: in effect,
240c4a184d2Sespiethe pkgspec used is
241c4a184d2Sespie.Sq stem-* .
242c4a184d2Sespie.Pp
243e7488df5SespieIn
244e7488df5Sespie.Ox 4.9 ,
245e7488df5Sespiethe dependent port may override this default, and set
246e7488df5Sespie.Ev PKGSPEC
247e7488df5Sespieto achieve a more restrictive default, for instance,
248e7488df5Sespie.Pa databases/db/v3
249e7488df5Sespiesets the default to
250e7488df5Sespie.Qq PKGSPEC = db->=3,<4
251e7488df5Sespieto avoid collision with
252e7488df5Sespie.Pa databases/db/v4 .
253e7488df5SespieBe extra cautious with this functionality: this tweaks the depends line for
254e7488df5Sespieany including package, thus usually requiring a version bump, and is in
255e7488df5Sespiegeneral only required for very messy cases where several incompatible versions
256e7488df5Sespieof the same software coexist as packages with the same stem.
257e7488df5Sespie.Pp
258ca4914a2SespieAn explicit specification such as
259ca4914a2Sespie.Qq png-1.0.7 .
2602975809cSespiemay be used to ask for a more specific version number.
261fcf14fc5SespieVersion numbers may also include ranges, separated by commas, so for
262fcf14fc5Sespieinstance,
263ca4914a2Sespie.Qq foo->=1.3
264ca4914a2Sespiewould match any foo with version at least 1.3, and
265ca4914a2Sespie.Qq foo->=1.3,<=1.5
266ca4914a2Sespiewould match any version of foo between 1.3 and 1.5, inclusive.
267fcf14fc5Sespie.Pp
2682975809cSespieAs a convenience, the ports tree recognizes a specification that starts
2692975809cSespiewith STEM, and will replace this with the correct stem, which can be useful
2702975809cSespiefor embarrassingly long package names.
2712975809cSespie.Pp
27293e580fbSespieAs another convenience, the ports tree recognizes constructs like
27393e580fbSespie.Qq graphics/png>=1.2.0
27493e580fbSespieand transforms it into
27593e580fbSespie.Qq STEM->=1.2.0:graphics/png .
27693e580fbSespieMore specifically, package paths never contain <, >, or =, and those
27793e580fbSespiecharacters trigger the transform.
27893e580fbSespie.Pp
279fcf14fc5SespieIf the flavor specification is left blank, any flavor will do.
280fcf14fc5SespieNote that most default package names don't contain flavor specification,
2812975809cSespiewhich means that any flavor will do
282b3c75b6fSmpechFor instance, in
283fcf14fc5Sespie.Bd -literal -offset indent
2842975809cSespieLIB_DEPENDS = graphics/aalib
285fcf14fc5Sespie.Ed
286fcf14fc5Sespie.Pp
287fcf14fc5Sespieboth
288fcf14fc5Sespie.Qq aalib-1.2
289fcf14fc5Sespieand
290fcf14fc5Sespie.Qq aalib-1.2-no_x11
291fcf14fc5Sespiewill do.
292fcf14fc5SespieTo restrict the specification to packages that match flavor
293fcf14fc5Sespie.Sq f ,
294fcf14fc5Sespieappend
295fcf14fc5Sespie.Sq -f .
296fcf14fc5SespieTo restrict the specification to packages that do not match flavor
297fcf14fc5Sespie.Sq f ,
298fcf14fc5Sespieappend
299fcf14fc5Sespie.Sq -!f .
300fcf14fc5SespieIn the preceding case, one may use
301fcf14fc5Sespie.Bd -literal -offset indent
3022975809cSespieLIB_DEPENDS = aalib-*-!no_x11:graphics/aalib
303fcf14fc5Sespie.Ed
304fcf14fc5Sespie.Pp
305fcf14fc5Sespieto ensure the no_x11 flavor is not picked.
306fcf14fc5Sespie.Sh DEPENDENCIES RESOLUTION
307fcf14fc5SespieSeveral packages may be specified for a dependency:
308ca4914a2Sespie.Qq foo-*|bar-*
309ca4914a2Sespiewill match either any version of package foo, or any version of package bar.
310fcf14fc5SespieIn the general case, each package holds a tree of dependencies.
311fcf14fc5SespieResolution occurs at
312fcf14fc5Sespie.Xr pkg_add 1
313fcf14fc5Sespietime, and all dependencies are tracked only as far as needed.
314fcf14fc5Sespie.Pp
315fcf14fc5SespieFor instance, if package
316ca4914a2Sespie.Qq foo-1.0
317fcf14fc5Sespiedepends on either
318ca4914a2Sespie.Qq bar-*
319fcf14fc5Sespieor
320ca4914a2Sespie.Qq fuzz-* ,
321fcf14fc5Sespieand
322ca4914a2Sespie.Qq bar-2.0
323fcf14fc5Sespiedepends
324fcf14fc5Sespieon
325ca4914a2Sespie.Qq toughluck-* ,
326fcf14fc5Sespie.Xr pkg_add 1
327fcf14fc5Sespiewill first check whether
328ca4914a2Sespie.Qq bar-*
329fcf14fc5Sespieor
330ca4914a2Sespie.Qq fuzz-*
331fcf14fc5Sespieis installed.
332fcf14fc5SespieIf either is there, the
333ca4914a2Sespie.Qq toughluck-*
334fcf14fc5Sespiedependency will never be examined.
335fcf14fc5SespieIt would only be used in the case where neither
336ca4914a2Sespie.Qq bar-*
337fcf14fc5Sespienor
338ca4914a2Sespie.Qq fuzz-*
339fcf14fc5Sespieare present, thus
340fcf14fc5Sespie.Xr pkg_add 1
341fcf14fc5Sespiewould decide to bring in
342ca4914a2Sespie.Qq bar-2.0 ,
343fcf14fc5Sespieand so would check on
344ca4914a2Sespie.Qq toughluck-* .
345fcf14fc5Sespie.Sh SEE ALSO
346fcf14fc5Sespie.Xr pkg_add 1 ,
3477b7a4ab2Ssemarie.Xr pkg_check-version 1 ,
348fcf14fc5Sespie.Xr bsd.port.mk 5 ,
3491b9cd673Sespie.Xr library-specs 7 ,
350fcf14fc5Sespie.Xr packages 7 ,
351bd942ac8Sespie.Xr pkgpath 7 ,
352fcf14fc5Sespie.Xr ports 7
353754142a9Sjmc.Sh HISTORY
3542975809cSespieSupport for a more complex form of those package specifications first
3552975809cSespieappeared in
356754142a9Sjmc.Ox 2.9 .
3572975809cSespieThe current simplified form was introduced in
3582975809cSespie.Ox 4.9 .
359