]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/PatchCheck.py: Check the patch author email address
authorPhilippe Mathieu-Daude <philmd@redhat.com>
Thu, 9 Jan 2020 10:55:45 +0000 (18:55 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 10 Jan 2020 04:06:42 +0000 (04:06 +0000)
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

index 58d0112544c99c5221674ebd4511586eb58b7d97..fe8e6a64f2bb209c80fb55fb5d58e8f7c2665529 100755 (executable)
@@ -451,6 +451,9 @@ class CheckOnePatch:
         self.patch = patch\r
         self.find_patch_pieces()\r
 \r
+        email_check = EmailAddressCheck(self.author_email, 'Author')\r
+        email_ok = email_check.ok\r
+\r
         msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg)\r
         msg_ok = msg_check.ok\r
 \r
@@ -459,7 +462,7 @@ class CheckOnePatch:
             diff_check = GitDiffCheck(self.diff)\r
             diff_ok = diff_check.ok\r
 \r
-        self.ok = msg_ok and diff_ok\r
+        self.ok = email_ok and msg_ok and diff_ok\r
 \r
         if Verbose.level == Verbose.ONELINE:\r
             if self.ok:\r
@@ -537,6 +540,8 @@ class CheckOnePatch:
         self.commit_subject = self.commit_subject.replace('\n', '')\r
         self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1)\r
 \r
+        self.author_email = pmail['from']\r
+\r
 class CheckGitCommits:\r
     """Reads patches from git based on the specified git revision range.\r
 \r