Sub-slots and Slot-Operators

EAPI=5 introduces two new features related to slots and slot dependencies: sub-slots and slot-operators. Slot-operators allow the dependencies of a package to be specified such that slot changes either will (:=) or won't (:*) trigger a rebuild of itself. Sub-slots allow a package to trigger slot-operator rebuilds without needing to explicitly re-SLOT (and therefore allow concurrent installation of) different versions.

The practical upshot of these two features is that when used properly, they will allow portage to determine what packages in the system need to be re-emerged when certain libraries or dependencies are upgraded, thus including them in the emerge list when running "emerge -uDNav world", and hopefully eliminating the need for revdep-rebuild and other package-rebuild scripts.

A Basic example:
An overlay contains the following packages, all containing "SLOT=0" : dev-libs/libfoo-1.0 dev-libs/libfoo-2.0 dev-libs/libbar-1.0 dev-libs/libbar-2.0 app-misc/foo-1.0

app-misc/foo-1.0 contains the following: RDEPEND=" dev-libs/foo dev-libs/bar "

and after being built, installs /usr/bin/foo which is linked to 'libfoo.so.1' and 'libbar.so'

Without sub-slots and slot-operators, if libfoo-1.0 was upgraded to libfoo-2.0, then 'foo' would break until re-emerged (ie with revdep-rebuild). However, we can add slot-opreators to the dependencies within app-misc/foo-1.0: RDEPEND=" dev-libs/foo:= dev-libs/bar:* "

...and sub-slots to the libraries: dev-libs/libfoo-1.0: SLOT="0/1" dev-libs/libfoo-2.0: SLOT="0/2" dev-libs/libbar-1.0: SLOT="0/1" dev-libs/libbar-2.0: SLOT="0/2"

...would mean that the upgrade of libfoo from 1.0 to 2.0 would automatically trigger a rebuild of package 'foo'. Also, since foo is linked to any 'libbar', the upgrade of libbar from 1.0 to 2.0 would -not- automatically trigger a needless rebuild of 'foo'.

Real-World Examples
The following are projects that have been test-implemented on axs's developer overlay (layman -a axs). They are presented here to show possible best practices of implementing sub-slots and slot-operators.

Making perl-cleaner obsolete
When perl is upgraded, perl modules generally need to be reinstalled as they are no longer installed against (or in the right path of) the current version of perl. Slot-operators and sub-slots can help with this, by triggering rebuilds. Fortunately, all packages that install perl modules do so via the 'perl-module' eclass, and so implementing this is very straight-forward and requires very few changes.

1. Ebuilds for dev-lang/perl need to be sub-slotted: As only one version of dev-lang/perl can be installed at a time, sub-slots are used to define the actual version of perl while enforcing SLOT="0" behaviour. Perl-cleaner needs only be run when changing ${major}.${minor} versions, and so we will use this for the sub-slot: dev-lang/perl-5.12.4.ebuild:SLOT="0/5.12" Note that a modified ${PV} could have been used instead of an explicit specification.

2. perl-module.eclass needs to be updated: In the standard case, perl-module.eclass is in charge of assigning dev-lang/perl to $DEPEND for the ebuilds that inherit it. As such, change the dev-lang/perl atom so that it includes the ':=' slot operator will automatically trickle down to the perl-module packages. case "${GENTOO_DEPEND_ON_PERL:-yes}" in               yes) +                       case "${EAPI:-0}" in +                       5) +                              DEPEND="dev-lang/perl:=[-build]" +                              ;; +                       *)                                DEPEND="dev-lang/perl[-build]" +                               ;; +                       esac                        RDEPEND="${DEPEND}"                        ;;                esac

3. Dependencies need to be updated for optional perl modules: Some packages install their modules based on USE="perl", and have GENTOO_DEPEND_ON_PERL=no set in the ebuild. These packages therefore depend directly on dev-lang/perl and need to have their dependencies updates with the ':=' slot operator. app-misc/g15daemon-1.9.5.3-r5: DEPEND="perl? ( -              dev-lang/perl +               dev-lang/perl:=                dev-perl/GDGraph                >=dev-perl/Inline-0.4         )