From: Zac Medico Date: Thu, 20 Dec 2007 05:16:44 +0000 (-0000) Subject: Make some adjustments so that it's possible to install binary X-Git-Tag: v2.2_pre1~154 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1732c6978e3576fb9d690f45f428ead3eeea0740;p=portage.git Make some adjustments so that it's possible to install binary packages without having a portage tree: * Make portdbapi.aux_get() return early by raising a KeyError if it detects that there is no portage tree. * Move the ARCH and USERLAND sanity check to the last moment in doebuild() and only require these variables if an existing environment (such as environment.bz2) is unavailable. * Make the NewsManager constructor cope with a broken make.profile symlink. svn path=/main/trunk/; revision=8973 --- 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.