aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2017-12-02 14:26:49 -0800
committerZac Medico <zmedico@gentoo.org>2017-12-02 14:33:06 -0800
commita544824d5f62d26b08826c991275ed8e0e70f525 (patch)
tree9d7b5844fb6657ce387cd5dd887865cb53cf20cd
parentCOPYING: License field in header should be GPL-2 rather than GPL-2+ (diff)
downloadportage-a544824d5f62d26b08826c991275ed8e0e70f525.tar.gz
portage-a544824d5f62d26b08826c991275ed8e0e70f525.tar.bz2
portage-a544824d5f62d26b08826c991275ed8e0e70f525.zip
profile_check: detect missing ARCH variable (bug 586214)
The Scheduler._env_sanity_check method executed too late to prevent a KeyError for ARCH in getmaskingstatus, so use profile_check to detect missing ARCH and exit earlier. Bug: https://bugs.gentoo.org/586214
-rw-r--r--pym/_emerge/Scheduler.py36
-rw-r--r--pym/_emerge/main.py3
-rw-r--r--pym/portage/package/ebuild/config.py4
3 files changed, 5 insertions, 38 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 079fac7b9..3a38cbafd 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -656,38 +656,6 @@ class Scheduler(PollScheduler):
return os.EX_OK
- def _env_sanity_check(self):
- """
- Verify a sane environment before trying to build anything from source.
- """
- have_src_pkg = False
- for x in self._mergelist:
- if isinstance(x, Package) and not x.built:
- have_src_pkg = True
- break
-
- if not have_src_pkg:
- return os.EX_OK
-
- for settings in self.pkgsettings.values():
- for var in ("ARCH", ):
- value = settings.get(var)
- if value and value.strip():
- continue
- msg = _("%(var)s is not set... "
- "Are you missing the '%(configroot)s%(profile_path)s' symlink? "
- "Is the symlink correct? "
- "Is your portage tree complete?") % \
- {"var": var, "configroot": settings["PORTAGE_CONFIGROOT"],
- "profile_path": portage.const.PROFILE_PATH}
-
- out = portage.output.EOutput()
- for line in textwrap.wrap(msg, 70):
- out.eerror(line)
- return FAILURE
-
- return os.EX_OK
-
def _check_manifests(self):
# Verify all the manifests now so that the user is notified of failure
# as soon as possible.
@@ -1002,10 +970,6 @@ class Scheduler(PollScheduler):
if rval != os.EX_OK:
return rval
- rval = self._env_sanity_check()
- if rval != os.EX_OK:
- return rval
-
# TODO: Immediately recalculate deps here if --keep-going
# is enabled and corrupt manifests are detected.
rval = self._check_manifests()
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index d3a415b91..6a4bb87d0 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1123,7 +1123,8 @@ def profile_check(trees, myaction):
if myaction in ("help", "info", "search", "sync", "version"):
return os.EX_OK
for root_trees in trees.values():
- if root_trees["root_config"].settings.profiles:
+ if (root_trees["root_config"].settings.profiles and
+ 'ARCH' in root_trees["root_config"].settings):
continue
# generate some profile related warning messages
validate_ebuild_environment(trees)
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 6691024f2..cd2b009aa 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1098,7 +1098,9 @@ class config(object):
profile_broken = False
- if not self.profile_path:
+ # getmaskingstatus requires ARCH for ACCEPT_KEYWORDS support
+ arch = self.get('ARCH')
+ if not self.profile_path or not arch:
profile_broken = True
else:
# If any one of these files exists, then