Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 665038 - phase-helpers.sh references non-existent BROOT variable in Gentoo Prefix environment
Summary: phase-helpers.sh references non-existent BROOT variable in Gentoo Prefix envi...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 659322
  Show dependency tree
 
Reported: 2018-09-01 15:15 UTC by Ting-Wei Lan
Modified: 2018-10-12 19:34 UTC (History)
1 user (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 Ting-Wei Lan 2018-09-01 15:15:14 UTC
In file bin/phase-helpers.sh, function ___best_version_and_has_version_common, there is a case statement:

case ${root_arg} in
	-r) root=${ROOT%/}/${EPREFIX#/} ;;
	-d) root=${ESYSROOT} ;;
	-b) root=${BROOT:-/} ;;
esac

There is no BROOT variable and it causes has_version to fail with 'Invalid ROOT' error.

Reproducible: Always

Steps to Reproduce:
Run 'emerge libevdev' in a Gentoo Prefix environment.
Actual Results:  
>>> Emerging (1 of 1) dev-libs/libevdev-1.5.9-r1::gentoo
 * libevdev-1.5.9.tar.xz BLAKE2B SHA512 size ;-) ... [ ok ]
has_version: Invalid ROOT: /
 * ERROR: dev-libs/libevdev-1.5.9-r1::gentoo failed (setup phase):
 *   has_version: unexpected ebuild-ipc exit code: 3
 *
 * Call stack:
 *                ebuild.sh, line  124:  Called pkg_setup
 *                ebuild.sh, line  371:  Called python-any-r1_pkg_setup
 *     python-any-r1.eclass, line  353:  Called python_setup
 *     python-any-r1.eclass, line  320:  Called _python_EPYTHON_supported 'python2.7'
 *     python-any-r1.eclass, line  262:  Called python_is_installed 'python2_7'
 *   python-utils-r1.eclass, line 1121:  Called has_version '-b' '>=dev-lang/python-2.7.5-r2:2.7'
 *         phase-helpers.sh, line  961:  Called ___best_version_and_has_version_common '-b' '>=dev-lang/python-2.7.5-r2:2.7'
 *         phase-helpers.sh, line  946:  Called die
 * The specific snippet of code:
 *                              die "${FUNCNAME[1]}: unexpected ebuild-ipc exit code: ${retval}"
 *

Expected Results:  
libevdev should be built and installed successfully.

It can be worked around by setting BROOT to EROOT in the ebuild.
Comment 1 Zac Medico gentoo-dev 2018-09-01 22:57:23 UTC
I've filed bug 665074 for the python eclass(es), since PMS says BROOT is only valid during src_* phases, so calling has_version -b during pkg_setup is invalid.
Comment 3 Larry the Git Cow gentoo-dev 2018-09-03 18:25:22 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=102220e1f71341e9bc85236074813f191bb389a4

commit 102220e1f71341e9bc85236074813f191bb389a4
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-09-02 21:55:56 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-09-03 17:38:15 +0000

    phase-helpers.sh: has/best_version -b in any phase (bug 665038)
    
    Since BROOT is only defined in src_* phases, make has/best_version -b
    use the equivalent /${PORTAGE_OVERRIDE_EPREFIX#/} value that is defined
    in all phases. This makes has/best_version -b in EAPI 7 behave exactly
    the same as --host-root behaves in EAPI 6, allowing python ebuilds to
    call python_setup in any ebuild phase.
    
    Bug: https://bugs.gentoo.org/665038
    Reviewed-by: Brian Dolbec <dolsen@gentoo.org>

 bin/phase-helpers.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)