Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 582202 - net-p2p/bitcoin-qt, net-p2p/bitcoind: 'use' calls in global scope
Summary: net-p2p/bitcoin-qt, net-p2p/bitcoind: 'use' calls in global scope
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords: QAcanfix
Depends on:
Blocks: global-scope-use
  Show dependency tree
 
Reported: 2016-05-05 21:02 UTC by Michał Górny
Modified: 2016-07-01 22:59 UTC (History)
2 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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-05-05 21:02:28 UTC
Please remove all 'use' calls from global scope, they will be banned in Portage completely soon.

Disclaimer: I have no clue where the call is coming from. Maybe it's the eclass but I'm not up to reading another toolchain.eclass.


WARNING: 'use' function invoked by net-p2p/bitcoin-qt-0.10.2-r1 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoin-qt-0.10.2 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoin-qt-0.11.0 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoin-qt-0.11.1 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoin-qt-0.11.2 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoin-qt-0.12.0 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoin-qt-9999 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-0.10.2-r1 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-0.10.2 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-0.11.0 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-0.11.1 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-0.11.2 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-0.12.0 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.

WARNING: 'use' function invoked by net-p2p/bitcoind-9999 during metadata regeneration.
WARNING: Please ensure upstream is aware of it and working to remove it.
Comment 1 Anthony Basile gentoo-dev 2016-05-05 23:20:23 UTC
@luke-jr  the problem is in the bitcoincore.eclass and its probably coming in at least from the use_if_iuse functions, but maybe elsewhere too

@mgorny what utility are you using to check?  i think i see where its coming in and i can see how to code around it, but i need a utility for feedback.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-05-06 05:20:38 UTC
(In reply to Anthony Basile from comment #1)
> @luke-jr  the problem is in the bitcoincore.eclass and its probably coming
> in at least from the use_if_iuse functions, but maybe elsewhere too
> 
> @mgorny what utility are you using to check?  i think i see where its coming
> in and i can see how to code around it, but i need a utility for feedback.

It's pkgcore. However, you can also take Portage and apply the latest patch I sent to the gentoo-portage-dev ml (which isn't showing up in archive for some reason, so I've forwarded it to you).
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-05-20 21:19:12 UTC
Anthony, any chance you would be able to put some urgency on this one? Git versions of Portage already ban this.
Comment 4 Anthony Basile gentoo-dev 2016-05-20 21:49:40 UTC
(In reply to Michał Górny from comment #3)
> Anthony, any chance you would be able to put some urgency on this one? Git
> versions of Portage already ban this.

I'll look at it tomorrow.  I don't understand why luke-jr hasn't responded, its his package.  I'm just proxying.  What's the alternative?  Mask its consumers and yank?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-05-20 22:29:38 UTC
I don't think that's an alternative since metadata cache generation will still fail. I think this will also stop rsync when it is released and Infra upgrades portage.
Comment 6 Anthony Basile gentoo-dev 2016-05-21 00:20:23 UTC
Okay I looked at this and the following fixes the issue.  It looks to me salvageable provided we drop the `! use_if_iuse test`

I'll give luke-jr a day or so to answer, and if not, I'll go conservative and assume `! use_if_iuse test` returns true since then we expand the commen depend atoms.  At worst its overkill, but shouldn't break.


diff --git a/eclass/bitcoincore.eclass b/eclass/bitcoincore.eclass
index 5661cb0..be8911e 100644
--- a/eclass/bitcoincore.eclass
+++ b/eclass/bitcoincore.eclass
@@ -198,12 +198,6 @@ fi
 if [ "${BITCOINCORE_NEED_LIBSECP256K1}" = "1" ]; then
        BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND} $LIBSECP256K1_DEPEND"
 fi
-if [ "${PN}" != "libbitcoinconsensus" ] && ! use_if_iuse test; then
-       BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND}
-               ${UNIVALUE_DEPEND}
-               >=dev-libs/boost-1.52.0[threads(+)]
-       "
-fi
 bitcoincore_common_depend_use() {
        in_bcc_iuse "$1" || return
        BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND} $1? ( $2 )"
Comment 7 Luke-Jr 2016-05-21 03:37:12 UTC
That appears it will remove dependencies - not sure how that could be safe.

Seems like the solution would be to turn the use_if_iuse into an in_iuse and wrap to the dep additions in test? ( ... ), but I don't really have a reasonable way to test if that silences it unless repoman is updated.

(Correct me if I'm wrong, but the urgency here appears artificial, so I have prioritised it below things which are unavoidably urgent thus far...)
Comment 8 Ulrich Müller gentoo-dev 2016-05-21 06:35:27 UTC
(In reply to Luke-Jr from comment #7)
> Seems like the solution would be to turn the use_if_iuse into an in_iuse and
> wrap to the dep additions in test? ( ... ), but I don't really have a
> reasonable way to test if that silences it unless repoman is updated.

in_iuse() cannot be used in global scope either.
Comment 9 Anthony Basile gentoo-dev 2016-05-21 11:26:46 UTC
(In reply to Ulrich Müller from comment #8)
> (In reply to Luke-Jr from comment #7)
> > Seems like the solution would be to turn the use_if_iuse into an in_iuse and
> > wrap to the dep additions in test? ( ... ), but I don't really have a
> > reasonable way to test if that silences it unless repoman is updated.
> 
> in_iuse() cannot be used in global scope either.

for the records, pkgcore doesn't catch this.  we really need a QA check for this.

@luke-jr, comment #7.  How will it remove dependencies?  assuming everything after the && is true errors on the side of caution.  Suggest something which elimitates the use_if_iuse().
Comment 10 Luke-Jr 2016-05-21 12:26:07 UTC
(In reply to Anthony Basile from comment #9)
> @luke-jr, comment #7.  How will it remove dependencies?  assuming everything
> after the && is true errors on the side of caution.  Suggest something which
> elimitates the use_if_iuse().

The patch literally removes the part where univalue/boost get added to the depends.

If we can't use in_iuse, then I guess the only solution is to have a BITCOINCORE_IUSE which we test and copy to IUSE...
Comment 11 Anthony Basile gentoo-dev 2016-05-21 14:03:08 UTC
(In reply to Luke-Jr from comment #10)
> (In reply to Anthony Basile from comment #9)
> > @luke-jr, comment #7.  How will it remove dependencies?  assuming everything
> > after the && is true errors on the side of caution.  Suggest something which
> > elimitates the use_if_iuse().
> 
> The patch literally removes the part where univalue/boost get added to the
> depends.
> 
> If we can't use in_iuse, then I guess the only solution is to have a
> BITCOINCORE_IUSE which we test and copy to IUSE...

No you misunderstood what I'm saying.  Read the first line of comment #6.  Here's what I'm proposing:

diff --git a/eclass/bitcoincore.eclass b/eclass/bitcoincore.eclass
index 5661cb0..c040c34 100644
--- a/eclass/bitcoincore.eclass
+++ b/eclass/bitcoincore.eclass
@@ -198,7 +198,7 @@ fi
 if [ "${BITCOINCORE_NEED_LIBSECP256K1}" = "1" ]; then
        BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND} $LIBSECP256K1_DEPEND"
 fi
-if [ "${PN}" != "libbitcoinconsensus" ] && ! use_if_iuse test; then
+if [ "${PN}" != "libbitcoinconsensus" ]; then
        BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND}
                ${UNIVALUE_DEPEND}
                >=dev-libs/boost-1.52.0[threads(+)]
Comment 12 Luke-Jr 2016-05-21 14:11:10 UTC
(In reply to Anthony Basile from comment #11)
> (In reply to Luke-Jr from comment #10)
> > (In reply to Anthony Basile from comment #9)
> > > @luke-jr, comment #7.  How will it remove dependencies?  assuming everything
> > > after the && is true errors on the side of caution.  Suggest something which
> > > elimitates the use_if_iuse().
> > 
> > The patch literally removes the part where univalue/boost get added to the
> > depends.
> > 
> > If we can't use in_iuse, then I guess the only solution is to have a
> > BITCOINCORE_IUSE which we test and copy to IUSE...
> 
> No you misunderstood what I'm saying.  Read the first line of comment #6. 
> Here's what I'm proposing:
> 
> diff --git a/eclass/bitcoincore.eclass b/eclass/bitcoincore.eclass
> index 5661cb0..c040c34 100644
> --- a/eclass/bitcoincore.eclass
> +++ b/eclass/bitcoincore.eclass
> @@ -198,7 +198,7 @@ fi
>  if [ "${BITCOINCORE_NEED_LIBSECP256K1}" = "1" ]; then
>         BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND}
> $LIBSECP256K1_DEPEND"
>  fi
> -if [ "${PN}" != "libbitcoinconsensus" ] && ! use_if_iuse test; then
> +if [ "${PN}" != "libbitcoinconsensus" ]; then
>         BITCOINCORE_COMMON_DEPEND="${BITCOINCORE_COMMON_DEPEND}
>                 ${UNIVALUE_DEPEND}
>                 >=dev-libs/boost-1.52.0[threads(+)]

Ok, the only problem here is the unnecessary dependencies for some ebuilds. Maybe acceptable as a temporary hack.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-05-21 17:11:16 UTC
I would go for eclass variable that's set in ebuild and causes the eclass to add IUSE and dependencies.
Comment 14 Anthony Basile gentoo-dev 2016-05-22 11:52:53 UTC
(In reply to Michał Górny from comment #13)
> I would go for eclass variable that's set in ebuild and causes the eclass to
> add IUSE and dependencies.

Yeah, but its annoying that one has to manually put in a calculable logic.  

@luke-jr, if you want to do this then please provide a patch else I'll proceed with the patch comment #11.
Comment 15 Anthony Basile gentoo-dev 2016-05-25 12:23:37 UTC
(In reply to Anthony Basile from comment #14) 
> @luke-jr, if you want to do this then please provide a patch else I'll
> proceed with the patch comment #11.

okay i've pushed this and pkgcore is no longer complaining about use_if_iuse() in the global scope.

if you want a better fix propose it in a patch, otherwise this bug is done.
Comment 16 Luke-Jr 2016-07-01 22:59:15 UTC
Included a proper fix in https://github.com/gentoo/gentoo/pull/1813