Ebuild revisions
Ebuilds may have a Gentoo revision number associated with them. This is a
-rX
suffix, where X
is an integer — see
File naming rules.
This component must only be used for Gentoo changes, not upstream releases.
An ebuild with no explicit revision number has the implicit -r0
revision.
Ebuild revisions usually serve two purposes:
- keeping an older copy of an ebuild around when doing a potentially breaking change, and
- propagating the rebuild of a package when performing a meaningful change that would otherwise go unnoticed by users who have installed the current version already.
Developers are encouraged to use common sense when determining
whether to introduce a new -rX
revision. The following rule
of thumb could be used as a guideline:
-
If the change can cause the package to be broken to the point
of requiring users to revert to the previous version (in the case
of packages marked stable, every non-trivial change is classified
as such), then a new revision should be introduced and the old one
kept. If the package has stable keywords, the new revision should
be dropped to
~arch
(see Keywording on upgrades). For any such revision bump, the new ebuild should be based on the previous revision to ensure that fixes aren't dropped accidentally. -
If the change makes a substantial difference to the user who already
installed the package (fixes runtime issues, changes installed files,
etc.) and it would not be propagated using other means, then
the ebuild should be renamed to a new revision. If the package has
stable keywords, they should be moved to the new revision without
dropping. To commit the ebuild,
pkgdev commit
orgit commit
paired withpkgcheck scan --commits
should be used). - Otherwise, the change can be done in place in the current revision of the ebuild.
Examples of changes that warrant a new revision are:
- adding a patch to fix a runtime issue,
- installing additional files that could be useful to the user,
- adding a missing runtime dependency to one of the existing blocks,
- adding a binding subslot operator (:=) to a dependency,
- updating a dependency with default on/off USE flags,
- fixing an automagic dependency detection from a build system,
-
restricting a runtime dependency version, unless the
:=
subslot operator is going to trigger a rebuild, - updating the license, if any of the affected licenses is either non-free or is about to be removed,
- changing the EAPI (unless changes to the ebuild are trivial, and you can be sure it won't break stable or reverse dependencies).
Examples of changes that can be done without a revision bump are:
-
adding a patch to fix a build-time issue that prevented users from
building the package (since it does not affect users who already
managed to build it) unless: it affected runtime behaviour in some way
(e.g.
-Wformat
or-Wimplicit-function-declaration
fixes); the package may have been miscompiled, or the change is substantial (if adding a huge patch to fix a problem, the chances of an unexpected issue being introduced by it are greater). - adding a trivial documentation fix,
- installing an additional file of relatively little value (minor documentation, editor syntax file, bash completion) compared to the cost of rebuilding the package (especially if a new bump is expected soon),
- adding a missing build-time dependency that caused a build failure (unless it is also a runtime dependency),
- adding a new USE flag if it controls a USE-dependency where the functionality was hard-disabled in the build system before,
-
removing an existing USE flag if it controls a USE-dependency where the
functionality is now disabled entirely, rather than always being enabled
(since the change in USE flags is going to trigger a
--changed-use
rebuild), - a trivial stylistic / ebuild code change (as long as the new code is equivalent to the old code),
- a dependency change that is a result of a package move (slot move),