Using the %autorelease
Macro¶
Fedora’s Versioning Guidelines define the different elements of which a release field consists. They are as follows:
<pkgrel>%{?dist}[.<minorbump>]
Square brackets indicate an optional item.
The %autorelease
macro accepts these parameters to allow packagers to specify
the different portions of the release field:
-b <baserelease>
: Allows specifying a custom base release number (the default is 1).One use case for this would be, if a sub-package is split out into its own component and its release number sequence should not be reset. E.g. if the last release number while it was still a sub-package was 4, use
-b 5
here to let the sequence continue seamlessly (remember to remove the option when bumping the version the next time).-n
: Don’t render the dist tag, e.g. for use in macros, if the dist tag is added later.
Important
To date, the %autorelease
parameters are ignored in the headers of automatically generated
changelog entries.
Note
In the prototype version the macro was named %autorel
. To make its purpose more obvious, it is
%autorelease
now.
Examples¶
The Simple Case¶
Summary: test-autorelease
Name: test-autorelease
Version: 1.0
Release: %autorelease
License: MIT
%description
An example package testing the %%autorelease macro. This package is for
testing the normal release cadence, bumping in the left-most, most significant
place of the release field.
Will generate the following NEVR:
test-autorelease-1.0-1.fc34.x86_64
The Custom Base Release Case¶
Summary: test-autorelease-baserelease
Name: test-autorelease-baserelease
Version: 1.0
Release: %autorelease -b 100
License: MIT
%description
An example package for the %%autorelease macro.
This package demonstrates using a base release number which lets release numbers start at other
values than 1 (the default).
Will generate the following NEVR:
test-autorelease-baserelease-1.0-100.fc34.x86_64
Traditional versioning with part of the upstream version information in the release field¶
Additional parameters are available to support an older form of package versioning. This form is recommended for packages with complex versioning requirements when support for RHEL7 and other systems with old rpm versions is required. See Traditional Versioning in the Packaging Guidelines for details.
The release field is extended:
<pkgrel>[.<extraver>][.<snapinfo>]%{?dist}[.<minorbump>]
Square brackets indicate an optional item.
The %autorelease
macro accepts these parameters to allow packagers to specify
those added fields:
-p
: Designates a pre-release, i.e.pkgrel
will be prefixed with0.
.-e <extraver>
: Allows specifying theextraver
portion of the release.-s <snapinfo>
: Allows specifying thesnapinfo
portion of the release.
In the modern versioning, those fields are embedded in the package Version instead.
Examples¶
The Pre-Release Case¶
Summary: test-autorelease-prerelease
Name: test-autorelease-prerelease
Version: 1.0
Release: %autorelease -p -e pre1
License: MIT
%description
An example package testing the %%autorelease macro. This package is for
testing a prerelease with an <extraver> part, when upstream uses unsortable
versions like "1.0pre1".
Will generate the following NEVR:
test-autorelease-prerelease-1.0-0.1.pre1.fc34.x86_64
The Extraver Case¶
Summary: test-autorelease-extraver
Name: test-autorelease-extraver
Version: 1.0
Release: %autorelease -e pre1
License: MIT
%description
An example package testing the %%autorelease macro. This package is for
testing with an <extraver> part, when upstream uses unsortable versions like
"1.0pre1".
Will generate the following NEVR:
test-autorelease-extraver-1.0-1.pre1.fc34.x86_64
The Snapshot Case¶
Summary: test-autorelease-snapshot
Name: test-autorelease-snapshot
Version: 1.0
Release: %autorelease -s 20200317git1234abcd
License: MIT
%description
An example package testing the %%autorelease macro. This package is for
testing with a <snapinfo> part, for a snapshot between versions from an
upstream repository.
Will generate the following NEVR:
test-autorelease-snapshot-1.0-1.20200317git1234abcd.fc34.x86_64
The Snapshot and Extraver case¶
Summary: test-autorelease-extraver-snapshot
Name: test-autorelease-extraver-snapshot
Version: 1.0
Release: %autorelease -e pre1 -s 20200317git1234abcd
License: MIT
%description
An example package testing the %%autorelease macro. This package is for
testing with <extraver> and <snapinfo> parts, when upstream uses unsortable
versions like "1.0pre1" and we package a snapshot after it.
Will generate the following NEVR:
test-autorelease-extraver-snapshot-1.0-1.pre1.20200317git1234abcd.fc34.x86_64