diff options
Diffstat (limited to 'portage_with_autodep/pym/_emerge/EbuildFetcher.py')
-rw-r--r-- | portage_with_autodep/pym/_emerge/EbuildFetcher.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/portage_with_autodep/pym/_emerge/EbuildFetcher.py b/portage_with_autodep/pym/_emerge/EbuildFetcher.py index feb68d0..c0a7fdd 100644 --- a/portage_with_autodep/pym/_emerge/EbuildFetcher.py +++ b/portage_with_autodep/pym/_emerge/EbuildFetcher.py @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import traceback @@ -21,7 +21,7 @@ class EbuildFetcher(SpawnProcess): __slots__ = ("config_pool", "ebuild_path", "fetchonly", "fetchall", "pkg", "prefetch") + \ - ("_digests", "_settings", "_uri_map") + ("_digests", "_manifest", "_settings", "_uri_map") def already_fetched(self, settings): """ @@ -40,7 +40,7 @@ class EbuildFetcher(SpawnProcess): digests = self._get_digests() distdir = settings["DISTDIR"] - allow_missing = "allow-missing-manifests" in settings.features + allow_missing = self._get_manifest().allow_missing for filename in uri_map: # Use stat rather than lstat since fetch() creates @@ -163,10 +163,15 @@ class EbuildFetcher(SpawnProcess): pid = os.fork() if pid != 0: + if not isinstance(pid, int): + raise AssertionError( + "fork returned non-integer: %s" % (repr(pid),)) portage.process.spawned_pids.append(pid) return [pid] - portage.process._setup_pipes(fd_pipes) + portage.locks._close_fds() + # Disable close_fds since we don't exec (see _setup_pipes docstring). + portage.process._setup_pipes(fd_pipes, close_fds=False) # Use default signal handlers in order to avoid problems # killing subprocesses as reported in bug #353239. @@ -179,7 +184,7 @@ class EbuildFetcher(SpawnProcess): not in ('yes', 'true') rval = 1 - allow_missing = 'allow-missing-manifests' in self._settings.features + allow_missing = self._get_manifest().allow_missing try: if fetch(self._uri_map, self._settings, fetchonly=self.fetchonly, digests=copy.deepcopy(self._get_digests()), @@ -203,11 +208,16 @@ class EbuildFetcher(SpawnProcess): raise AssertionError("ebuild not found for '%s'" % self.pkg.cpv) return self.ebuild_path + def _get_manifest(self): + if self._manifest is None: + pkgdir = os.path.dirname(self._get_ebuild_path()) + self._manifest = self.pkg.root_config.settings.repositories.get_repo_for_location( + os.path.dirname(os.path.dirname(pkgdir))).load_manifest(pkgdir, None) + return self._manifest + def _get_digests(self): - if self._digests is not None: - return self._digests - self._digests = portage.Manifest(os.path.dirname( - self._get_ebuild_path()), None).getTypeDigests("DIST") + if self._digests is None: + self._digests = self._get_manifest().getTypeDigests("DIST") return self._digests def _get_uri_map(self): |