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 10BA5138010 for ; Wed, 17 Oct 2012 02:02:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 61388E0230; Wed, 17 Oct 2012 02:01:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D33C5E0230 for ; Wed, 17 Oct 2012 02:01:51 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0F45233D9C2 for ; Wed, 17 Oct 2012 02:01:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id AFF90E5436 for ; Wed, 17 Oct 2012 02:01:49 +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: <1350439295.8a28c000ce225b79076e36f212162f58e01188b7.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/_parallel_manifest/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/package/ebuild/_parallel_manifest/ManifestTask.py X-VCS-Directories: pym/portage/package/ebuild/_parallel_manifest/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 8a28c000ce225b79076e36f212162f58e01188b7 X-VCS-Branch: master Date: Wed, 17 Oct 2012 02:01:49 +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: 7c8f4491-541e-41ac-8cd9-a3cfc1843949 X-Archives-Hash: f350d6faf95c2ed575883f5dd0a14351 commit: 8a28c000ce225b79076e36f212162f58e01188b7 Author: Zac Medico gentoo org> AuthorDate: Wed Oct 17 02:01:35 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Oct 17 02:01:35 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8a28c000 ManifestTask: improve gpg key parsing This fixes it to correctly parse longer key IDs, which do not fit on the first line of gpg output. Without this fix, failure to parse the key results in manifest being re-signed even though they already have a signature with the correct key. --- .../ebuild/_parallel_manifest/ManifestTask.py | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pym/portage/package/ebuild/_parallel_manifest/ManifestTask.py b/pym/portage/package/ebuild/_parallel_manifest/ManifestTask.py index bfa7bd7..d51400a 100644 --- a/pym/portage/package/ebuild/_parallel_manifest/ManifestTask.py +++ b/pym/portage/package/ebuild/_parallel_manifest/ManifestTask.py @@ -23,6 +23,8 @@ class ManifestTask(CompositeTask): _PGP_HEADER = b"BEGIN PGP SIGNED MESSAGE" _manifest_line_re = re.compile(r'^(%s) ' % "|".join(MANIFEST2_IDENTIFIERS)) + _gpg_key_id_re = re.compile(r'^[0-9A-F]*$') + _gpg_key_id_lengths = (8, 16, 24, 32, 40) def _start(self): self._manifest_path = os.path.join(self.repo_config.location, @@ -70,14 +72,15 @@ class ManifestTask(CompositeTask): @staticmethod def _parse_gpg_key(output): """ - Returns the last token of the first line, or None if there - is no such token. + Returns the first token which appears to represent a gpg key + id, or None if there is no such token. """ - output = output.splitlines() - if output: - output = output[0].split() - if output: - return output[-1] + regex = ManifestTask._gpg_key_id_re + lengths = ManifestTask._gpg_key_id_lengths + for token in output.split(): + m = regex.match(token) + if m is not None and len(m.group(0)) in lengths: + return m.group(0) return None def _check_sig_key_exit(self, proc):