From f5437b41e68385b66a867c0d509710ea32915bc3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 11 Mar 2009 06:12:24 +0000 Subject: [PATCH] In EbuildFetchonly.execute(), skip builddir creation when the ebuild does not set RESTRICT=fetch (since it's not possible for pkg_nofetch to be executed in this case). (trunk r12686) svn path=/main/branches/2.1.6/; revision=12946 --- pym/_emerge/__init__.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index aeb4f0b5e..0a910928e 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1664,6 +1664,32 @@ class EbuildFetchonly(SlotObject): __slots__ = ("fetch_all", "pkg", "pretend", "settings") def execute(self): + settings = self.settings + pkg = self.pkg + portdb = pkg.root_config.trees["porttree"].dbapi + ebuild_path = portdb.findname(pkg.cpv) + settings.setcpv(pkg) + debug = settings.get("PORTAGE_DEBUG") == "1" + use_cache = 1 # always true + portage.doebuild_environment(ebuild_path, "fetch", + settings["ROOT"], settings, debug, use_cache, portdb) + restrict_fetch = 'fetch' in settings['PORTAGE_RESTRICT'].split() + + if restrict_fetch: + rval = self._execute_with_builddir() + else: + rval = portage.doebuild(ebuild_path, "fetch", + settings["ROOT"], settings, debug=debug, + listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all, + mydbapi=portdb, tree="porttree") + + if rval != os.EX_OK: + msg = "Fetch failed for '%s'" % (pkg.cpv,) + eerror(msg, phase="unpack", key=pkg.cpv) + + return rval + + def _execute_with_builddir(self): # To spawn pkg_nofetch requires PORTAGE_BUILDDIR for # ensuring sane $PWD (bug #239560) and storing elog # messages. Use a private temp directory, in order @@ -1693,11 +1719,7 @@ class EbuildFetchonly(SlotObject): root_config = pkg.root_config portdb = root_config.trees["porttree"].dbapi ebuild_path = portdb.findname(pkg.cpv) - settings.setcpv(pkg) debug = settings.get("PORTAGE_DEBUG") == "1" - use_cache = 1 # always true - portage.doebuild_environment(ebuild_path, "fetch", - root_config.root, settings, debug, use_cache, portdb) portage.prepare_build_dirs(self.pkg.root, self.settings, 0) retval = portage.doebuild(ebuild_path, "fetch", -- 2.26.2