From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1123262-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id CCF0F138334
	for <garchives@archives.gentoo.org>; Sun, 17 Nov 2019 21:04:22 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 20BA4E086C;
	Sun, 17 Nov 2019 21:04:22 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 02C7EE086C
	for <gentoo-commits@lists.gentoo.org>; Sun, 17 Nov 2019 21:04:21 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id DFD4B34CF27
	for <gentoo-commits@lists.gentoo.org>; Sun, 17 Nov 2019 21:04:20 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 6E19485C
	for <gentoo-commits@lists.gentoo.org>; Sun, 17 Nov 2019 21:04:19 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
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" <zmedico@gentoo.org>
Message-ID: <1574024459.0fddb27ef3fd005d236738b6c696152bbb877419.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/_emerge/Binpkg.py
X-VCS-Directories: lib/_emerge/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 0fddb27ef3fd005d236738b6c696152bbb877419
X-VCS-Branch: master
Date: Sun, 17 Nov 2019 21:04:19 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 9d91463f-03fb-44de-a811-b50ebbaf1ad9
X-Archives-Hash: b412a560a96d8c05e4a80fc479b84d31

commit:     0fddb27ef3fd005d236738b6c696152bbb877419
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 20:52:56 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 21:00:59 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0fddb27e

Binpkg: use cached BINPKGMD5 if available

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/Binpkg.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/_emerge/Binpkg.py b/lib/_emerge/Binpkg.py
index e7dad32fa..542ef8fb0 100644
--- a/lib/_emerge/Binpkg.py
+++ b/lib/_emerge/Binpkg.py
@@ -284,14 +284,14 @@ class Binpkg(CompositeTask):
 				f.close()
 
 		# Store the md5sum in the vdb.
-		f = io.open(_unicode_encode(os.path.join(infloc, 'BINPKGMD5'),
-			encoding=_encodings['fs'], errors='strict'),
-			mode='w', encoding=_encodings['content'], errors='strict')
-		try:
-			f.write(_unicode_decode(
-				str(portage.checksum.perform_md5(pkg_path)) + "\n"))
-		finally:
-			f.close()
+		if pkg_path is not None:
+			md5sum, = self._bintree.dbapi.aux_get(self.pkg.cpv, ['MD5'])
+			if not md5sum:
+				md5sum = portage.checksum.perform_md5(pkg_path)
+			with io.open(_unicode_encode(os.path.join(infloc, 'BINPKGMD5'),
+				encoding=_encodings['fs'], errors='strict'),
+				mode='w', encoding=_encodings['content'], errors='strict') as f:
+				f.write(_unicode_decode('{}\n'.format(md5sum)))
 
 		env_extractor = BinpkgEnvExtractor(background=self.background,
 			scheduler=self.scheduler, settings=self.settings)