Recipe naming: Names, versions and releases

Recipes in OpenEmbedded use a standard naming convention that includes the package name and version number in the filename. In addition to the name and version there is also a release number, which is indicates changes to the way the package is built and/or packaged. The release number is contained within the recipe itself.

The expected format of recipe name is:

_.bb

where is the name of the package (application, library, module, or whatever it is that is being packaged) and version is the version number.

So a typical recipe name would be:

strace_4.5.14.bb

which would be for version 4.5.14 of the strace application.

The release version is defined via the package release variable, PR, contained in the recipe. The expected format is:

r

where is an integer number starting from 0 initially and then incremented each time the recipe, or something that effects the recipe, is modified. So a typical definition of the release would be:

PR = "r1"

to specify release number 1 (the second release, the first would have been 0). If there is no definition of PR in the recipe then the default value of "r0" is used.

Note

It is good practice to always define PR in your recipes, even for the "r0" release, so that when editing the recipe it is clear that the PR number needs to be updated.

You should always increment PR when modifying a recipe. Sometimes this can be avoided if the change will have no effect on the actual packages generated by the recipe, such as updating the SRC_URI to point to a new host. If in any doubt then you should increase the PR regardless of what has been changed.

The PR value should never be decremented. If you accidentally submit a large PR value for example then it should be left at the value and just increased for new releases, not reset back to a lower version.

When a recipe is being processed some variables are automatically set based on the recipe file name and can be used for other purposes from within the recipe itself. These include:

PN

The package name. Determined from the recipe filename - everything up until the first underscore is considered to be the package name. For the strace_4.5.14.bb recipe the PN variable would be set to "strace".

PV

The package version. Determined from the recipe filename - everything between the first underscore and the final .bb is considered to be the package version. For the strace_4.5.14.bb recipe the PV variable would be set to "4.5.14".

PR

The package release. This is explicitly set in the recipe, or if not set it defaults to "r0" if not set.

P

The package name and versions separated by a hyphen.

P = "${PN}-${PV}"

For the strace_4.5.14.bb recipe the P variable would be set to "strace-4.5.14".

PF

The package name, version and release separated by hyphens.

PF = "${PN}-${PV}-${PR}"

For the strace_4.5.14.bb recipe, with PR set to "r1" in the recipe, the PF variable would be set to "strace-4.5.14-r1".

While some of these variables are not commonly used in recipes (they are used internally though) both PN and PV are used a lot.

In the following example we are instructing the packaging system to include an additional directory in the package. We use PN to refer to the name of the package rather than spelling out the package name:

FILES_${PN} += "${sysconfdir}/myconf"

In the next example we are specifying the URL for the package source, by using PV in place of the actual version number it is possible to duplicate, or rename, the recipe for a new version without having to edit the URL:

SRC_URI = "ftp://ftp.vim.org/pub/vim/unix/vim-${PV}.tar.bz2"