Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 744868 - [Future EAPI] usev with a second optional argument
Summary: [Future EAPI] usev with a second optional argument
Status: RESOLVED FIXED
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: in-eapi-8
Keywords:
Depends on:
Blocks: future-eapi
  Show dependency tree
 
Reported: 2020-09-26 20:02 UTC by David Seifert
Modified: 2021-06-13 20:36 UTC (History)
3 users (show)

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 David Seifert gentoo-dev 2020-09-26 20:02:09 UTC
Currently, there's no simple solution for the use case of "echo'ing X if USE=Y is set, but otherwise return nothing". The alternative $(usex Y X '') is terrible for readability in lists, and I have encountered multiple ebuilds where the empty part has been omitted (causing weird bogus warnings). $(usev Y X) is the natural extension of usev, and is consistent with how the second argument in use_with/use_enable changes the name of the option.

Reproducible: Always
Comment 1 Ulrich Müller gentoo-dev 2020-09-27 14:01:03 UTC
Presumably we should also add this to hasv, to keep behaviour of usev and hasv consistent?
Comment 2 David Seifert gentoo-dev 2020-09-27 14:03:37 UTC
(In reply to Ulrich Müller from comment #1)
> Presumably we should also add this to hasv, to keep behaviour of usev and
> hasv consistent?

Agreed
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-09-27 14:22:08 UTC
How can you add it to hasv if hasv takes a variable number of arguments?
Comment 4 Ulrich Müller gentoo-dev 2020-09-27 15:20:56 UTC
(In reply to Michał Górny from comment #3)
> How can you add it to hasv if hasv takes a variable number of arguments?

Good point. I guess using an option to specify the output string would be awkward, and offer no advantage over "has && echo"?

So, ignore my comment #1 please.
Comment 5 Ulrich Müller gentoo-dev 2020-10-26 11:48:20 UTC
(In reply to Ulrich Müller from comment #4)
> Good point. I guess using an option to specify the output string would be
> awkward, and offer no advantage over "has && echo"?

Actually, hasv is not used in the Gentoo repository (and never was, historically). So another way to get rid of the inconsistency would be banning hasv altogether.
Comment 6 Larry the Git Cow gentoo-dev 2021-05-24 04:37:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=96c2cf5ac78f0886e23186dd84f9080572d98adf

commit 96c2cf5ac78f0886e23186dd84f9080572d98adf
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2021-05-12 12:36:53 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-05-24 04:36:52 +0000

    Support second usev arg in EAPI 8
    
    Bug: https://bugs.gentoo.org/744868
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/eapi.sh          | 4 ++++
 bin/phase-helpers.sh | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
Comment 7 Larry the Git Cow gentoo-dev 2021-06-13 19:18:59 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/pms.git/commit/?id=c2847df81db51bc1402aa9a4339d53e5a0179208

commit c2847df81db51bc1402aa9a4339d53e5a0179208
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-05-16 18:59:37 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-06-05 08:55:41 +0000

    EAPI 8: usev has an optional second argument
    
    Bug: https://bugs.gentoo.org/744868
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eapi-differences.tex |  4 ++++
 pkg-mgr-commands.tex | 23 ++++++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)