From nobody Thu Mar 28 14:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53061+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53061+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578566973; cv=none; d=zohomail.com; s=zohoarc; b=hJm4eJfClb0YqZjXtbdnJcR5gpKccj7CzEcf1volGFHHMnyeVgCI2Lhu2qk1MwY2y1MIK+kUUf/I2o924Ke+LFBqYqA7lAcbvQOVqOOw5iQ++UN9B6zXIXUMcy37xp9lprgDuEFwqjzqiSmE4nMs2JP6bEmRVjL9frR2m1cACLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578566973; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=PETiNbn+sPIN7HVkWez1GeHLCxqEFU7hZ/aGuBAszHg=; b=IPtX+COCNWvQETwXpd+HwBW7rgZ8sWttB7H/pBuMZ23fau2fQtFC/uYWCG7I2IH+/ek/9x8PiZagAgygDVABb9R7+h0QUQv38IwRti68eOPASL7AthGPRHBEO+shivwsBEMft5imIzJamUX73OTkvqJ3lvDtvDSA/amenq4GYUs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53061+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578566973749551.4069817336972; Thu, 9 Jan 2020 02:49:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id rOsJYY1788612xBhgjct0Nsk; Thu, 09 Jan 2020 02:49:33 -0800 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web11.7110.1578566972430854943 for ; Thu, 09 Jan 2020 02:49:32 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-WE3Db63jMlu2B42lAa10gA-1; Thu, 09 Jan 2020 05:49:30 -0500 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43286DB20; Thu, 9 Jan 2020 10:49:29 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-204-107.brq.redhat.com [10.40.204.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F01FF60E1C; Thu, 9 Jan 2020 10:49:26 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Jordan Justen Subject: [edk2-devel] [PATCH v3 1/4] BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck Date: Thu, 9 Jan 2020 11:49:15 +0100 Message-Id: <20200109104918.29750-2-philmd@redhat.com> In-Reply-To: <20200109104918.29750-1-philmd@redhat.com> References: <20200109104918.29750-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: WE3Db63jMlu2B42lAa10gA-1 X-Mimecast-Spam-Score: 0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,philmd@redhat.com X-Gm-Message-State: 2PhI4gi0F29F7gnOCvQZGavrx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578566973; bh=a2AHbE0LVaHU/ETikSubz+MV2a6blnL8cU1HWElOdmw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=CV0ct5EY2uqjYGJDDkSUS/NkYRTN6UeSixEsJ2KkGuGcbBd8/81ymghayoKjdOvETbB wCohOhn+6bWEOJE+SJ80BtSMecnv1UTVOxYJTSCJBFh0l/5zgBcWTdw50CFM19dwT5Hdu BP2cRq24ads+vtqus2q/MVDflSKODwnRryk= X-ZohoMail-DKIM: pass (identity @groups.io) As we are going to reuse this code out of the CommitMessageCheck class, extract it in a new class: EmailAddressCheck. Cc: Liming Gao Cc: Jordan Justen Reviewed-by: Bob Feng Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 83 +++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 29 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 9668025798da..3b6d77081e7e 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -2,6 +2,7 @@ # Check a patch for various format issues # # Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
+# Copyright (C) 2020, Red Hat, Inc.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -22,6 +23,58 @@ class Verbose: SILENT, ONELINE, NORMAL =3D range(3) level =3D NORMAL =20 +class EmailAddressCheck: + """Checks an email address.""" + + def __init__(self, email): + self.ok =3D True + + if email is None: + self.error('Email address is missing!') + return + + self.check_email_address(email) + + def error(self, *err): + if self.ok and Verbose.level > Verbose.ONELINE: + print('The email address is not valid:') + self.ok =3D False + if Verbose.level < Verbose.NORMAL: + return + count =3D 0 + for line in err: + prefix =3D (' *', ' ')[count > 0] + print(prefix, line) + count +=3D 1 + + email_re1 =3D re.compile(r'(?:\s*)(.*?)(\s*)<(.+)>\s*$', + re.MULTILINE|re.IGNORECASE) + + def check_email_address(self, email): + email =3D email.strip() + mo =3D self.email_re1.match(email) + if mo is None: + self.error("Email format is invalid: " + email.strip()) + return + + name =3D mo.group(1).strip() + if name =3D=3D '': + self.error("Name is not provided with email address: " + + email) + else: + quoted =3D len(name) > 2 and name[0] =3D=3D '"' and name[-1] = =3D=3D '"' + if name.find(',') >=3D 0 and not quoted: + self.error('Add quotes (") around name with a comma: ' + + name) + + if mo.group(2) =3D=3D '': + self.error("There should be a space between the name and " + + "email address: " + email) + + if mo.group(3).find(' ') >=3D 0: + self.error("The email address cannot contain a space: " + + mo.group(3)) + class CommitMessageCheck: """Checks the contents of a git commit message.""" =20 @@ -121,38 +174,10 @@ class CommitMessageCheck: if s[2] !=3D ' ': self.error("There should be a space after '" + sig + ":'") =20 - self.check_email_address(s[3]) + EmailAddressCheck(s[3]) =20 return sigs =20 - email_re1 =3D re.compile(r'(?:\s*)(.*?)(\s*)<(.+)>\s*$', - re.MULTILINE|re.IGNORECASE) - - def check_email_address(self, email): - email =3D email.strip() - mo =3D self.email_re1.match(email) - if mo is None: - self.error("Email format is invalid: " + email.strip()) - return - - name =3D mo.group(1).strip() - if name =3D=3D '': - self.error("Name is not provided with email address: " + - email) - else: - quoted =3D len(name) > 2 and name[0] =3D=3D '"' and name[-1] = =3D=3D '"' - if name.find(',') >=3D 0 and not quoted: - self.error('Add quotes (") around name with a comma: ' + - name) - - if mo.group(2) =3D=3D '': - self.error("There should be a space between the name and " + - "email address: " + email) - - if mo.group(3).find(' ') >=3D 0: - self.error("The email address cannot contain a space: " + - mo.group(3)) - def check_signed_off_by(self): sob=3D'Signed-off-by' if self.msg.find(sob) < 0: --=20 2.21.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53061): https://edk2.groups.io/g/devel/message/53061 Mute This Topic: https://groups.io/mt/69576882/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 14:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53063+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53063+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578566977; cv=none; d=zohomail.com; s=zohoarc; b=EeGfxV596+L9ES6s4jkeHtmU5BDIioo9PK9N9YPWxYb8o++piXqOAiDFM50d3Lc3r5SCvwaSeXGQDGnjJEnLdpTDBnHZHjzft62QhPBtCWi10GXl8FMWBVkT70j4epz9MPMwuDRHToE1gcPDm6QP2rswDfkiVU+RsE2gjmjTMXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578566977; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=KAxS7X+Cq+82Wo7Zv2qSpwq3SlGnBcAeCriXaORGl1U=; b=nTs5mkbplXerlKrD21xf5UlWdll43azbUTA69BhfhtLreExY/s4FeW3QCVZ1tPjX4PqrNU74heyWpyZXB8P4XiCsHXvVvOWDSnVpUaxCCx/6uHvVQ/TFVtMLJeVPPzxIlA1EFEe1j+9rn+EaSwYpUV6CbD15lg4XF/Zg3PKpvug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53063+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578566977714221.25506151897048; Thu, 9 Jan 2020 02:49:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 21sdYY1788612xefYqWiZXL0; Thu, 09 Jan 2020 02:49:37 -0800 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.7015.1578566976695790755 for ; Thu, 09 Jan 2020 02:49:36 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-JXfALxNmOBqADPhUWOqgug-1; Thu, 09 Jan 2020 05:49:34 -0500 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24B8F107ACC5; Thu, 9 Jan 2020 10:49:33 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-204-107.brq.redhat.com [10.40.204.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4E2860BE0; Thu, 9 Jan 2020 10:49:29 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Jordan Justen Subject: [edk2-devel] [PATCH v3 2/4] BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked Date: Thu, 9 Jan 2020 11:49:16 +0100 Message-Id: <20200109104918.29750-3-philmd@redhat.com> In-Reply-To: <20200109104918.29750-1-philmd@redhat.com> References: <20200109104918.29750-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: JXfALxNmOBqADPhUWOqgug-1 X-Mimecast-Spam-Score: 0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,philmd@redhat.com X-Gm-Message-State: 5TBMBUAMvUbvdEBDwHFLJE4Ax1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578566977; bh=Qg4N6e9ouLWZOmeRJvKvFfr+mM1GxxZ70pCZ4F3GXPw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=N4XtfrLOyyeD4fEk6Hqu+lq9P73CbTTJCfIpomV8tdkX84menGtkkemfAazMy202uIR FE+Uxx4d1hNYuA0fHOysij+1dFc8YFK1O6v0kikt+MpKDxLkXJHRDbsRoIkNACyEJRq3H eWwUX0nBifSAfG5G369yVqZHrDRw8yneYVY= X-ZohoMail-DKIM: pass (identity @groups.io) We are checking different emails from the signature list. We are going to check more. To be able to differency, add a description field, so the error reported is clearer. Cc: Liming Gao Cc: Jordan Justen Reviewed-by: Bob Feng Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 3b6d77081e7e..42b923cb927e 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -26,18 +26,22 @@ class Verbose: class EmailAddressCheck: """Checks an email address.""" =20 - def __init__(self, email): + def __init__(self, email, description): self.ok =3D True =20 if email is None: self.error('Email address is missing!') return + if description is None: + self.error('Email description is missing!') + return =20 + self.description =3D "'" + description + "'" self.check_email_address(email) =20 def error(self, *err): if self.ok and Verbose.level > Verbose.ONELINE: - print('The email address is not valid:') + print('The ' + self.description + ' email address is not valid= :') self.ok =3D False if Verbose.level < Verbose.NORMAL: return @@ -174,7 +178,7 @@ class CommitMessageCheck: if s[2] !=3D ' ': self.error("There should be a space after '" + sig + ":'") =20 - EmailAddressCheck(s[3]) + EmailAddressCheck(s[3], sig) =20 return sigs =20 --=20 2.21.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53063): https://edk2.groups.io/g/devel/message/53063 Mute This Topic: https://groups.io/mt/69576885/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 14:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53064+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53064+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578566979; cv=none; d=zohomail.com; s=zohoarc; b=kSKM5PXwUxxZZUFrX6L2GvbU/o+eG66fZ8aBHSnccGQXuxxpOJBElaxk7bGcGefZT9hRgT7qaqwZ7bLVlcTPAb4lq/XI3YBZjVVKT8fKwdeMvBLBchdUfltUfmHH4c/EvbAt3acRKvsJYflxfrs3NTI0ONia7462ruwQNpU4nRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578566979; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=XcyJJU6wHmrec9jWBRgpyzeVnEk+03JNEPcUkB2F1AE=; b=jZITxOkQ2BFcx1gn9OSo/sVCnUprzOzyF2ef757QC7U5RE46L3MnKwRpLs8tciyCCdGIxKovm2ifJmrsSDCrX635IqtPiPCmGiwvppaM+DOUoC6TTEwDmWwBOXqmebyKB3fsmuj+5R79hYP3JGRSFmX3aG41DTzTaPbBgTTDbFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53064+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578566979519467.5205276042543; Thu, 9 Jan 2020 02:49:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id b03zYY1788612xwAbRMk2RUP; Thu, 09 Jan 2020 02:49:39 -0800 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web11.7112.1578566978529192733 for ; Thu, 09 Jan 2020 02:49:38 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-9vQyjekgOta_anOh6SQj-Q-1; Thu, 09 Jan 2020 05:49:36 -0500 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5406A801E6C; Thu, 9 Jan 2020 10:49:35 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-204-107.brq.redhat.com [10.40.204.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C964060BE0; Thu, 9 Jan 2020 10:49:33 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Jordan Justen Subject: [edk2-devel] [PATCH v3 3/4] BaseTools/PatchCheck.py: Check the patch author email address Date: Thu, 9 Jan 2020 11:49:17 +0100 Message-Id: <20200109104918.29750-4-philmd@redhat.com> In-Reply-To: <20200109104918.29750-1-philmd@redhat.com> References: <20200109104918.29750-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 9vQyjekgOta_anOh6SQj-Q-1 X-Mimecast-Spam-Score: 0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,philmd@redhat.com X-Gm-Message-State: 87g7OPrDIjtWcVSyhV0WR9Gjx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578566979; bh=1owiYoVEhZnBr259IiFsWpBUA+a7axNDwnTAIN3YVR4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Gvt9/8p1wwskxuPibC474zUwzYBeZKg9kdyZkNo6rQ+t9+vUhY3ugXE62+/3DD9+/k7 aPYWJzN+165UzMW4KNvQWnjD/rlDN3ajSGxOuawg6KOMDzB2eiu+5oLd+De7Df7dlRNYY mztgMkmUTPtbL7ZA+GiwP4LAmgriiM8cErY= X-ZohoMail-DKIM: pass (identity @groups.io) To avoid patches committed with incorrect email address, use the EmailAddressCheck class on the author email too. Example: $ python BaseTools/Scripts/PatchCheck.py 1a04951309f Checking git commit: 1a04951309f The 'Author' email address is not valid: * The email address cannot contain a space: /o=3DIntel/ou=3DExternal \ (FYDIBOHF25SPDLT)/cn=3DRecipients/cn=3Dfe425ca7e5f4401abed22b904fe5d964 Cc: Liming Gao Cc: Jordan Justen Reviewed-by: Bob Feng Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 42b923cb927e..e7b3c3bae47a 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -451,6 +451,9 @@ class CheckOnePatch: self.patch =3D patch self.find_patch_pieces() =20 + email_check =3D EmailAddressCheck(self.author_email, 'Author') + email_ok =3D email_check.ok + msg_check =3D CommitMessageCheck(self.commit_subject, self.commit_= msg) msg_ok =3D msg_check.ok =20 @@ -459,7 +462,7 @@ class CheckOnePatch: diff_check =3D GitDiffCheck(self.diff) diff_ok =3D diff_check.ok =20 - self.ok =3D msg_ok and diff_ok + self.ok =3D email_ok and msg_ok and diff_ok =20 if Verbose.level =3D=3D Verbose.ONELINE: if self.ok: @@ -537,6 +540,8 @@ class CheckOnePatch: self.commit_subject =3D self.commit_subject.replace('\n', '') self.commit_subject =3D self.subject_prefix_re.sub('', self.commit= _subject, 1) =20 + self.author_email =3D pmail['from'] + class CheckGitCommits: """Reads patches from git based on the specified git revision range. =20 --=20 2.21.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53064): https://edk2.groups.io/g/devel/message/53064 Mute This Topic: https://groups.io/mt/69576886/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 14:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53065+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53065+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578566981; cv=none; d=zohomail.com; s=zohoarc; b=KUJnNHkQZgSJRtdhSFomOMU/aTvpLBS86RIRn6fcACCQyjNx0XxD+m91OLBlT8ZBSBhiv66aK5SYBpAauFPc+rkKhxVM/YwbXKCdXhaXtjRPkoqt2SiCU4pb5vt5RhIUQ/ULFnGfBm2WAT+3YOYtw4vvxkjHIkFb5RHrXgqaQxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578566981; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=JmcaP0JP1GVdKOgAd/bfb3h506+0x7cKtZfQyiD/7zo=; b=gBeslNyJK86a/FcJyUBWAVny02tkSxZfAi+ndxhmiYoPink3Z68NyncCK6/tabmvGE540wgNNWr2pTkdoHcqSW/cw1awdun1X6zB9mV7t8uaPiKq2rsEk+mUGN4ZgO6VdgB+adcnKEYFyzHyNoSvpVnefFcot499y0cCgNFhbYs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53065+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578566981687974.3983690240608; Thu, 9 Jan 2020 02:49:41 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id VAG0YY1788612xldVoX3hXXE; Thu, 09 Jan 2020 02:49:41 -0800 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web11.7114.1578566980668891061 for ; Thu, 09 Jan 2020 02:49:40 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-20-5htOfeFcNqOBY0uvvsbcRg-1; Thu, 09 Jan 2020 05:49:38 -0500 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55F7D477; Thu, 9 Jan 2020 10:49:37 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-204-107.brq.redhat.com [10.40.204.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFDA960BE0; Thu, 9 Jan 2020 10:49:35 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Jordan Justen Subject: [edk2-devel] [PATCH v3 4/4] BaseTools/PatchCheck.py: Check the committer email address Date: Thu, 9 Jan 2020 11:49:18 +0100 Message-Id: <20200109104918.29750-5-philmd@redhat.com> In-Reply-To: <20200109104918.29750-1-philmd@redhat.com> References: <20200109104918.29750-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 5htOfeFcNqOBY0uvvsbcRg-1 X-Mimecast-Spam-Score: 0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,philmd@redhat.com X-Gm-Message-State: Tb2ghAJPIZj2QvhKZR3HcPsnx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578566981; bh=/0Wx5EPlV2Pz66C8+eK/0YP0rOhZxzFlS7ETOjTM/OU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=HWk/I/bDGUd5YpA0MypSMM8wwRzRBop8X8wpLr/l8UcTJzdZewr7/BVBI7+wor6cX/H Z7ZKqxUke5LWxIDvLRM6g68ovy7rzenGttHXFxg/tnWk5Y/ICcWgqZQFdtJNdA2ZLroCr soA8aSvq/2s8sMnnjaqSyEVWL6jHGn/XTnw= X-ZohoMail-DKIM: pass (identity @groups.io) To avoid patches committed with incorrect email address, use the EmailAddressCheck class on the committer email too. Cc: Liming Gao Cc: Jordan Justen Reviewed-by: Bob Feng Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index e7b3c3bae47a..fe8e6a64f2bb 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -561,6 +561,8 @@ class CheckGitCommits: else: blank_line =3D True print('Checking git commit:', commit) + email =3D self.read_committer_email_address_from_git(commit) + self.ok &=3D EmailAddressCheck(email, 'Committer').ok patch =3D self.read_patch_from_git(commit) self.ok &=3D CheckOnePatch(commit, patch).ok if not commits: @@ -579,6 +581,10 @@ class CheckGitCommits: # Run git to get the commit patch return self.run_git('show', '--pretty=3Demail', '--no-textconv', c= ommit) =20 + def read_committer_email_address_from_git(self, commit): + # Run git to get the committer email + return self.run_git('show', '--pretty=3D%cn <%ce>', '--no-patch', = commit) + def run_git(self, *args): cmd =3D [ 'git' ] cmd +=3D args --=20 2.21.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53065): https://edk2.groups.io/g/devel/message/53065 Mute This Topic: https://groups.io/mt/69576887/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-