Blag

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 and KV. 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.

The 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_preinst and pkg_postinst; if set during pkg_pretend and pkg_setup, it will contain valid values, but it may be misleading in the case of binary package building.

Note that REPLACING_VERSIONS is a list, not a single value. This is to deal with weird cases like having foo-1:2 and foo-2:1 installed, and installing foo-1:1.

The REPLACED_BY_VERSION variable contains the version of the current package name that has been replaced. It is only valid in pkg_prerm and pkg_postrm. If it is unset, it indicates a simple uninstall.

Advertisements

One response to “EAPI 3: AA, KV Gone; New REPLACING_VERSIONS and REPLACED_BY_VERSION Variables

  1. Pingback: What’s in EAPI 3? « Ciaran McCreesh’s Blag

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s