From nobody Sun Apr 28 22:32:51 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+52658+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+52658+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577978769; cv=none; d=zohomail.com; s=zohoarc; b=GJtzaxGI1Y5EgPZkUs+2lkPdfgjRO76LYS5cfeN97iuBEsecHJt4bL4tiU6hI1b/YiAhorr9OPV753TX3v2WAkDDVSkN/F8kHUX7oSL4uYRX/nGDRcwdQqTHozXZCIWh/Sf2cABNfleMFPGX48B47Uf61jEJaFWW/3RUE9Vdcho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577978769; 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=wToJE6XD76tuey3P0MVJpQvo5peybkeO0Ed81JKJe9Q=; b=bHvWYBxw7/XfqIk4wV5Lv2t8X/y4mCOoarXTWbZIaSt0Yu/Av/sYB2qHUOivLS1hiDo2Q1JbkMCAHi4nmL7GL7kscXrtfNkZ0SqON21SHlVCFckBjxrsqPokQt8EmSBMhb6nfbfQyM4euJbpX7LQDG6JrQKxPOIwd43PlrBV4p0= 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+52658+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 157797876902762.5889864229996; Thu, 2 Jan 2020 07:26:09 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QEkQYY1788612xsPLnYHPp95; Thu, 02 Jan 2020 07:26:08 -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.web11.12790.1577978767919917393 for ; Thu, 02 Jan 2020 07:26:08 -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-338-a6uyA-PHPSKm28mza4wJNQ-1; Thu, 02 Jan 2020 10:26:03 -0500 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07C008018D7; Thu, 2 Jan 2020 15:26:02 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10FC363BCA; Thu, 2 Jan 2020 15:25:59 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Laszlo Ersek , Michael D Kinney , Philippe Mathieu-Daude , Liming Gao , Jordan Justen Subject: [edk2-devel] [PATCH 1/4] BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck Date: Thu, 2 Jan 2020 16:25:50 +0100 Message-Id: <20200102152553.11976-2-philmd@redhat.com> In-Reply-To: <20200102152553.11976-1-philmd@redhat.com> References: <20200102152553.11976-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: a6uyA-PHPSKm28mza4wJNQ-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: FaGWnmVFeJ8ofxpCq2l54CWwx1787277AA= 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=1577978768; bh=u6jrMrR2CeBE03nEonpXduIYTOJkkVeJ/wYV2VfwSE0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=AZwnciXcwMoSSgeCZ3SmgpcGsmN+mwlJHFjfHTmabJFXr1QwDLxUkGdyS5cJbLuwNwj AcviJgpBdf1URhfu7gDBuwVkSxyhR4bIX6IZSx1gAGYhCWtWzxrUAfRgDAULHD5V5Eh3K W4LY3A+1O0gRUB7XCDyN09tSISRp6j2IRw4= 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 Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 82 +++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 2a4e6f603e79..0e654345fcc8 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -22,6 +22,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 +173,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.0 -=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 (#52658): https://edk2.groups.io/g/devel/message/52658 Mute This Topic: https://groups.io/mt/69381392/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 Sun Apr 28 22:32:51 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+52659+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+52659+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577978770; cv=none; d=zohomail.com; s=zohoarc; b=iF+1c8Za5Ut+GFL7WQ/DvWVR3brJWSXyLsbh9gLATTg4vE9RLxompnlncx/925pcqJONk6u0fGVVEviS4b3GlWZmf4Wb2tA6rraBXbyN6uoRC/JYrqjgzbtDZdQtfKEBmsnnUae/l/cP0x2qr7t1iDIw/JhpkMwL8Q4yRn85b9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577978770; 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=aOpOBNd8pGCUU2qM/u2U+jXaoyR8ufTLuKSEoYZTwQM=; b=h0LTH+QofAS7XSApHsLNc9rhoy6FJtweap+eQhIOHo+2CwhhI3+D3dGKgudO7v7px5XvvYi9iNLCYFD0rMNpOdt1e0CiUvXVFhhsjvX4Fhs6Qef2f15P6R9xGJ2pcrBZCyw6NmBSPqZfFHDTyLuSsfjgKPmJTx2gunKhQ8SZWdY= 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+52659+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 1577978770147540.2021768450028; Thu, 2 Jan 2020 07:26:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id MJCeYY1788612xRzTEtIB82F; Thu, 02 Jan 2020 07:26:09 -0800 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.12672.1577978769088300508 for ; Thu, 02 Jan 2020 07:26:09 -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-48-wj-MHtRSOFerP16bFPNWng-1; Thu, 02 Jan 2020 10:26:05 -0500 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16645107AD24; Thu, 2 Jan 2020 15:26:04 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60CE763BCA; Thu, 2 Jan 2020 15:26:02 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Laszlo Ersek , Michael D Kinney , Philippe Mathieu-Daude , Liming Gao , Jordan Justen Subject: [edk2-devel] [PATCH 2/4] BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked Date: Thu, 2 Jan 2020 16:25:51 +0100 Message-Id: <20200102152553.11976-3-philmd@redhat.com> In-Reply-To: <20200102152553.11976-1-philmd@redhat.com> References: <20200102152553.11976-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: wj-MHtRSOFerP16bFPNWng-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: tiL06q9NDfhWr1xDqog7F4nFx1787277AA= 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=1577978769; bh=8gDy+TIlhhNOA3KaMvmEk0PmAcEEBKlQY3LkuPcqfFU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=indyJ9k3OBDyAUkq2cnBNNCVTgnwnnwZZ72v5QyiWgODtCfI7teziklNtxJuh3zsMnM 7zcvtGWhlrprcaqOBKUc8DLK9cQUVimULjIgvTQx+GyWgu0prSG/PKJXPzkC4YgKDhlD1 uZ++3MrFKrxEvNbzusd90KMgsBnHzUGTqpQ= 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 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 0e654345fcc8..a0ff5ec0038a 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -25,18 +25,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 @@ -173,7 +177,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.0 -=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 (#52659): https://edk2.groups.io/g/devel/message/52659 Mute This Topic: https://groups.io/mt/69381396/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 Sun Apr 28 22:32:51 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+52661+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+52661+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577978774; cv=none; d=zohomail.com; s=zohoarc; b=fmpcGnYBC3YAIaogHIC4uhdHOljRy99OF1VEl/v56I13A3OuSWKnKqLDVIVwTeOqchkZSVEHef2F6JcN3fXCu3mOPiV40asgvn2rS/RZ1guH/rfyvHrsuVZjANvCt3ka4ByBNnO2WmMgK+r7rjWa4BVowVw6qhP2dMPYzTUhJPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577978774; 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=3s/w71eqx1UP11Ny/awfyCzNeaTGe2AhYigrfia5img=; b=V8YmCg5gud/Pp2FVsfi4veEJZGZ0s9Qj3VwxbWaS+4DaykTkxJTAjk+yLQAjQRnMIKPF9gJv2M99TzNnSHP3plc5ZGxzB8zzAuDP/YLpZVAtBEaigClWpSzH0MdELeIPw4udgzlBrw+rZ5E1MmRD0vEZQCQoO7tWUEL0D/E1gNQ= 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+52661+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 1577978774937268.7896656896054; Thu, 2 Jan 2020 07:26:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UM5lYY1788612xbZRciwcpPm; Thu, 02 Jan 2020 07:26:14 -0800 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web09.12832.1577978773694151606 for ; Thu, 02 Jan 2020 07:26:14 -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-130-j6dt8rwgP4WHQI1hKzSxvA-1; Thu, 02 Jan 2020 10:26:07 -0500 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 217B318A6EE5; Thu, 2 Jan 2020 15:26:06 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7342E77E8D; Thu, 2 Jan 2020 15:26:04 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Laszlo Ersek , Michael D Kinney , Philippe Mathieu-Daude , Liming Gao , Jordan Justen Subject: [edk2-devel] [PATCH 3/4] BaseTools/PatchCheck.py: Check the patch author email address Date: Thu, 2 Jan 2020 16:25:52 +0100 Message-Id: <20200102152553.11976-4-philmd@redhat.com> In-Reply-To: <20200102152553.11976-1-philmd@redhat.com> References: <20200102152553.11976-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: j6dt8rwgP4WHQI1hKzSxvA-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: abWzBhHH3b66jHqosDi1lCnVx1787277AA= 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=1577978774; bh=PzGabBakIZIWpFJDQrmqcXLPBanI9kubgHqwTFvDXBI=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=WM+/GoocJ+pryiVxZeWOBpG5+K42bBFClq/uli7M36+0eUQAV7KeGek0Gs2+j9tFqrt RiZMkeLXNgVxLiHzLD/Oo5ddo6x3lz6F0sk4pMD1Wbn6TU0JgGX+LvqFLjKUX7O4d+u0A MaouveGRxfZQagC9t/iGSJLwRJQ49x75hwo= 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 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 a0ff5ec0038a..f0e661bfd6e3 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -450,6 +450,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 @@ -458,7 +461,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: @@ -536,6 +539,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.0 -=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 (#52661): https://edk2.groups.io/g/devel/message/52661 Mute This Topic: https://groups.io/mt/69381402/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 Sun Apr 28 22:32:51 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+52660+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+52660+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577978772; cv=none; d=zohomail.com; s=zohoarc; b=TyH3yttimXJaBa6pJoJcbRnHbEch1l1tKTP4d0EINl5wXcjcnotTSLyK/0yR9SzsB3h91jJkndd7O8NcA74SizZewhMUl95wd+YaAyTJQxmmFsY7ZBBm1DrcQTxTDRLJKtznYrMjaBth94Jn2fL+EUYP9oXdPVOR6+3/o89QbgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577978772; 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=V+ryti1NG+MwyjWvMytLdDrsot8zX86gfm5c021lor8=; b=LODojb5ay710OQyQASZ3Q5bfKvwpDJ0UCZ6KM91WMeWJx1SlfEPwlYM1avUwJWOB6sbaMgMV4CQjuDun/JR5H77DpNNwksQjYWeN0wTArSd+50duoBJMFzbalDY3imI7L95ESH6E/wigt7EQmj4r3R1fkRS9/bYQJTJ2eUJ+Dlw= 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+52660+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 1577978772716855.2416428582698; Thu, 2 Jan 2020 07:26:12 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0EcCYY1788612xdeURr81buc; Thu, 02 Jan 2020 07:26:12 -0800 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web12.12920.1577978771556823763 for ; Thu, 02 Jan 2020 07:26:11 -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-204-N3xZVrFNOSGINt1mw1ealg-1; Thu, 02 Jan 2020 10:26:09 -0500 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E90E18A6EF4; Thu, 2 Jan 2020 15:26:08 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7368577E8D; Thu, 2 Jan 2020 15:26:06 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Laszlo Ersek , Michael D Kinney , Philippe Mathieu-Daude , Liming Gao , Jordan Justen Subject: [edk2-devel] [RFC PATCH 4/4] BaseTools/PatchCheck.py: Check the committer email address Date: Thu, 2 Jan 2020 16:25:53 +0100 Message-Id: <20200102152553.11976-5-philmd@redhat.com> In-Reply-To: <20200102152553.11976-1-philmd@redhat.com> References: <20200102152553.11976-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: N3xZVrFNOSGINt1mw1ealg-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: te6vl6hLag9iZVtbgvO3rpp4x1787277AA= 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=1577978772; bh=iX9X/5w2ZXjOqeB1SexE7J7Ks54xDXdoF41DDnaFOVk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=DmVMoGWRzmCJZsDSdn65l0W0ammJK5ZMVXnHOlROe7U/j8BCVilIX2lh7RRqXn0kRxN 01Gr8Hq56VXppVc92bYtBpaxE7kaFP2NqWWEnsbuGP23VuDCRVVaC+rLiGKAMrCewV5Qa ChP6ZCc/V8DooPrXuYtJqxedtCdY9D7i1dM= 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 Signed-off-by: Philippe Mathieu-Daude --- RFC because I haven't checked --pretty=3D"%cn <%ce>" works on Windows shell. BaseTools/Scripts/PatchCheck.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index f0e661bfd6e3..3baeb3de7ba2 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -560,6 +560,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: @@ -578,6 +580,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.0 -=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 (#52660): https://edk2.groups.io/g/devel/message/52660 Mute This Topic: https://groups.io/mt/69381399/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-