Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 347351

Summary: [Future EAPI] MERGE_TYPE variable to distinguish between source and binary packages
Product: Gentoo Hosted Projects Reporter: Ulrich Müller <ulm>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: RESOLVED FIXED    
Severity: normal CC: council, cyprien, esigra, lxnay
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard: in-eapi-4
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 174380    
Attachments: Proposed patch for PMS

Description Ulrich Müller gentoo-dev 2010-11-30 21:52:28 UTC
In today's meeting the council decided that in EAPI 4 the PM shall define a variable MERGING_FROM, with possible values "source" and "binary".
Comment 1 David Leverton 2010-11-30 23:48:45 UTC
Could possibly generalise this to also indicate "build binary but don't install", since some pkg_pretend checks might not make sense in this case.  (Example: insisting that the user is prepared for an incompatible upgrade.)  That would leave three possible values, indicating install from source, install from binary and build binary, since building a new binary from an old binary would be silly.  (In theory we could have "build, make binary and install" as a distinct value from "build and install" and "build and make binary", but I can't think of a use case.)

Possible naming suggested on IRC (not attached to these, but let's not bikeshed /too/ much :-P):

MERGE_TYPE - the variable itself
source - build from source and install
binary - install from binary package
build  - build binary package but don't install
Comment 2 David Leverton 2010-11-30 23:49:23 UTC
Or possibly "buildonly" for the last one (and so it begins....)
Comment 3 Ulrich Müller gentoo-dev 2010-12-01 21:21:31 UTC
Created attachment 256075 [details, diff]
Proposed patch for PMS

First attempt on a wording for PMS.
Please review.
Comment 4 Ulrich Müller gentoo-dev 2010-12-03 11:31:26 UTC
Adding council to CC, since this now slightly differs from what is written in the meeting log. See comment #1.
Comment 5 Zac Medico gentoo-dev 2010-12-04 17:29:14 UTC
(In reply to comment #2)
> Or possibly "buildonly" for the last one (and so it begins....)

Since the difference between "buildonly" and "source" maybe be negligible in lots of cases, we're likely to end up with lots of ebuilds needing to do something like this:

if has $MERGE_TYPE buildonly source ; then
 # do stuff for source packages here
fi

So, we might consider simplifying it somehow, so that the above check somehow. For example, for the buildonly type, we could have the package manager set MERGE_TYPE="buildonly source". Then the above check could be written in this slightly simpler form:

if has source $MERGE_TYPE ; then
 # do stuff for source packages here
fi

Alternatively, we could provide functions to simplify these sorts of checks:

is_source_pkg() {
  has source $MERGE_TYPE
}

is_buildonly_pkg() {
  has buildonly $MERGE_TYPE
}

is_binary_pkg() {
  has binary $MERGE_TYPE
}
Comment 6 Ciaran McCreesh 2010-12-04 17:35:49 UTC
You can use 'has' the other way around...

    if has $MERGE_TYPE blah blah
Comment 7 Zac Medico gentoo-dev 2010-12-04 19:11:16 UTC
I was just sayin, since existence of MERGE_TYPE=buildonly means that in practice a simple [[ $MERGE_TYPE == source ]] check will never be possible. Anyway, there's support in portage here:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8553b7bcb4b0bef2973774c22cc2fa84682c464b
Comment 8 Ulrich Müller gentoo-dev 2010-12-04 20:33:01 UTC
(In reply to comment #7)
> I was just sayin, since existence of MERGE_TYPE=buildonly means that in
> practice a simple [[ $MERGE_TYPE == source ]] check will never be possible.

But you can check for any two of three possible values by negating the third one:
[[ ${MERGE_TYPE} != binary ]]
Comment 9 Ulrich Müller gentoo-dev 2010-12-08 18:02:48 UTC
(In reply to comment #3)
> Created an attachment (id=256075) [details]
> Proposed patch for PMS
> 
> First attempt on a wording for PMS.
> Please review.

I don't see any objections against the wording, therefore pushed to master.
Comment 10 Ulrich Müller gentoo-dev 2010-12-30 19:53:14 UTC
EAPI 4 has been approved by the council.
Comment 11 Ulrich Müller gentoo-dev 2011-04-10 22:30:16 UTC
*** Bug 154495 has been marked as a duplicate of this bug. ***