Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 560844 - has() doesn't work with USE defaults
Summary: has() doesn't work with USE defaults
Status: RESOLVED DUPLICATE of bug 449862
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-19 14:16 UTC by Justin Lecher (RETIRED)
Modified: 2015-09-20 05:54 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher (RETIRED) gentoo-dev 2015-09-19 14:16:39 UTC
setting

USE="+int32 int64"

and running

if has int32 ${IUSE}; then...

results in

++ has int32 static-libs test abi_x86_32 abi_x86_64 abi_x86_x32 abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_ppc_32 abi_ppc_64 abi_s390_32 abi_s390_64 +int32 int64
++ local needle=int32
++ shift
++ local x
++ for x in '"$@"'
++ '[' static-libs = int32 ']'
++ for x in '"$@"'
++ '[' test = int32 ']'
++ for x in '"$@"'
++ '[' abi_x86_32 = int32 ']'
++ for x in '"$@"'
++ '[' abi_x86_64 = int32 ']'
++ for x in '"$@"'
++ '[' abi_x86_x32 = int32 ']'
++ for x in '"$@"'
++ '[' abi_mips_n32 = int32 ']'
++ for x in '"$@"'
++ '[' abi_mips_n64 = int32 ']'
++ for x in '"$@"'
++ '[' abi_mips_o32 = int32 ']'
++ for x in '"$@"'
++ '[' abi_ppc_32 = int32 ']'
++ for x in '"$@"'
++ '[' abi_ppc_64 = int32 ']'
++ for x in '"$@"'
++ '[' abi_s390_32 = int32 ']'
++ for x in '"$@"'
++ '[' abi_s390_64 = int32 ']'
++ for x in '"$@"'
++ '[' +int32 = int32 ']'
++ for x in '"$@"'
++ '[' int64 = int32 ']'
++ return 1
Comment 1 Zac Medico gentoo-dev 2015-09-19 16:24:56 UTC
The has() function behaves as specified by PMS. The in_iuse function from eutils.eclass does what you want.
Comment 2 Zac Medico gentoo-dev 2015-09-19 16:28:29 UTC

*** This bug has been marked as a duplicate of bug 449862 ***
Comment 3 Zac Medico gentoo-dev 2015-09-19 16:35:23 UTC
Note that has() works with ${IUSE_EFFECTIVE}, and it includes flags specified by the profile via the IUSE_IMPLICIT and USE_EXPAND_IMPLICIT variables.
Comment 4 Ulrich Müller gentoo-dev 2015-09-19 18:37:25 UTC
(In reply to Zac Medico from comment #3)
> Note that has() works with ${IUSE_EFFECTIVE}, and it includes flags
> specified by the profile via the IUSE_IMPLICIT and USE_EXPAND_IMPLICIT
> variables.

But certainly we don't want to encourage usage of IUSE_EFFECTIVE in ebuilds?
By section 11.1.1, IUSE_REFERENCEABLE and IUSE_EFFECTIVE are conceptual variables which are not exported to the ebuild environment.
https://projects.gentoo.org/pms/5/pms.html#x1-11900011.1.1
Comment 5 Zac Medico gentoo-dev 2015-09-19 18:44:24 UTC
Then in_iuse from eutils probably the best approach, until EAPI 6 is released.
Comment 6 Justin Lecher (RETIRED) gentoo-dev 2015-09-20 05:54:59 UTC
(In reply to Zac Medico from comment #5)
> Then in_iuse from eutils probably the best approach, until EAPI 6 is
> released.

That's what I found.

To find something suitable I used qgrep but in_iuse is only used in eclasses not in ebuilds so it didn't pop up and I tried has()