| |
@@ -9,6 +9,9 @@
|
| |
which are treated as updates by RPM's version comparison algorithm
|
| |
while accommodating varied and often inconsistent upstream versioning schemes.
|
| |
|
| |
+ The `+Version:+` field contains the upstream project version,
|
| |
+ and the `+Release:+` field specifies the downstream release number.
|
| |
+
|
| |
== Some definitions
|
| |
|
| |
Note that upstreams may each have their own terminology
|
| |
@@ -51,7 +54,7 @@
|
| |
from RPM's implementation then simply using upstream's versions directly
|
| |
will result in updates which don't actually update any packages.
|
| |
|
| |
- == Epoch: tag
|
| |
+ == `+Epoch+` tag
|
| |
|
| |
The `+Epoch:+` tag provides the most significant input to RPM's version comparison function.
|
| |
If present, it **must** consist of a positive integer.
|
| |
@@ -60,6 +63,26 @@
|
| |
The `+Epoch:+` tag, once introduced to a package,
|
| |
**must never** be removed or decreased.
|
| |
|
| |
+ == `+Release+` tag
|
| |
+
|
| |
+ The `+Release:+` **should** be managed automatically using the `+%autorelease+` macro:
|
| |
+ [source, rpm-spec]
|
| |
+ ----
|
| |
+ Release: %autorelease
|
| |
+ ----
|
| |
+
|
| |
+ As described in
|
| |
+ https://docs.pagure.org/fedora-infra.rpmautospec/autorelease.html[%autorelease documentation],
|
| |
+ the build machinery will
|
| |
+ replace the macro with the number of builds since the last commit that changed the `+Version+` field,
|
| |
+ suffixed with the `%{?dist}` tag.
|
| |
+ This means that a commit that changes `+Version+` automatically gets `Release: 1%{?dist}`,
|
| |
+ and commits after that get `Release: 2%{?dist}`, `Release: 3%{?dist}`, and so on.
|
| |
+
|
| |
+ Alternatively, the `+Release:+` field **may** be updated manually.
|
| |
+ See xref:Versioning.adoc#traditional-versioning[Traditional versioning
|
| |
+ with part of the upstream version information in the release field].
|
| |
+
|
| |
== Simple versioning
|
| |
|
| |
Most upstream versioning schemes are "simple";
|
| |
@@ -79,12 +102,8 @@
|
| |
|
| |
To package *release versions* of software using this versioning scheme:
|
| |
|
| |
- * Use the upstream verbatim in the `+Version:+` tag.
|
| |
+ * Use the upstream project version verbatim in the `+Version:+` tag.
|
| |
Don't trim leading zeroes.
|
| |
- * Use a `+Release:+` tag starting with 1 (never 0).
|
| |
- Append the xref:DistTag.adoc[Dist Tag].
|
| |
- Increment the release (by 1) for each update you make.
|
| |
- Reset to 1 whenever you change `+Version:+`.
|
| |
|
| |
== Complex versioning
|
| |
|
| |
@@ -105,6 +124,9 @@
|
| |
* More than one of the above may apply (lucky you).
|
| |
Follow all of the relevant recommendations below together.
|
| |
|
| |
+ This subsection describes how to modify the upstream project version to be suitable for the `+Version+` field.
|
| |
+ Use of `Release: +%autorelease+` remains unchanged.
|
| |
+
|
| |
=== Handling non-sorting versions with tilde, dot, and caret
|
| |
|
| |
The tilde symbol ('`+~+`') is used before a version component which must sort *earlier* than any non-tilde component.
|
| |
@@ -177,6 +199,7 @@
|
| |
"`+0+`" sorts lower than any other possible value that upstream might choose.
|
| |
If upstream does choose to release "version 0",
|
| |
then just set `+Release:+` higher than the previous value.
|
| |
+ (When `%autorelease` is used, this happens automatically.)
|
| |
|
| |
=== Upstream uses invalid characters in the version
|
| |
|
| |
@@ -241,118 +264,122 @@
|
| |
|
| |
[%header]
|
| |
|===
|
| |
- |Upstream| Version field | Release field | Explanation
|
| |
-
|
| |
- |1.0 |1.0 | 1%{?dist} | The first release.
|
| |
-
|
| |
- |1.1 |1.1 | 1%{?dist} | An upstream update.
|
| |
+ |Upstream version | Version tag | Explanation
|
| |
|
| |
- |1.1 |1.1 | 2%{?dist} | You made a change to the package but the upstream version didn't change.
|
| |
+ |1.0 |1.0 | The first release.
|
| |
|
| |
- |1.2 |1.2 | 1%{?dist} | The upstream version changed, so Release: goes back to 1.
|
| |
+ |1.1 |1.1 | An upstream update.
|
| |
|
| |
- |1.2.1 |1.2.1 |1%{?dist} | Extra levels of versioning are OK…
|
| |
+ |1.2.1 |1.2.1 | Another upstream update. Extra levels of versioning are OK…
|
| |
|
| |
- |1.3 |1.3 |1%{?dist} | …they can come and go without problems.
|
| |
+ |1.3 |1.3 | …they can come and go without problems.
|
| |
|===
|
| |
|
| |
+ In this case the full N-V-R could be e.g. `pkg-1.2.1-1.fc{CURRENTVER}` (immediately after an update)
|
| |
+ or `pkg-1.2.1-5.fc{CURRENTVER}` (after downstream rebuilds with the same upstream version).
|
| |
+
|
| |
[%header]
|
| |
|===
|
| |
- |Upstream| Version field | Release field | Explanation
|
| |
+ |Upstream version | Version tag | Explanation
|
| |
|
| |
- | 5.2 | 5.2 | 1%{?dist} |
|
| |
+ | 5.2 | 5.2 | Upstream release.
|
| |
|
| |
- | 5.2a | 5.2a | 1%{?dist} | Upstream introduced a letter to indicate a patch release. You trust upstream to use letters in alphabetical order, so it's OK to use the version as is.
|
| |
+ | 5.2a | 5.2a | Upstream introduced a letter to indicate a patch release. You trust upstream to use letters in alphabetical order, so it's OK to use the version as is.
|
| |
|
| |
- | 5.2b | 5.2b | 1%{?dist} | Another patch release after 5.2 - this is not a beta.
|
| |
+ | 5.2b | 5.2b | Another patch release after 5.2 — this is not a beta.
|
| |
|
| |
- | 5.2b.1 | 5.2b.1 | 1%{?dist} | Even this is OK as long as the sequence increases.
|
| |
+ | 5.2b.1 | 5.2b.1 | Even this is OK as long as the sequence increases.
|
| |
|
| |
- | 5.3 | 5.3 | 1%{?dist} |
|
| |
+ | 5.3 | 5.3 | Another upstream release.
|
| |
|===
|
| |
|
| |
+ In this case the full N-V-R could be e.g. `pkg-5.2b.1-1.fc{CURRENTVER}`.
|
| |
+
|
| |
==== Complex versioning with a reasonable upstream
|
| |
|
| |
[%header]
|
| |
|===
|
| |
- |Upstream version | Full package NEVRA | Notes
|
| |
+ |Upstream version | Version tag | Notes
|
| |
|
| |
- | 1.0.0-rc1 | `+pkg-1.0.0~rc1-1%{?dist}+` | first prerelease
|
| |
+ | 1.0.0-rc1 | `+1.0.0~rc1+` | first prerelease
|
| |
|
| |
- | 1.0.0-rc2 | `+pkg-1.0.0~rc2-1%{?dist}+` | second prerelease
|
| |
+ | 1.0.0-rc2 | `+1.0.0~rc2+` | second prerelease
|
| |
|
| |
- | 1.0.0 | `+pkg-1.0.0-1%{?dist}+` | release
|
| |
+ | 1.0.0 | `+1.0.0+` | release
|
| |
|
| |
- | 1.0.1 | `+pkg-1.0.1-1%{?dist}+` | bugfix release
|
| |
+ | 1.0.1 | `+1.0.1+` | bugfix release
|
| |
|
| |
- | 1.0.1-security1 | `+pkg-1.0.1.security1-1%{?dist}+` | security bufix release
|
| |
+ | 1.0.1-security1 | `+pkg-1.0.1.security1+` | security bufix release
|
| |
|===
|
| |
|
| |
+ In this case the full N-V-R could be e.g. `pkg-1.0.0~rc2-42.fc{CURRENTVER}` (if many rebuilds were done).
|
| |
+
|
| |
==== Complex versioning with non-sorting upstream post-release versions
|
| |
|
| |
[%header]
|
| |
|===
|
| |
- |Upstream version | Full package NEVRA | Notes
|
| |
-
|
| |
- | 1.1.0~BETA | `+pkg-1.1.0~BETA-1%{?dist}+` | this is a prerelease, first beta
|
| |
+ |Upstream version | Version tag | Notes
|
| |
|
| |
- | 1.1.0~BETA1 | `+pkg-1.1.0~BETA1-1%{?dist}+` | this is a prerelease, second beta
|
| |
+ | 1.1.0~BETA | `+1.1.0~BETA+` | this is a prerelease, first beta
|
| |
|
| |
- | 1.1.0~BETA2 | `+pkg-1.1.0~BETA2-1%{?dist}+` | this is a prerelease, third beta
|
| |
+ | 1.1.0~BETA1 | `+1.1.0~BETA1+` | this is a prerelease, second beta
|
| |
|
| |
- | 1.1.0~CR1 | `+pkg-1.1.0~CR1-1%{?dist}+` | this is a prerelease, candidate release 1
|
| |
+ | 1.1.0~BETA2 | `+1.1.0~BETA2+` | this is a prerelease, third beta
|
| |
|
| |
- | 1.1.0~CR2 | `+pkg-1.1.0~CR2-1%{?dist}+` | this is a prerelease, candidate release 2
|
| |
+ | 1.1.0~CR1 | `+1.1.0~CR1+` | this is a prerelease, candidate release 1
|
| |
|
| |
- | | `+pkg-1.1.0~CR2-2%{?dist}+` | this is a prerelease, candidate release 2, second build
|
| |
+ | 1.1.0~CR2 | `+1.1.0~CR2+` | this is a prerelease, candidate release 2
|
| |
|
| |
- | 1.1.0-1% | `+pkg-1.1.0-1%{?dist}+` | final release
|
| |
+ | 1.1.0-1% | `+1.1.0+` | final release
|
| |
|
| |
- | 1.1.0-GA1 | `+pkg-1.1.0.20201001.GA1-1%{?dist}+` | post release, GA1
|
| |
+ | 1.1.0-GA1 | `+1.1.0.20201001.GA1+` | post release, GA1
|
| |
|
| |
- | 1.1.0-CP1 | `+pkg-1.1.0.20201011.CP1-1%{?dist}+` | post release, CP1, after GA1, does not sort properly
|
| |
+ | 1.1.0-CP1 | `+1.1.0.20201011.CP1+` | post release, CP1, after GA1, does not sort properly
|
| |
|
| |
- | 1.1.0-CP2 | `+pkg-1.1.0.20201101.CP2-1%{?dist}+` | post release, CP2, after CP1
|
| |
+ | 1.1.0-CP2 | `+1.1.0.20201101.CP2+` | post release, CP2, after CP1
|
| |
|
| |
- | 1.1.0-SP1 | `+pkg-1.1.0.20210101.SP1-1%{?dist}+` | post release, SP1, after CP2
|
| |
+ | 1.1.0-SP1 | `+1.1.0.20210101.SP1+` | post release, SP1, after CP2
|
| |
|
| |
- | 1.1.0-SP1-CP1 | `+pkg-1.1.0.20210105.SP1_CP1-1%{?dist}+` | post release, SP1_CP1, after SP1
|
| |
+ | 1.1.0-SP1-CP1 | `+1.1.0.20210105.SP1_CP1+` | post release, SP1_CP1, after SP1
|
| |
|===
|
| |
|
| |
+ In this case the full N-V-R could be e.g. `pkg-1.1.0.20210105.SP1_CP1-1.fc{CURRENTVER}`.
|
| |
|
| |
==== Complex versioning with a pre- and post-release snapshots
|
| |
|
| |
[%header]
|
| |
|===
|
| |
- |Upstream version | Full package NEVRA | Notes
|
| |
+ |Upstream version | Version | Notes
|
| |
|
| |
- | 1.0.0-rc1 | `+pkg-1.0.0~rc1-1%{?dist}+` | First prerelease
|
| |
+ | 1.0.0-rc1 | `+1.0.0~rc1+` | First prerelease
|
| |
|
| |
- | 1.0.0-rc2 | `+pkg-1.0.0~rc2-1%{?dist}+` | Second prerelease
|
| |
+ | 1.0.0-rc2 | `+1.0.0~rc2+` | Second prerelease
|
| |
|
| |
- | git commit `f00fabd` | `+pkg-1.0.0~rc2^20210101gf00fabd-1%{?dist}+` | Post-prerelease snapshot
|
| |
+ | git commit `f00fabd` | `+1.0.0~rc2^20210101gf00fabd+` | Post-prerelease snapshot
|
| |
|
| |
- | 1.0.0 | `+pkg-1.0.0-1%{?dist}+` | A release
|
| |
+ | 1.0.0 | `+1.0.0+` | A release
|
| |
|
| |
- | | `+pkg-1.0.0-2%{?dist}+` | A rebuild from the same sources
|
| |
+ | 1.0.1 | `+1.0.1+` | A bugfix release
|
| |
|
| |
- | 1.0.1 | `+pkg-1.0.1-1%{?dist}+` | A bugfix release
|
| |
+ | git commit `bbbccc0` | `+1.0.1^20210203gbbbccc0+` or `+pkg-1.0.1^1.gbbbccc0+` | A snapshot
|
| |
|
| |
- | git commit `bbbccc0` | `+pkg-1.0.1^20210203gbbbccc0-1%{?dist}+` or `+pkg-1.0.1^1.gbbbccc0-1%{?dist}+` | A snapshot
|
| |
+ | 1.0.1-security1 | `+1.0.1.security1+` | A security bufix release. From past history we know that the bugfix releases will have sortable versions. If not, we could use '`+<date>.security1+`' instead.
|
| |
|
| |
- | 1.0.1-security1 | `+pkg-1.0.1.security1-1%{?dist}+` | A security bufix release. From past history we know that the bugfix releases will have sortable versions. If not, we could use '`+<date>.security1+`' instead.
|
| |
-
|
| |
- | git commit `abc0202` | `+pkg-1.0.1.security1^20210301gabc0202-1%{?dist}+` or `+pkg-1.0.1.security1^1.gabc0202-1%{?dist}+` | Another snapshot
|
| |
+ | git commit `abc0202` | `+1.0.1.security1^20210301gabc0202+` or `+pkg-1.0.1.security1^1.gabc0202+` | Another snapshot
|
| |
|===
|
| |
|
| |
+ In this case the full N-V-R could be e.g. `pkg-1.0.1.security1^20210301gabc0202-1.fc{CURRENTVER}`.
|
| |
|
| |
- == Traditional versioning with part of the upstream version information in the release field
|
| |
+ [#traditional-versioning]
|
| |
+ == Traditional versioning with part of the upstream version information in the Release field
|
| |
|
| |
The method described in this section is deprecated, but **may** be used.
|
| |
As mentioned in the <<Handling non-sorting versions with tilde, dot, and caret>> section above,
|
| |
this method is recommended for packages with complex versioning when supporting RHEL7
|
| |
and other systems with old rpm versions.
|
| |
|
| |
+ In this method, `+%autorelease+` is not used, and the `Release` field must be managed manually.
|
| |
+
|
| |
This method for dealing with most pre- and post-release versions and unsortable versions
|
| |
involves potentially removing some information from the `+Version:+` tag
|
| |
while imposing additional structure onto the `+Release:+` tag.
|
| |
@@ -382,7 +409,7 @@
|
| |
and in most situations `+<minorbump>+` won't be used at all.
|
| |
Simply do not include those which you don't have.
|
| |
|
| |
- Note that the Dist tag is supplied by other portions of the system
|
| |
+ Note that the dist tag is supplied by other portions of the system
|
| |
and may in some circumstances contain additional structure,
|
| |
including tildes.
|
| |
As this is not under the control of the packager,
|
| |
@@ -454,6 +481,17 @@
|
| |
Release and post-release versions **must** use
|
| |
a `+Release:+` tag greater than or equal to 1.
|
| |
|
| |
+ === Rebuilds in older branches using `<minorbump>`
|
| |
+
|
| |
+ In the situation described in <<Only an old branch needs a change>>,
|
| |
+ you **may** adjust the `+Release+` by appending a number *after* the dist tag,
|
| |
+ creating a E-V-R for F{CURRENTVER} that still compares lower than the one in F{NEXTVER}.
|
| |
+ Set `+<minorbump>+` to an in integer beginning with '1'
|
| |
+ and increase it by one for each minor bump you need to do.
|
| |
+ Remove `+<minorbump>+` once you are able
|
| |
+ to increase the package release normally
|
| |
+ without introducing ordering issues.
|
| |
+
|
| |
=== Examples
|
| |
|
| |
Examples of many possible versioning scenarios of traditional versioning
|
| |
@@ -461,29 +499,6 @@
|
| |
https://fedoraproject.org/wiki/Package_Versioning_Examples[Package Versioning Examples].
|
| |
|
| |
|
| |
-
|
| |
-
|
| |
-
|
| |
- == You need to change an old branch without rebuilding the others
|
| |
-
|
| |
- Sometimes, you may find yourself in a situation where an older branch needs a fix,
|
| |
- but the newer branches are fine.
|
| |
- For example, if a package has a version-release of `+1.0-1%{?dist}+`
|
| |
- in F{CURRENTVER} and F{NEXTVER},
|
| |
- and only F{CURRENTVER} needs a fix.
|
| |
- Normally, you would need to bump the release in each of the branches
|
| |
- to ensure that F{CURRENTVER} < F{NEXTVER},
|
| |
- but that is a waste of time and energy for the newer branches
|
| |
- which do not need to be touched.
|
| |
-
|
| |
- In this case, you **may** set `+<minorbump>+`
|
| |
- to an in integer beginning with '1'
|
| |
- and increasing by one for each minor bump you need to do.
|
| |
- Remove `+<minorbump>+` once you are able
|
| |
- to increase the package release normally
|
| |
- without introducing ordering issues.
|
| |
-
|
| |
-
|
| |
== Rawhide is allowed to lag temporarily
|
| |
|
| |
A package **may** temporarily have a lower EVR in Rawhide
|
| |
See https://fedoraproject.org/wiki/Changes/Rpmautospec_by_Default
The general approach is the the previous recommendations are described
with "may" and moved to the end or to a separate page. Use of
rpmautospec is shown briefly, but with enough information for normal
packaging workflows. Links are provided to the rpmautospec docs in
case packagers need more information.