Fix ACCEPT_LICENSE handling for binary packages, so that the build-time USE
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 08:36:57 +0000 (08:36 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 08:36:57 +0000 (08:36 -0000)
settings are used calculate an appropriate ACCEPT_LICENSE value.

svn path=/main/trunk/; revision=13560

bin/isolated-functions.sh
pym/portage/__init__.py

index ccef19ed222e73834330654b19a534401f759fd9..0d046cbda86a43452a014b6aa1569eca2bc8f38b 100755 (executable)
@@ -522,7 +522,7 @@ save_ebuild_env() {
                        ${QA_INTERCEPTORS}
 
                # portage config variables and variables set directly by portage
-               unset BAD BRACKET BUILD_PREFIX COLS \
+               unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \
                        DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \
                        EBUILD_EXIT_STATUS_FILE EBUILD_FORCE_TEST EBUILD_MASTER_PID \
                        ECLASSDIR ECLASS_DEPTH ENDCOL FAKEROOTKEY \
index c121a0b9d5c189afa1d0e3c429cf87453c814332..1b927d516f7a8952c5ea574b0ccfb064196605fa 100644 (file)
@@ -1061,7 +1061,7 @@ class config(object):
        # environment in order to prevent sandbox from sourcing /etc/profile
        # in it's bashrc (causing major leakage).
        _environ_whitelist += [
-               "BASH_ENV", "BUILD_PREFIX", "D",
+               "ACCEPT_LICENSE", "BASH_ENV", "BUILD_PREFIX", "D",
                "DISTDIR", "DOC_SYMLINKS_DIR", "EBUILD",
                "EBUILD_EXIT_STATUS_FILE", "EBUILD_FORCE_TEST",
                "EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "EMERGE_FROM",
@@ -2080,18 +2080,22 @@ class config(object):
                big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG
                errors as in bug #262647.
                """
-               __slots__ = ('settings',)
+               __slots__ = ('built_use', 'settings',)
 
-               def __init__(self, settings):
+               def __init__(self, built_use, settings):
+                       self.built_use = built_use
                        self.settings = settings
 
                def __call__(self):
                        settings = self.settings
+                       use = self.built_use
+                       if use is None:
+                               use = settings['PORTAGE_USE']
                        try:
                                licenses = set(flatten(
                                        dep.use_reduce(dep.paren_reduce(
                                        settings['LICENSE']),
-                                       uselist=settings['PORTAGE_USE'].split())))
+                                       uselist=use.split())))
                        except exception.InvalidDependString:
                                licenses = set()
                        if '*' not in settings._accept_license:
@@ -2196,11 +2200,14 @@ class config(object):
                self.modifying()
 
                pkg = None
+               built_use = None
                if not isinstance(mycpv, basestring):
                        pkg = mycpv
                        mycpv = pkg.cpv
                        mydb = pkg.metadata
                        args_hash = (mycpv, id(pkg))
+                       if pkg.built:
+                               built_use = pkg.metadata['USE']
                else:
                        args_hash = (mycpv, id(mydb))
 
@@ -2318,7 +2325,7 @@ class config(object):
                                env_configdict.pop(k, None)
 
                env_configdict.addLazySingleton('ACCEPT_LICENSE',
-                       self._lazy_accept_license(self))
+                       self._lazy_accept_license(built_use, self))
 
                # If reset() has not been called, it's safe to return
                # early if IUSE has not changed.