public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Liming Gao <liming.gao@intel.com>,
	Bob Feng <bob.c.feng@intel.com>,
	devel@edk2.groups.io
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
Subject: [PATCH v4 3/4] BaseTools/PatchCheck.py: Check the patch author email address
Date: Thu,  9 Jan 2020 11:55:45 +0100	[thread overview]
Message-ID: <20200109105546.30768-4-philmd@redhat.com> (raw)
In-Reply-To: <20200109105546.30768-1-philmd@redhat.com>

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=Intel/ou=External \
    (FYDIBOHF25SPDLT)/cn=Recipients/cn=fe425ca7e5f4401abed22b904fe5d964

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 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 = patch
         self.find_patch_pieces()
 
+        email_check = EmailAddressCheck(self.author_email, 'Author')
+        email_ok = email_check.ok
+
         msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg)
         msg_ok = msg_check.ok
 
@@ -459,7 +462,7 @@ class CheckOnePatch:
             diff_check = GitDiffCheck(self.diff)
             diff_ok = diff_check.ok
 
-        self.ok = msg_ok and diff_ok
+        self.ok = email_ok and msg_ok and diff_ok
 
         if Verbose.level == Verbose.ONELINE:
             if self.ok:
@@ -537,6 +540,8 @@ class CheckOnePatch:
         self.commit_subject = self.commit_subject.replace('\n', '')
         self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1)
 
+        self.author_email = pmail['from']
+
 class CheckGitCommits:
     """Reads patches from git based on the specified git revision range.
 
-- 
2.21.1


  parent reply	other threads:[~2020-01-09 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 10:55 [PATCH v4 0/4] BaseTools/PatchCheck: Check committer/author email addresses Philippe Mathieu-Daudé
2020-01-09 10:55 ` [PATCH v4 1/4] BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheck Philippe Mathieu-Daudé
2020-01-09 10:55 ` [PATCH v4 2/4] BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checked Philippe Mathieu-Daudé
2020-01-09 10:55 ` Philippe Mathieu-Daudé [this message]
2020-01-09 10:55 ` [PATCH v4 4/4] BaseTools/PatchCheck.py: Check the committer email address Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200109105546.30768-4-philmd@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox