1.\" $OpenBSD: packages-specs.7,v 1.31 2024/10/09 07:25:35 tb 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: October 9 2024 $ 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.Pp 189.Xr pkg_check-version 1 190can be used to verify the ordering of package names. 191.Sh CONFLICTS 192Most conflicts between packages are handled on a package name basis. 193Unless the packages have been specially prepared, it is 194normally not possible to install two packages with the same 195.Ar stem . 196.Pp 197Note that the 198.Ar stem 199ends at the 200.Ar version 201part. 202So, for instance, 203.Qq kdelibs-1.1.2 204and 205.Qq kdelibs-2.1.1 206conflict. 207But 208.Qq openldap-2.0.7 209and 210.Qq openldap-client-2.0.7 211don't. 212Neither do 213.Qq qt-1.45 214and 215.Qq qt2-3.0 . 216.Sh DEPENDENCIES 217Packages may depend on other packages, as specified by their port's 218Makefile, in a 219.Ev BUILD_DEPENDS , 220.Ev LIB_DEPENDS , 221.Ev TEST_DEPENDS 222or 223.Ev RUN_DEPENDS . 224All those conform to 225.Bd -literal -offset indent 226[pkgspec:]pkgpath 227.Ed 228.Pp 229The 230.Xr pkgpath 7 231part of the dependency is always used to obtain the default dependency for 232the given package (the package that will be built and installed if no package 233is found). 234The corresponding package name is also used as a package specification, 235after removing any version and flavor requirements. 236.Pp 237Without a 238.Sq pkgspec\&: 239part, by default, any package with the right stem will do: in effect, 240the pkgspec used is 241.Sq stem-* . 242.Pp 243In 244.Ox 4.9 , 245the dependent port may override this default, and set 246.Ev PKGSPEC 247to achieve a more restrictive default, for instance, 248.Pa databases/db/v3 249sets the default to 250.Qq PKGSPEC = db->=3,<4 251to avoid collision with 252.Pa databases/db/v4 . 253Be extra cautious with this functionality: this tweaks the depends line for 254any including package, thus usually requiring a version bump, and is in 255general only required for very messy cases where several incompatible versions 256of the same software coexist as packages with the same stem. 257.Pp 258An explicit specification such as 259.Qq png-1.0.7 . 260may be used to ask for a more specific version number. 261Version numbers may also include ranges, separated by commas, so for 262instance, 263.Qq foo->=1.3 264would match any foo with version at least 1.3, and 265.Qq foo->=1.3,<=1.5 266would match any version of foo between 1.3 and 1.5, inclusive. 267.Pp 268As a convenience, the ports tree recognizes a specification that starts 269with STEM, and will replace this with the correct stem, which can be useful 270for embarrassingly long package names. 271.Pp 272As another convenience, the ports tree recognizes constructs like 273.Qq graphics/png>=1.2.0 274and transforms it into 275.Qq STEM->=1.2.0:graphics/png . 276More specifically, package paths never contain <, >, or =, and those 277characters trigger the transform. 278.Pp 279If the flavor specification is left blank, any flavor will do. 280Note that most default package names don't contain flavor specification, 281which means that any flavor will do 282For instance, in 283.Bd -literal -offset indent 284LIB_DEPENDS = graphics/aalib 285.Ed 286.Pp 287both 288.Qq aalib-1.2 289and 290.Qq aalib-1.2-no_x11 291will do. 292To restrict the specification to packages that match flavor 293.Sq f , 294append 295.Sq -f . 296To restrict the specification to packages that do not match flavor 297.Sq f , 298append 299.Sq -!f . 300In the preceding case, one may use 301.Bd -literal -offset indent 302LIB_DEPENDS = aalib-*-!no_x11:graphics/aalib 303.Ed 304.Pp 305to ensure the no_x11 flavor is not picked. 306.Sh DEPENDENCIES RESOLUTION 307Several packages may be specified for a dependency: 308.Qq foo-*|bar-* 309will match either any version of package foo, or any version of package bar. 310In the general case, each package holds a tree of dependencies. 311Resolution occurs at 312.Xr pkg_add 1 313time, and all dependencies are tracked only as far as needed. 314.Pp 315For instance, if package 316.Qq foo-1.0 317depends on either 318.Qq bar-* 319or 320.Qq fuzz-* , 321and 322.Qq bar-2.0 323depends 324on 325.Qq toughluck-* , 326.Xr pkg_add 1 327will first check whether 328.Qq bar-* 329or 330.Qq fuzz-* 331is installed. 332If either is there, the 333.Qq toughluck-* 334dependency will never be examined. 335It would only be used in the case where neither 336.Qq bar-* 337nor 338.Qq fuzz-* 339are present, thus 340.Xr pkg_add 1 341would decide to bring in 342.Qq bar-2.0 , 343and so would check on 344.Qq toughluck-* . 345.Sh SEE ALSO 346.Xr pkg_add 1 , 347.Xr pkg_check-version 1 , 348.Xr bsd.port.mk 5 , 349.Xr library-specs 7 , 350.Xr packages 7 , 351.Xr pkgpath 7 , 352.Xr ports 7 353.Sh HISTORY 354Support for a more complex form of those package specifications first 355appeared in 356.Ox 2.9 . 357The current simplified form was introduced in 358.Ox 4.9 . 359