From nobody Thu Apr 18 09:16: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+53068+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+53068+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578567362; cv=none; d=zohomail.com; s=zohoarc; b=B9IWhd4+G/ti/YQ95QGyGJXxvMxpvAqk+2z5oBoWBkUR1CYfGzVH5W1VKNDDfsRPXDoiqxAxuk3PyI/mUXDu3S0OEjTOphjivYCYnf2A//DtPZCNOTfdtDdNwFVsleyXSVc07OVVT7g2cnYnR7t2J4Mb8N4TC9fm1gM0gyg3KRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578567362; 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=uSMXlH+r7GdkE2uvLl549WsBU/fsFxLBmbtPHIaYTTA=; b=TjjiTXmeJ26xBkUnhmykpseLIGeLZN6uSBcwTQGwlTtsQTRxBg73/OXogShENyb7XP6Jz+wwN2aF72Ea/iDGavYk77OiGd7DU9l32LCrIf7WMGTlIyhT87s1BjOFVDXzObKlFcdiy5L8RqkPyAe7mgyLD/FCYZVtkF/R55fqdkU= 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+53068+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 1578567362390897.1171560803961; Thu, 9 Jan 2020 02:56:02 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1yI6YY1788612x3OzzFt1Gx1; Thu, 09 Jan 2020 02:56:01 -0800 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.7155.1578567361142158386 for ; Thu, 09 Jan 2020 02:56:01 -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-181-1DNhdpC0OQmJxJIFWIA2zg-1; Thu, 09 Jan 2020 05:55:59 -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 EEA4B10054E3; Thu, 9 Jan 2020 10:55:57 +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 DBDBE60BE0; Thu, 9 Jan 2020 10:55:55 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude Subject: [edk2-devel] [PATCH v4 1/4] BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck Date: Thu, 9 Jan 2020 11:55:43 +0100 Message-Id: <20200109105546.30768-2-philmd@redhat.com> In-Reply-To: <20200109105546.30768-1-philmd@redhat.com> References: <20200109105546.30768-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 1DNhdpC0OQmJxJIFWIA2zg-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: BOD2TZyPY6a4detwSMippe2Vx1787277AA= 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=1578567361; bh=4vwskcNXlbSJdQMTUFLPGBPjfDFpMGlPGLqUbnj/E3w=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=OO0w8zv32mNZa5OvGS+hRnqjE1XomtmJp6HikMs0Xgx0gLKRsYoftbMvUa2TmGAP8Q2 Kty0M/ad6eV968HqpBVXY79Esk9HDVoLAObGIxs8T+XqJganSJjwuMAFnBevxppYEwfNE r49eKKx7vr1x9o+7V6mXAiujSRrRGPoneW0= 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: Bob Feng Cc: Liming Gao 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 (#53068): https://edk2.groups.io/g/devel/message/53068 Mute This Topic: https://groups.io/mt/69576945/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 Apr 18 09:16: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+53069+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+53069+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578567364; cv=none; d=zohomail.com; s=zohoarc; b=MSljJSt+WGt+fQmeFU2/1FD7YvEOpi1fF9Qjb+niaIGwLE9hwLMvf5ST9qz0tIwK74se+dZ9OSPQxs+qmOfkLA6vLqUcYcwXRumIxu4ZetAttPvEV+N1drLYsh/W+QlLKhAUkLYLhKpWEpVpLPFGg00goXU1NNce5jK5pD4Gr6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578567364; 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=aXkrXFxoUfiev5td9m7qUr9j5U57ZZhUZzhrGfOHCPY=; b=nBzbJSwnpl4buQWqc44ffnfT8Z8hzId8JZGsprVorUk2Emi0dUWV2utrhPtNb9e/MXHCjDtqk808v/mdvxipdIU702gBOtH7nt7eflvXrMwk9OAl5EaAakWueCFax+5GSlaV1WQoMhSWDhHGj7jayALDbZv/Bz/nyA8WSj8bePI= 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+53069+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 1578567364909828.1623265748291; Thu, 9 Jan 2020 02:56:04 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id T7ZMYY1788612xAPMyoEy3JT; Thu, 09 Jan 2020 02:56:04 -0800 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.7157.1578567363867562161 for ; Thu, 09 Jan 2020 02:56:04 -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-351-C8okROy7OzybzE-oYVy-6g-1; Thu, 09 Jan 2020 05:56:01 -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 378E8800D48; Thu, 9 Jan 2020 10:56:00 +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 5E15160BE0; Thu, 9 Jan 2020 10:55:58 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude Subject: [edk2-devel] [PATCH v4 2/4] BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked Date: Thu, 9 Jan 2020 11:55:44 +0100 Message-Id: <20200109105546.30768-3-philmd@redhat.com> In-Reply-To: <20200109105546.30768-1-philmd@redhat.com> References: <20200109105546.30768-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: C8okROy7OzybzE-oYVy-6g-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: Ivwtbxy2x4JcAq6GiEoGdU4wx1787277AA= 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=1578567364; bh=8WR1aRg6yhax28SFsa3tEz6J2tRNGl/upg82e7RXU6g=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=bF00TuHqnFjgelnvesG2HAIGRwToR2vnQwm6O+cbdIWr2qgwJ0SObqNdnOiKOn4eFlQ V9Ji81lP4lVhm4XbFtd501tddVDkDbe3BE7aTRZ/SJOQQUar+ryVXHqjVPeiiI1ygWTd3 hHEQt+VuUtXttITd67Se5e3NxLBzCGGY0mw= 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: Bob Feng Cc: Liming Gao 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 (#53069): https://edk2.groups.io/g/devel/message/53069 Mute This Topic: https://groups.io/mt/69576947/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 Apr 18 09:16: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+53071+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+53071+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578567369; cv=none; d=zohomail.com; s=zohoarc; b=KCV+I3yD9+SdrmQb6g7lZ8Q3pRiFrRH1Uy5SFGR4syuTWTm271XdjbNeF3iqcIp9nxtmLR0PWdTvbSPN7Zoc8F/JCHTZ85eab7ukjpYGp05nHwGs152GDJiNZWinOShvgVZvuzW9fcBq8INPzwt9iM3yiKhieWYFo1mfmb6uTUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578567369; 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=8EUhxSTHMGfwt0FLTi1jItJpH11C/WwXiApvef7lBhs=; b=G3E8HHVtZg+juWupyrbWPNyCCgbH5MUm1dTjwHRoVipIEktaETDxslrthg+fYXl4d/04VbVsiEDVEQ+bB8OLtnrRAZstsl/Qz1uTuivgk7Yrfu19BK/7R/nqwWMhMdS4aqHskF93gt5dd3loPw/9vWmy4ab1124g+TQh9iNNXVc= 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+53071+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 1578567369003658.9609185663529; Thu, 9 Jan 2020 02:56:09 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id YViFYY1788612xIXooKV8hno; Thu, 09 Jan 2020 02:56:08 -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.7157.1578567367424498485 for ; Thu, 09 Jan 2020 02:56:07 -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-363-AvJhxUFHMyWwQ0wqYob5EA-1; Thu, 09 Jan 2020 05:56:03 -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 17D8010054E3; Thu, 9 Jan 2020 10:56:02 +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 C701F60BE0; Thu, 9 Jan 2020 10:56:00 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude Subject: [edk2-devel] [PATCH v4 3/4] BaseTools/PatchCheck.py: Check the patch author email address Date: Thu, 9 Jan 2020 11:55:45 +0100 Message-Id: <20200109105546.30768-4-philmd@redhat.com> In-Reply-To: <20200109105546.30768-1-philmd@redhat.com> References: <20200109105546.30768-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: AvJhxUFHMyWwQ0wqYob5EA-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: DIbkuHMlr3nAMNMtYzmw6EDyx1787277AA= 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=1578567368; bh=fS16STQwZSbjCd9hQtxK8XptzxE/8kkbuTCl+QL86iQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=DwU4i5Z9rrMn85XPuJwoOXfZHCIsBAfrlfgwXerfhTdbKfWCetlyS/pXDwBuep/Yzme e6+AsRY9hK762Pd18xP+4J04J4nnKXbnQRVowJYdijka3xlrDRpY3hUWMK3NlP+6bQhVH Fg/dWg4grUeuZKu2rhcLAC7cDce0G9Kqd6s= 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: Bob Feng Cc: Liming Gao 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 (#53071): https://edk2.groups.io/g/devel/message/53071 Mute This Topic: https://groups.io/mt/69576950/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 Apr 18 09:16: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+53070+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+53070+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578567368; cv=none; d=zohomail.com; s=zohoarc; b=n9crKgLUISu1EvXMjIBrRgM48B0Nfx/1WjfCVD4mdttACIgDI14LvLzhRnLKwNshpqi4dtI09TlDW+s7l/2yNJRvMrpFBHKlPuo+K8NoLfOaaKwgC2nFROsszRxX4YaRKWwFAnpUnAiMX623kAOz+rFXwY4e0NNF3Td2WubIUYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578567368; 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=MtwBU3GxLZJ03c6e0aatqyIFsDOlhag2X3qZtUxEisQ=; b=e5NuF1gsSJ51n3nnkSxYWrD3O2JB5YqK+tXHCeDS/R5CCe5nCf5Swt7qopX7xRv+MSNyWqNNB9uJTd9YkFh8fqgekUgRYG/17UbjSYUT7Fcr3VpEvSFdX+eQyCAlKefTm7AFLg+CsCk3ghMU9Nyxio3Xhlss4UlC3F9vIhRz0Vs= 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+53070+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 157856736849766.99763236905414; Thu, 9 Jan 2020 02:56:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id oKpVYY1788612xMRu2ivprma; Thu, 09 Jan 2020 02:56:08 -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.web10.7052.1578567367421275217 for ; Thu, 09 Jan 2020 02:56:07 -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-267-n5CFlZxVN9SBvPOoy5QDlQ-1; Thu, 09 Jan 2020 05:56:05 -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 572E610054E3; Thu, 9 Jan 2020 10:56:04 +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 D4A0460BE0; Thu, 9 Jan 2020 10:56:02 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: Liming Gao , Bob Feng , devel@edk2.groups.io Cc: Philippe Mathieu-Daude Subject: [edk2-devel] [PATCH v4 4/4] BaseTools/PatchCheck.py: Check the committer email address Date: Thu, 9 Jan 2020 11:55:46 +0100 Message-Id: <20200109105546.30768-5-philmd@redhat.com> In-Reply-To: <20200109105546.30768-1-philmd@redhat.com> References: <20200109105546.30768-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: n5CFlZxVN9SBvPOoy5QDlQ-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: NiRJylml09qHAwf7vLyzgqjYx1787277AA= 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=1578567368; bh=bqIrz45KJOc/iR3qVAypZ91eFgYWkl30vHQpS0iAcr8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=N+z8DBBhiARur39mLwDSaLkhawoXYl6zUDsviIrSk/nOkq9IUqdcVP9gf8QrzredX9S QD+2DO2bL+EdNea7HZcgxzNTOJC6lwDnzt+3SO79sBqP1OHagU0LnTGkDYRdwGV+vu0n/ qsJ0ST7dKkD+TYJxETjYHbM7PUKvKycoOdI= 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: Bob Feng Cc: Liming Gao 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 (#53070): https://edk2.groups.io/g/devel/message/53070 Mute This Topic: https://groups.io/mt/69576949/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-