Using the %autorel Macro

Fedora’s Versioning Guidelines define the different elements of which a release field can consist. They are as follows:

<pkgrel>[.<extraver>][.<snapinfo>]%{?dist}[.<minorbump>]

Each element in square brackets indicates an optional item.

The %autorel macro accepts these parameters to allow packagers to specify the different portions of the release field:

  • -h <hotfix>: Designates a hotfix release, i.e. enables bumping the minorbump portion in order to not overrun EVRs in later Fedora versions.

  • -p <prerelease>: Designates a pre-release, i.e. pkgrel will be prefixed with 0..

  • -e <extraver>: Allows specifying the extraver portion of the release.

  • -s <snapinfo>: Allows specifying the snapinfo portion of the release.

Warning

To date, only the normal release cadence is fully implemented. Please don’t use the hotfix or pre-release parameters yet, attempting to build such packages will fail.

Some Examples:

The Simple Case

Summary:    test-autorel
Name:       test-autorel
Version:    1.0
Release:    %autorel
License:    MIT

%description
A dummy package testing the %%autorel 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-autorel-1.0-1.fc31.x86_64

The Hotfix Case

Summary:    test-autorel-hotfix
Name:       test-autorel-hotfix
Version:    1.0
Release:    %autorel -h
License:    MIT

%description
A dummy package testing the %%autorel macro. This package is for testing the release cadence for
hotfixes, bumping in the right-most, least significant place of the release field.

Will generate the following NEVR:

test-autorel-hotfix-1.0-1.fc31.1.x86_64

The Pre-Release Case

Summary:    test-autorel-prerelease
Name:       test-autorel-prerelease
Version:    1.0
Release:    %autorel -p -e pre1
License:    MIT

%description
A dummy package testing the %%autorel 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-autorel-prerelease-1.0-0.1.pre1.fc31.x86_64

The Extraver Case

Summary:    test-autorel-extraver
Name:       test-autorel-extraver
Version:    1.0
Release:    %autorel -e pre1
License:    MIT

%description
A dummy package testing the %%autorel macro. This package is for testing with
an <extraver> part, when upstream uses unsortable versions like "1.0pre1".

Will generate the following NEVR:

test-autorel-extraver-1.0-1.pre1.fc31.x86_64

The Snapshot Case

Summary:    test-autorel-snapshot
Name:       test-autorel-snapshot
Version:    1.0
Release:    %autorel -s 20200317git1234abcd
License:    MIT

%description
A dummy package testing the %%autorel 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-autorel-snapshot-1.0-1.20200317git1234abcd.fc31.x86_64

The Snapshot and Extraver case

Summary:    test-autorel-extraver-snapshot
Name:       test-autorel-extraver-snapshot
Version:    1.0
Release:    %autorel -e pre1 -s 20200317git1234abcd
License:    MIT

%description
A dummy package testing the %%autorel 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-autorel-extraver-snapshot-1.0-1.pre1.20200317git1234abcd.fc31.x86_64