From 88797f923c6d2eee3e638316ce14964d6c75c75c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 30 Apr 2009 08:36:57 +0000 Subject: [PATCH] Fix ACCEPT_LICENSE handling for binary packages, so that the build-time USE settings are used calculate an appropriate ACCEPT_LICENSE value. svn path=/main/trunk/; revision=13560 --- bin/isolated-functions.sh | 2 +- pym/portage/__init__.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index ccef19ed2..0d046cbda 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -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 \ diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index c121a0b9d..1b927d516 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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. -- 2.26.2