summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/__init__.py13
-rw-r--r--pym/portage/__init__.py16
-rw-r--r--pym/portage/dbapi/porttree.py9
-rw-r--r--pym/portage/news.py10
4 files changed, 32 insertions, 16 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 85b0566b6..36c3234a9 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -6671,18 +6671,7 @@ def parse_opts(tmpcmdline, silent=False):
return myaction, myopts, myfiles
def validate_ebuild_environment(trees):
- for myroot in trees:
- mysettings = trees[myroot]["vartree"].settings
- for var in "ARCH", "USERLAND":
- if mysettings.get(var):
- continue
- print >> sys.stderr, bad(("\a!!! %s is not set... " % var) + \
- "Are you missing the '%setc/make.profile' symlink?" % \
- mysettings["PORTAGE_CONFIGROOT"])
- print >> sys.stderr, bad("\a!!! Is the symlink correct? " + \
- "Is your portage tree complete?\n")
- sys.exit(9)
- del myroot, mysettings
+ pass
def load_emerge_config(trees=None):
kwargs = {}
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 1c9956336..3bcba4d6f 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -4512,6 +4512,22 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
env_stat = None
if env_stat:
mysettings._filter_calling_env = True
+ else:
+ for var in "ARCH", "USERLAND":
+ if mysettings.get(var):
+ continue
+ msg = ("%s is not set... " % var) + \
+ ("Are you missing the '%setc/make.profile' symlink? " % \
+ mysettings["PORTAGE_CONFIGROOT"]) + \
+ "Is the symlink correct? " + \
+ "Is your portage tree complete?"
+ from portage.elog.messages import eerror
+ from textwrap import wrap
+ for line in wrap(msg, 70):
+ eerror(line, phase=mydo, key=mysettings.mycpv)
+ from portage.elog import elog_process
+ elog_process(mysettings.mycpv, mysettings)
+ return 1
del env_file, env_stat, saved_env
_doebuild_exit_status_unlink(
mysettings.get("EBUILD_EXIT_STATUS_FILE"))
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 0ed55fba8..be2015628 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -68,6 +68,13 @@ class portdbapi(dbapi):
self.eclassdb = eclass_cache.cache(self.porttree_root,
overlays=self.mysettings["PORTDIR_OVERLAY"].split())
+ # This is used as sanity check for aux_get(). If there is no
+ # root eclass dir, we assume that PORTDIR is invalid or
+ # missing. This check allows aux_get() to detect a missing
+ # portage tree and return early by raising a KeyError.
+ self._have_root_eclass_dir = os.path.isdir(
+ os.path.join(self.porttree_root, "eclasses"))
+
self.metadbmodule = self.mysettings.load_best_module("portdbapi.metadbmodule")
#if the portdbapi is "frozen", then we assume that we can cache everything (that no updates to it are happening)
@@ -303,6 +310,8 @@ class portdbapi(dbapi):
if doregen:
if myebuild in self._broken_ebuilds:
raise KeyError(mycpv)
+ if not self._have_root_eclass_dir:
+ raise KeyError(mycpv)
writemsg("doregen: %s %s\n" % (doregen, mycpv), 2)
writemsg("Generating cache entry(0) for: "+str(myebuild)+"\n", 1)
diff --git a/pym/portage/news.py b/pym/portage/news.py
index 540372e10..da7e159af 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -36,10 +36,12 @@ class NewsManager(object):
portdir = portdb.porttree_root
profiles_base = os.path.join(portdir, 'profiles') + os.path.sep
- profile_path = normalize_path(
- os.path.realpath(portdb.mysettings.profile_path))
- if profile_path.startswith(profiles_base):
- profile_path = profile_path[len(profiles_base):]
+ profile_path = None
+ if portdb.mysettings.profile_path:
+ profile_path = normalize_path(
+ os.path.realpath(portdb.mysettings.profile_path))
+ if profile_path.startswith(profiles_base):
+ profile_path = profile_path[len(profiles_base):]
self._profile_path = profile_path
# Ensure that the unread path exists and is writable.