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