Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 528274 - `ebuild` preserves environment between pkg_pretend() and pkg_setup()
Summary: `ebuild` preserves environment between pkg_pretend() and pkg_setup()
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2014-11-05 06:11 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2015-01-02 05:24 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 Arfrever Frehtes Taifersar Arahesis 2014-11-05 06:11:05 UTC
`ebuild` tool preserves environment between pkg_pretend() and pkg_setup(), which is incorrect.
`emerge` behaves correctly.


Ebuild:

EAPI="5"
SLOT="0"
KEYWORDS="*"
pkg_pretend() {
        MY_VAR="123"
        declare -p EBUILD_PHASE MY_VAR
}
pkg_setup() {
        declare -p EBUILD_PHASE MY_VAR
}


Output from `emerge ${package}`:

declare -rx EBUILD_PHASE="pretend"
declare -- MY_VAR="123"
...
declare -rx EBUILD_PHASE="setup"
${EBUILD}: line 9: declare: MY_VAR: not found


Output from `ebuild ${EBUILD} setup`:

declare -rx EBUILD_PHASE="pretend"
declare -- MY_VAR="123"
...
declare -rx EBUILD_PHASE="setup"
declare -- MY_VAR="123"
Comment 1 Zac Medico gentoo-dev 2014-11-05 06:54:03 UTC
I have a patch in this branch:

	https://github.com/zmedico/portage/tree/bug_528274

I've posted it for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4751
Comment 2 Zac Medico gentoo-dev 2014-11-29 18:35:25 UTC
This is in the master branch now:

https://github.com/gentoo/portage/commit/743b3337644fbb3ea461d3a9137c9ac85e163f03
Comment 3 Zac Medico gentoo-dev 2014-11-29 23:56:00 UTC
(In reply to Zac Medico from comment #2)
> This is in the master branch now:
> 
> https://github.com/gentoo/portage/commit/
> 743b3337644fbb3ea461d3a9137c9ac85e163f03

This broke pkg_setup environment handling for binary packages. I've posted a fix for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4860
Comment 4 Zac Medico gentoo-dev 2014-12-02 18:33:16 UTC
(In reply to Zac Medico from comment #3)
> This broke pkg_setup environment handling for binary packages. I've posted a
> fix for review here:
> 
> 	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4860

This is in the master branch now:

https://github.com/gentoo/portage/commit/58c27aec81262d6840e36f2f56c32bec68c414c1
Comment 5 Arfrever Frehtes Taifersar Arahesis 2015-01-02 05:24:15 UTC
Fixed in Portage 2.2.15.