summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-03-28 11:59:23 +0000
committerZac Medico <zmedico@gentoo.org>2008-03-28 11:59:23 +0000
commit9607f376d86b3a1fe05df91fa92af2e22bdce5e7 (patch)
tree965235fa8d5d5a674121fbf04da189f1e7629f2e /pym
parent04f753b4e6283571481ba7fe823d06259da276c1 (diff)
downloadportage-9607f376d86b3a1fe05df91fa92af2e22bdce5e7.tar.gz
portage-9607f376d86b3a1fe05df91fa92af2e22bdce5e7.tar.bz2
portage-9607f376d86b3a1fe05df91fa92af2e22bdce5e7.zip
* Optimize parallel-fetch to avoid redundant checksum verification.
* Add parallel-fetch to the default FEATURES since it is more efficient now. (trunk r9462) svn path=/main/branches/2.1.2/; revision=9553
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 25789db80..eea0cb53e 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -3008,6 +3008,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
checksum_failure_primaryuri = 2
thirdpartymirrors = mysettings.thirdpartymirrors()
+ # In the background parallel-fetch process, it's safe to skip checksum
+ # verification of pre-existing files in $DISTDIR that have the correct
+ # file size. The parent process will verify their checksums prior to
+ # the unpack phase.
+
+ parallel_fetchonly = fetchonly and \
+ "PORTAGE_PARALLEL_FETCHONLY" in mysettings
+
check_config_instance(mysettings)
custommirrors = grabdict(os.path.join(mysettings["PORTAGE_CONFIGROOT"],
@@ -3203,7 +3211,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
if use_locks and can_fetch:
waiting_msg = None
- if "parallel-fetch" in features:
+ if not parallel_fetchonly and "parallel-fetch" in features:
waiting_msg = ("Downloading '%s'... " + \
"see /var/log/emerge-fetch.log for details.") % myfile
if locks_in_subdir:
@@ -3262,6 +3270,15 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
if mystat.st_size < mydigests[myfile]["size"] and \
not restrict_fetch:
fetched = 1 # Try to resume this download.
+ elif parallel_fetchonly and \
+ mystat.st_size == mydigests[myfile]["size"]:
+ eout = portage.output.EOutput()
+ eout.quiet = \
+ mysettings.get("PORTAGE_QUIET") == "1"
+ eout.ebegin(
+ "%s size ;-)" % (myfile, ))
+ eout.eend(0)
+ continue
else:
verified_ok, reason = portage_checksum.verify_all(
myfile_path, mydigests[myfile])
@@ -4720,6 +4737,11 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
fetchme = newuris[:]
checkme = alist[:]
+ if mydo == "fetch":
+ # Files are already checked inside fetch(),
+ # so do not check them again.
+ checkme = []
+
# Only try and fetch the files if we are going to need them ...
# otherwise, if user has FEATURES=noauto and they run `ebuild clean
# unpack compile install`, we will try and fetch 4 times :/