summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-28 12:41:26 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-28 13:52:30 -0800
commit416709db131e9fa45cab929445d944928b8935af (patch)
tree53d61ac81547621905800df1845ed8eff6bd4c3a
parentdfe974e1e797281ebd45bed9d6da8efab50ef75c (diff)
downloadportage-416709db131e9fa45cab929445d944928b8935af.tar.gz
portage-416709db131e9fa45cab929445d944928b8935af.tar.bz2
portage-416709db131e9fa45cab929445d944928b8935af.zip
EbuildFetcher: pass digests to fetch()
-rw-r--r--pym/_emerge/EbuildFetcher.py12
-rw-r--r--pym/portage/package/ebuild/fetch.py9
2 files changed, 14 insertions, 7 deletions
diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py
index 614a0decd..ba56fafd0 100644
--- a/pym/_emerge/EbuildFetcher.py
+++ b/pym/_emerge/EbuildFetcher.py
@@ -4,6 +4,7 @@
import traceback
from _emerge.SpawnProcess import SpawnProcess
+import copy
import sys
import portage
from portage import os
@@ -18,7 +19,7 @@ from portage.util._pty import _create_pty_or_pipe
class EbuildFetcher(SpawnProcess):
__slots__ = ("config_pool", "fetchonly", "fetchall", "pkg", "prefetch") + \
- ("_settings", "_uri_map")
+ ("_digests", "_settings", "_uri_map")
def _start(self):
@@ -46,6 +47,9 @@ class EbuildFetcher(SpawnProcess):
self.wait()
return
+ self._digests = portage.Manifest(
+ os.path.dirname(ebuild_path), None).getTypeDigests("DIST")
+
settings = self.config_pool.allocate()
settings.setcpv(self.pkg)
portage.doebuild_environment(ebuild_path, 'fetch',
@@ -98,7 +102,8 @@ class EbuildFetcher(SpawnProcess):
rval = 1
try:
- if fetch(self._uri_map, self._settings, fetchonly=self.fetchonly):
+ if fetch(self._uri_map, self._settings, fetchonly=self.fetchonly,
+ digests=copy.deepcopy(self._digests)):
rval = os.EX_OK
except SystemExit:
raise
@@ -121,7 +126,6 @@ class EbuildFetcher(SpawnProcess):
return portdb.getFetchMap(self.pkg.cpv, useflags=use, mytree=mytree)
def _prefetch_size_ok(self, uri_map, settings, ebuild_path):
- pkgdir = os.path.dirname(ebuild_path)
distdir = settings["DISTDIR"]
sizes = {}
@@ -136,7 +140,7 @@ class EbuildFetcher(SpawnProcess):
return False
sizes[filename] = st.st_size
- digests = portage.Manifest(pkgdir, distdir).getTypeDigests("DIST")
+ digests = self._digests
for filename, actual_size in sizes.items():
size = digests.get(filename, {}).get('size')
if size is None:
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
index f1bd2408a..7e4365fb7 100644
--- a/pym/portage/package/ebuild/fetch.py
+++ b/pym/portage/package/ebuild/fetch.py
@@ -230,7 +230,8 @@ _size_suffix_map = {
'Y' : 80,
}
-def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",use_locks=1, try_mirrors=1):
+def fetch(myuris, mysettings, listonly=0, fetchonly=0,
+ locks_in_subdir=".locks", use_locks=1, try_mirrors=1, digests=None):
"fetch files. Will use digest file if available."
if not myuris:
@@ -352,12 +353,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
skip_manifest = mysettings.get("EBUILD_SKIP_MANIFEST") == "1"
pkgdir = mysettings.get("O")
- if not (pkgdir is None or skip_manifest):
+ if digests is None and not (pkgdir is None or skip_manifest):
mydigests = Manifest(
pkgdir, mysettings["DISTDIR"]).getTypeDigests("DIST")
- else:
+ elif digests is None:
# no digests because fetch was not called for a specific package
mydigests = {}
+ else:
+ mydigests = digests
ro_distdirs = [x for x in \
shlex_split(mysettings.get("PORTAGE_RO_DISTDIRS", "")) \