He's not dead, he's resting
EAPI 3: AA, KV Gone; New REPLACING_VERSIONS and REPLACED_BY_VERSION Variables
This is part of a series on EAPI 3.
First, two removals:
AA has been deprecated for ages, and isn’t useful for ebuilds — it’s like
A, but contains every component, even those in unselected conditional branches.
KV, meanwhile, contains “the kernel version”. Ebuilds that need that kind of thing should use one of the eclasses that provides similar but more useful functionality instead.
Now the more interesting part: two additions. In the good old days, you could use convoluted
has_version magic in
pkg_ phases to work out whether we’re in an upgrade, downgrade, reinstall or fresh install. The devmanual used to contain examples. Unfortunately, Zac went and broke all this when he changed phase ordering without an EAPI bump, leaving all the widely used and documented techniques for detecting upgrades unusable. Thus, EAPI 3 adds two new variables to fix this mess.
REPLACING_VERSIONS variable contains a space separated list of all the versions of the current package name that will be replaced. It is only valid in
pkg_postinst; if set during
pkg_setup, it will contain valid values, but it may be misleading in the case of binary package building.
REPLACING_VERSIONS is a list, not a single value. This is to deal with weird cases like having
foo-2:1 installed, and installing
REPLACED_BY_VERSION variable contains the version of the current package name that has been replaced. It is only valid in
pkg_postrm. If it is unset, it indicates a simple uninstall.