Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 52652 - running `ebuild` does not preserve environment across functions like `emerge` does
Summary: running `ebuild` does not preserve environment across functions like `emerge`...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 56408
Blocks:
  Show dependency tree
 
Reported: 2004-05-31 22:01 UTC by SpanKY
Modified: 2004-10-22 08:48 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 SpanKY gentoo-dev 2004-05-31 22:01:10 UTC
i hit a snag with xorg-x11 and running `ebuild unpack` on it and i traced it back to the fact that the environment setup in previous functions (like pkg_setup()) is not passed on to subsequent functions

however, if you run `emerge xorg-x11`, the environment setup in pkg_setup() *is* passed on properly to src_unpack()

in this case, pkg_setup() exports a few variables that src_unpack() needs (PATCHDIR/EXCLUDED) in order to work correctly

test cases that failed:
# with FEATURES=noauto
ebuild xorg-x11-6.7.0.ebuild setup clean unpack
ebuild xorg-x11-6.7.0.ebuild clean setup unpack
# with FEATURES=-noauto
ebuild xorg-x11-6.7.0.ebuild unpack
test case that passed:
emerge xorg-x11

root@vapier 0 root # emerge info
Portage 2.0.51_pre9 (2004.0, gcc-3.4.0, glibc-2.3.3_pre20040420-r0, 2.6.7-rc2)
=================================================================
System uname: 2.6.7-rc2 i686 Intel(R) Pentium(R) 4 CPU 1.80GHz
Gentoo Base System version 1.4.15
distcc 2.14 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5
Binutils: sys-devel/binutils-2.15.91.0.1
ACCEPT_KEYWORDS="x86 ~x86"
Comment 1 Masatomo Nakano (RETIRED) gentoo-dev 2004-06-19 22:39:21 UTC
> # with FEATURES=noauto
> ebuild xorg-x11-6.7.0.ebuild setup clean unpack

This would not work correctly because portage would clean environment before unpack.

> ebuild xorg-x11-6.7.0.ebuild clean setup unpack

This should work.. (I tested it in my environment and it worked)
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2004-06-20 19:45:38 UTC
I'm not sure if this is the same bug or just related: It appears that shell variables are preserved from pkg_setup to src_* functions, but they are not preserved as environment variables.  For example:

pkg_setup() {
   export TESTVAR=hello
   echo "pkg_setup"
   echo "---------"
   echo "Testing shell variable: $(echo TESTVAR=${TESTVAR})"
   echo "Testing environment variable: $(env | grep ^TESTVAR)"
   echo
}

src_unpack() {
   echo "src_unpack"
   echo "---------"
   echo "Testing shell variable: $(echo TESTVAR=${TESTVAR})"
   echo "Testing environment variable: $(env | grep ^TESTVAR)"
   echo
}

Results:
   pkg_setup
   ---------
   Testing shell variable: TESTVAR=hello
   Testing environment variable: TESTVAR=hello

   src_unpack
   ----------
   Testing shell variable: TESTVAR=hello
   Testing environment variable: 

This is clearly not good behavior.  Portage should be preserving the export attribute of variables between functions.
Comment 3 Brian Harring (RETIRED) gentoo-dev 2004-06-25 06:24:07 UTC
I'm adjusting ebuild.sh so that it correctly reuses the saved environment (and only the environment + portage exported vars after setup phase)- I'll look into this while I'm at it...
Comment 4 solar (RETIRED) gentoo-dev 2004-08-13 21:55:03 UTC
I just encountered more or less this bug with sys-apps/portage-2.0.51_pre17 + a 
cvs update from yesterday on the same package. The workaround for me was to call a 
pkg_setup from the src_unpack just so I could begin the compile process.

Re comment #3
Can we expect to see your ebuild.sh  update that reuses the saved environment in 
pre18?
Comment 5 Nicholas Jones (RETIRED) gentoo-dev 2004-10-22 08:48:04 UTC
Bug has been fixed and released in stable portages on or before 2.0.51-r2