From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BEA7B138A1C for ; Mon, 6 Apr 2015 05:13:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D5C9E089B; Mon, 6 Apr 2015 05:13:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C2522E089B for ; Mon, 6 Apr 2015 05:13:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B731F340B11 for ; Mon, 6 Apr 2015 05:13:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 419EE154F5 for ; Mon, 6 Apr 2015 05:13:10 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1428297037.096f55391d3e755e52fb12b7be06716869925539.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/checksum.py pym/portage/package/ebuild/fetch.py X-VCS-Directories: pym/portage/package/ebuild/ pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 096f55391d3e755e52fb12b7be06716869925539 X-VCS-Branch: master Date: Mon, 6 Apr 2015 05:13:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 940f26d4-17b1-4321-ae19-1913f3f0b7ca X-Archives-Hash: 4a0085646c7ac141446ebdf6e1b178a3 commit: 096f55391d3e755e52fb12b7be06716869925539 Author: Michał Górny gentoo org> AuthorDate: Sun Apr 5 07:59:29 2015 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Apr 6 05:10:37 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=096f5539 fetch(): fix support for digest size=None It seems that the code initially supported fetching without size 'digest' but it got broken over time. Add proper conditionals to avoid ugly failures in this case. Signed-off-by: Zac Medico gentoo.org> Acked-by: Brian Dolbec gentoo.org> pym/portage/checksum.py | 2 +- pym/portage/package/ebuild/fetch.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index f24a90f..642602e 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -303,7 +303,7 @@ def verify_all(filename, mydict, calc_prelink=0, strict=0): reason = "Reason unknown" try: mysize = os.stat(filename)[stat.ST_SIZE] - if mydict["size"] != mysize: + if mydict.get("size") is not None and mydict["size"] != mysize: return False,(_("Filesize does not match recorded size"), mysize, mydict["size"]) except OSError as e: if e.errno == errno.ENOENT: diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py index 7b856a2..7e4e6fe 100644 --- a/pym/portage/package/ebuild/fetch.py +++ b/pym/portage/package/ebuild/fetch.py @@ -700,7 +700,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, os.unlink(myfile_path) except OSError: pass - elif distdir_writable: + elif distdir_writable and size is not None: if mystat.st_size < fetch_resume_size and \ mystat.st_size < size: # If the file already exists and the size does not @@ -806,8 +806,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, # assume that it is fully downloaded. continue else: - if mystat.st_size < mydigests[myfile]["size"] and \ - not restrict_fetch: + if (mydigests[myfile].get("size") is not None + and 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"]: