Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild
Date: Fri, 07 Aug 2015 17:02:26
Message-Id: 20150807190159.5f1b6215@pomiot
Hello, all.

As part of future-eapi I had suggested introducing a new phase function
that would be used to determine whether a live ebuild needs to be
updated (rebuilt) [1]. Since the work on EAPI 6 is getting awfully
delayed, and EAPI 7 is even less likely, I'd like to implement
the needed facilities on top of current EAPI in smart-live-rebuild.

For this reason, I'd like to ask you to review the tiny spec I've made
so that hopefully one day we wouldn't have to reinvent it all for EAPI
7.

The spec would be:

An ebuild (eclass) can declare optional pkg_needrebuild() phase
function. The function is called outside of regular ebuild process
(alike pkg_pretend()), in the goal of determining whether a particular
package needs to be rebuilt. This can be because of sources being
changed (VCS) or possibly some other reason (-updaters when subslots
are not good enough?).

The function is run in environment containing all variables exported
by the previous source build. It must not access or assume existence of
$WORKDIR, $D...

The function can return one of the following return codes:

- 0 -- indicating that the package should be rebuilt from ebuild
  (changes occured),

- 1 -- indicating that the package needs not be rebuilt.

The function must use 'die' if an error preventing the function
from determining the state occurs.

The function can output any user-oriented messages. The following
output functions are made available: einfo, einfon, elog, ewarn,
eerror, ebegin, eend. The following additional functions are available:
die, assert, has, hasv, hasq.

And just to be clear: I'd love to just support a subset of those
functions but don't want to get too confusing with PMS.

Does this sound fine? Any suggestions?

[1]:https://bugs.gentoo.org/show_bug.cgi?id=482666

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

Replies