Re: [gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild

2015-08-08 Thread Michał Górny
Dnia 2015-08-07, o godz. 21:42:59
Ulrich Mueller u...@gentoo.org napisał(a):

  On Fri, 7 Aug 2015, Michał Górny wrote:
 
  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.
 
 Wouldn't it be feasible to leave error handling in that case to the
 caller, i.e. have a third return code for the case there is some
 failure?
 https://bugs.gentoo.org/show_bug.cgi?id=482666#c2

What for? We need to support 'die' anyway, I don't see a reason to have
two different variants of error reporting and magical exit codes.

  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.
 
 No use/usev/usex functions? There might be cases where a rebuild is
 only needed for a certain combination of USE flags.

I'd rather not implement all that in smart-live-rebuild. Maybe it'd
make sense to have that in PM-implemented check in EAPI 7.

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


pgpYb2OcsQSPP.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild

2015-08-08 Thread Luca Barbato
On 07/08/15 19:01, Michał Górny wrote:
 Does this sound fine?

It does

 Any suggestions?

Having a reduced scope and not covering corner cases is fine now, so no =)

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




[gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild

2015-08-07 Thread Michał Górny
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/


pgpEENhBxWrBr.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild

2015-08-07 Thread Ciaran McCreesh
On Fri, 7 Aug 2015 19:01:59 +0200
Michał Górny mgo...@gentoo.org wrote:
 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...

So you're using the installed version of the ebuild to determine
whether the version of the ebuild in the tree should be used? What
happens when a URL changes?

-- 
Ciaran McCreesh


signature.asc
Description: PGP signature


Re: [gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild

2015-08-07 Thread Ulrich Mueller
 On Fri, 7 Aug 2015, Michał Górny wrote:

 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.

Wouldn't it be feasible to leave error handling in that case to the
caller, i.e. have a third return code for the case there is some
failure?
https://bugs.gentoo.org/show_bug.cgi?id=482666#c2

 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.

No use/usev/usex functions? There might be cases where a rebuild is
only needed for a certain combination of USE flags.

Ulrich


pgpmdnGzvroB0.pgp
Description: PGP signature


Re: [gentoo-dev] RFC: pkg_needrebuild() API for smart-live-rebuild

2015-08-07 Thread Michał Górny
Dnia 2015-08-07, o godz. 18:07:05
Ciaran McCreesh ciaran.mccre...@googlemail.com napisał(a):

 On Fri, 7 Aug 2015 19:01:59 +0200
 Michał Górny mgo...@gentoo.org wrote:
  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...
 
 So you're using the installed version of the ebuild to determine
 whether the version of the ebuild in the tree should be used? What
 happens when a URL changes?

Yes. Well, rather whether the ebuild with the same slot, to be more
precise.

If the URL changes, and the old URL is no longer valid the function
errors out and a rebuild is triggered in order to attempt to fix it. If
the old URL is still valid, sorry, can't help you.

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


pgpD4ypF69apt.pgp
Description: OpenPGP digital signature