From nobody Mon Apr 29 22:48:39 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+51787+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+51787+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575562378; cv=none; d=zohomail.com; s=zohoarc; b=TLs4XfqsZLjLfUKTzMbZovj3/dlAwzHB5LaimI1/1UMUOuaTX2WN09okNvtpKflsSFMuS3iuJEIURmmithRbqXn28nIdLjK9Trl/JRxI27PbSdEFpmYSFuJqYKSKIuh30ZwKXWx33mwqabUPCIQoAC9WaJC5NuMCDv/ix3BKgc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575562378; 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=8YYxEDARza8JcHeqT/vvBKE9iV3qz0r91bdwp5igAqg=; b=UEwt2Dhveqy35YlU7I9UE7izUuBpgSZAE7MFExIPkhRiqtBcMimqnZdyYMYe3tlC+x/BN8ebSGIiQEtEWLJWTC4H5YyjQwEWzl/tFSrMGJBnw76ZCh8ZJ0wYHqu41fb+64LjWi7m++78+QANMLCW/2OPZ7j3cg1QyIFw0nZptqQ= 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+51787+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 1575562378024622.1406068821323; Thu, 5 Dec 2019 08:12:58 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 05 Dec 2019 08:12:57 -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.11648.1575562369134883463 for ; Thu, 05 Dec 2019 08:12:49 -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-340-XoY1sQVzM5On1ceexTJoJA-1; Thu, 05 Dec 2019 11:12:44 -0500 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62B8F801FA0; Thu, 5 Dec 2019 16:12:43 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6145A10016E8; Thu, 5 Dec 2019 16:12:41 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao , Laszlo Ersek , Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [PATCH 1/6] BaseTools/PatchCheck: Stop parsing commit message after --- separator Date: Thu, 5 Dec 2019 17:12:29 +0100 Message-Id: <20191205161234.25071-2-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: XoY1sQVzM5On1ceexTJoJA-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: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= 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=1575562377; bh=+gV737DU5216gBPG97ilurFTDSSmLvnv5XDJNu+7vHM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=JTGt7Jtn+pxuItIOswypclKCNMRYNK6M+PSgXtpXqjK16B1cQlSe2zrsYKURUi4eiR9 CGJZkh97ia7WiChyeBvEEM01QmX66pfopHQW8N5xsI1FusNFl1opv/Uq3cRdTvHkLRYPz cLve1PHDiE0oTuuwIHtjK0ZNSE0OOZsUb1I= X-ZohoMail-DKIM: pass (identity @groups.io) git-format-patch uses the '---' separator to mark the end of the commit message. Anything after the separator is stripped by git-am, it is pointless to check this part. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude Reviewed-by: Laszlo Ersek --- Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Leif Lindholm --- BaseTools/Scripts/PatchCheck.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 2a4e6f603e79..8bcf857a7d15 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -209,6 +209,10 @@ class CommitMessageCheck: 'empty.') =20 for i in range(2, count): + if lines[i].strip() =3D=3D '---': + # '---' marks the end of the commit message. + count =3D i + break if (len(lines[i]) >=3D 76 and len(lines[i].split()) > 1 and not lines[i].startswith('git-svn-id:')): --=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 (#51787): https://edk2.groups.io/g/devel/message/51787 Mute This Topic: https://groups.io/mt/67003936/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 Mon Apr 29 22:48:39 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+51788+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+51788+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575562386; cv=none; d=zohomail.com; s=zohoarc; b=jTOQpL8YJ+7DnWqaTi+6j61BzkBsBrKyLLmKr7D+rz2W3NbnrdgDPgu21FU4Zuwng84z5NHIWN7o+gh2R1Mx8n4EhI9KvphQHPutTGcC/hFZDFTngLnqMn9JWx+8OKf7Zl3BOrbjL1s8l5Ys1qIIPla6P9LVF+/5QtS7mjHbzco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575562386; 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=/Ev1WEeKDDzIuit8rRft9MLKq048+UJ8/CtZw4A8Uwc=; b=JO+yVuMDT8Orar5Qfxvk+wDT0bhTrq6oVd7jeB53Z2D+kWC8hNeRkEInPzwkxnSDBVsfvoK22ZnTLxZAWO61alHgzZuAtm+NG0cXRrQbCP2W85l9L3ws1iyH47+flU2tiufoTg2u1+JhGcUIAOvIYBgC07kG4T3waSdMFbZ38BE= 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+51788+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 1575562386667883.6030373631048; Thu, 5 Dec 2019 08:13:06 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 05 Dec 2019 08:13:05 -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.11649.1575562371924017229 for ; Thu, 05 Dec 2019 08:12:52 -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-244-IetbzDLsPeOl-T5QkLAOVg-1; Thu, 05 Dec 2019 11:12:46 -0500 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DA08801FA0; Thu, 5 Dec 2019 16:12:45 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C41FE1001B28; Thu, 5 Dec 2019 16:12:43 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH 2/6] BaseTools/PatchCheck: Add a --quiet option Date: Thu, 5 Dec 2019 17:12:30 +0100 Message-Id: <20191205161234.25071-3-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: IetbzDLsPeOl-T5QkLAOVg-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: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= 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=1575562385; bh=sfNmowTg3Rx0WgAvYP9aHavvG6eKcl5bSMtEwzrkcRA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=M2DGcFORPnN0jaKPIWFPwK6vXkdLvKmSSzELF4rCSaNuiRFZT5j0xKt287bpSLLHDoe rztzZfeypC++Mc3SgTUAcJX+3rjmfKRPkovsKEwvA+ygsmQRo2PLQm0UmE/X1T1oUgLMn uxo9taESMyWmfZoqOpeZw224tYmZO/UmScg= X-ZohoMail-DKIM: pass (identity @groups.io) Add a --quiet option to only display warnings. This will be useful when this script is called embedded. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 8bcf857a7d15..f907e96b9501 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -19,7 +19,7 @@ import subprocess import sys =20 class Verbose: - SILENT, ONELINE, NORMAL =3D range(3) + SILENT, QUIET, ONELINE, NORMAL =3D range(4) level =3D NORMAL =20 class CommitMessageCheck: @@ -56,10 +56,10 @@ class CommitMessageCheck: print(self.url) =20 def error(self, *err): - if self.ok and Verbose.level > Verbose.ONELINE: + if self.ok and Verbose.level >=3D Verbose.QUIET: print('The commit message format is not valid:') self.ok =3D False - if Verbose.level < Verbose.NORMAL: + if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: @@ -404,10 +404,10 @@ class GitDiffCheck: self.error(err, err2) =20 def error(self, *err): - if self.ok and Verbose.level > Verbose.ONELINE: + if self.ok and Verbose.level >=3D Verbose.QUIET: print('Code format is not valid:') self.ok =3D False - if Verbose.level < Verbose.NORMAL: + if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: @@ -530,7 +530,8 @@ class CheckGitCommits: print() else: blank_line =3D True - print('Checking git commit:', commit) + if Verbose.level > Verbose.QUIET: + print('Checking git commit:', commit) patch =3D self.read_patch_from_git(commit) self.ok &=3D CheckOnePatch(commit, patch).ok if not commits: @@ -634,12 +635,17 @@ class PatchCheckApp: group.add_argument("--oneline", action=3D"store_true", help=3D"Print one result per line") + group.add_argument("--quiet", + action=3D"store_true", + help=3D"Only print warnings and errors") group.add_argument("--silent", action=3D"store_true", help=3D"Print nothing") self.args =3D parser.parse_args() if self.args.oneline: Verbose.level =3D Verbose.ONELINE + if self.args.quiet: + Verbose.level =3D Verbose.QUIET if self.args.silent: Verbose.level =3D Verbose.SILENT =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 (#51788): https://edk2.groups.io/g/devel/message/51788 Mute This Topic: https://groups.io/mt/67003983/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 Mon Apr 29 22:48:39 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+51789+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+51789+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575562388; cv=none; d=zohomail.com; s=zohoarc; b=EcHeJcmlUHOzuLTmmghjz7AogBcRHRXHQEtWChTOQVlN92lO0RB0tLBBAD3fE+30+J1O7zReN2UlL5Bi8q270g8NgQtUtVywkUx2Cck28O38Scsj/9+jan35KXYwI4CZfaacqa75yvxCP7UX4GvVFeMZ7bpvBPq0mCS32SDtlbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575562388; 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=hGdCMD0orYXgosYELhxdNO+bFheoXHB4KlRRT8PavwE=; b=J/FqAEWtsYnK4Uo4xmQd1L1fEUbmHqx6bIqmI2/See1MHiR+2nq1uG47XOCy4ybD4CtX581KTUpxMhCMuD92EDDcN8AVWMaFkTzzImGPObjoePyHTPFrd2D9h+Jr2HhHrxUSEjUiUW8b6OYnZ2NGc3eGn/3r/FdqNTFYcKTAwpc= 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+51789+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 1575562388167832.8962697329482; Thu, 5 Dec 2019 08:13:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 05 Dec 2019 08:13:07 -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.web12.11650.1575562374646797441 for ; Thu, 05 Dec 2019 08:12:54 -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-362-pWhh5QBNMP2O-7j4bI1DRw-1; Thu, 05 Dec 2019 11:12:49 -0500 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0C9112D6581; Thu, 5 Dec 2019 16:12:48 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E366110013D9; Thu, 5 Dec 2019 16:12:45 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao , Laszlo Ersek , Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [PATCH 3/6] BaseTools/Scripts: Add GitPostCommitHook.py Date: Thu, 5 Dec 2019 17:12:31 +0100 Message-Id: <20191205161234.25071-4-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: pWhh5QBNMP2O-7j4bI1DRw-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: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= 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=1575562387; bh=hWqLpkCN5qxX+iJYvqiDyC1qgkiyPtOZPnS7/brCVjg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=O0CUIVyxeMoM+DBjVMmJLYYVxL8MQFS1WAajt1pBjxMXjC4GUZC5B3AaHNeW2YC6IOv Vx41M3z8l9GHhI+E1vz/gHRoXD+DZfw+UI7+9/MEkvpxi1o6clKxCFUrCFJCCmqqHCJBZ WTvpTXwtk8ksK3+MM4GH4GZKQnbNpxWndCs= X-ZohoMail-DKIM: pass (identity @groups.io) Git allows the use of various hooks (see [*]). In particular it provides the 'post-commit' hook, which is a convenient place to run the PatchCheck script. [*] https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- I'm hitting a egg/chicken problem here. If I add this script without CRLF, PatchCheck complains: Code format is not valid: * Line ending ('\n') is not CRLF File: BaseTools/Scripts/GitPostCommitHook.py Line: #!/usr/bin/python However if I convert it to CRLF, then Linux does not recognize the shebang, and if I symlink the script, when the hook is executed I get: fatal: cannot run .git/hooks/post-commit: No such file or directory Because the interpreter expects the shebang line with Unix line ending (linefeed only). As a kludge I'm happy using: $ echo > .git/hooks/post-commit #!/bin/sh test -e BaseTools/Scripts/GitPostCommitHook.py && exec python3 BaseTools/= Scripts/GitPostCommitHook.py EOF $ chmod +x .git/hooks/post-commit (The 'test' allow to checkout to older references where the script is not available). Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Leif Lindholm --- BaseTools/Scripts/GitPostCommitHook.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 BaseTools/Scripts/GitPostCommitHook.py diff --git a/BaseTools/Scripts/GitPostCommitHook.py b/BaseTools/Scripts/Git= PostCommitHook.py new file mode 100755 index 000000000000..4ea933a7eedf --- /dev/null +++ b/BaseTools/Scripts/GitPostCommitHook.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +## @file +# Run PatchCheck on the last commit. +# +# Copyright (c) 2019, Red Hat, Inc. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# To have git run this script after each commit, create a symbolic +# link or copy it to .git/hooks/post-commit in your EDK2 repository. + +import os +import sys + +if __name__ =3D=3D '__main__': + sys.path.append(os.path.join(os.environ['EDK_TOOLS_PATH'], 'Scripts')) + from PatchCheck import CheckGitCommits, Verbose + Verbose.level =3D Verbose.QUIET + GIT_REFERENCE =3D 'HEAD' + COMMIT_COUNT =3D 1 + sys.exit(CheckGitCommits(GIT_REFERENCE, COMMIT_COUNT).ok) --=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 (#51789): https://edk2.groups.io/g/devel/message/51789 Mute This Topic: https://groups.io/mt/67004028/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 Mon Apr 29 22:48:39 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+51792+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+51792+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575562447; cv=none; d=zohomail.com; s=zohoarc; b=D/MXT3swV3giVU2rYvkUnW/MQW36aY4EORu9Ox+NjVZCmgvGVSc4ngD8yJb38iyZTC1ZY3Y+wjBU1rvBVg6rXAJbMLMXbQuDFVoEFn//3FFNUwrowfddecl1jP+6jYh4pufCnSdQIOkEDt2kNJ+dty1bzjPXhRkgeS3fPwA0kzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575562447; 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=RFaxi2Wa+lhedp6Gop9A2G0tbrGSSNUr38kejk4VajM=; b=Jx67SDhCQUu8PRRWxI7c/h4uJRsJoF7GyoApooH4/3GOAPCK61BVQ8mLVwtnoKYLL0cveFQe0IrJtjsDRujHCVBkzU7koMtIMTXnfQnfpZgovxlhMj80TTOZJ8Qo0NbhchxrG+T3j4UZwRO5vrGZ8llexjvcgrcRbbyhMTxVX2E= 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+51792+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 1575562447232356.83177102747436; Thu, 5 Dec 2019 08:14:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 05 Dec 2019 08:14:06 -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.web09.11712.1575562445942601429 for ; Thu, 05 Dec 2019 08:14:06 -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-44-fjIOJZ-iNGufPHHZOzMtnA-1; Thu, 05 Dec 2019 11:12:51 -0500 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB58E107B278; Thu, 5 Dec 2019 16:12:50 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C39410013D9; Thu, 5 Dec 2019 16:12:49 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH 4/6] BaseTools/PatchCheck: Extract the run_git() function Date: Thu, 5 Dec 2019 17:12:32 +0100 Message-Id: <20191205161234.25071-5-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: fjIOJZ-iNGufPHHZOzMtnA-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: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= 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=1575562446; bh=Gq8BFYKrHZ7zHmFaH3XQbxIkSgo+6H3YMYKymy2CP3g=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=N2wihg5vxutqjOJubTNvJbozzMbhQiwfQXl3156JqQXM0EtOc8hd7g5XXypSxbc4r1E Y2QGaNlAwefgg393eelspn13CtmawLCQC+g3nlKeQ0XBYiXhKYeGLsm/2ATWSLPTuQlsy bU3Q9c+CJcUqLaNkYUU9Eq0JFp7Lmog1PVI= X-ZohoMail-DKIM: pass (identity @groups.io) Extract run_git() from the CheckGitCommits class, so we can reuse it from other places. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index f907e96b9501..fc1b077f3c64 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -18,6 +18,16 @@ import re import subprocess import sys =20 +def run_git(*args): + """Run git in a subprocess, return the command output.""" + cmd =3D [ 'git' ] + cmd +=3D args + p =3D subprocess.Popen(cmd, + stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.STDOUT) + Result =3D p.communicate() + return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].= find(b"fatal") !=3D0 else None + class Verbose: SILENT, QUIET, ONELINE, NORMAL =3D range(4) level =3D NORMAL @@ -543,21 +553,12 @@ class CheckGitCommits: if max_count is not None: cmd.append('--max-count=3D' + str(max_count)) cmd.append(rev_spec) - out =3D self.run_git(*cmd) + out =3D run_git(*cmd) return out.split() if out else [] =20 def read_patch_from_git(self, commit): # Run git to get the commit patch - return self.run_git('show', '--pretty=3Demail', '--no-textconv', c= ommit) - - def run_git(self, *args): - cmd =3D [ 'git' ] - cmd +=3D args - p =3D subprocess.Popen(cmd, - stdout=3Dsubprocess.PIPE, - stderr=3Dsubprocess.STDOUT) - Result =3D p.communicate() - return Result[0].decode('utf-8', 'ignore') if Result[0] and Result= [0].find(b"fatal")!=3D0 else None + return run_git('show', '--pretty=3Demail', '--no-textconv', commit) =20 class CheckOnePatchFile: """Performs a patch check for a single file. --=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 (#51792): https://edk2.groups.io/g/devel/message/51792 Mute This Topic: https://groups.io/mt/67005111/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 Mon Apr 29 22:48:39 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+51790+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+51790+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575562392; cv=none; d=zohomail.com; s=zohoarc; b=U32HE5f3NhnBI6qOcR0LeH6wU8YG58JNMF9pQBD1xYkIOfq8YP4gMykuSBzywF4CWGxAQv0UPOEeEPnbyC8mOni6yX6EPnsWs7N4x+mfebopkK1S6G4vu3cA2JMSByC++ZMFXtK0ueujPbyY23TN7ZHLlE5c2sIrIJibwLaTwME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575562392; 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=oOaouMLsM8dWiGQ9UPPJp3X9EJIPqRe4nsJpgNPbSs4=; b=ePfGPkbV3KjaEs4mH35jm7pz6NeuxuFn3XBmeQlFJsmLfcqa0LeT6BJ7gaheK8O18Cq2FJcrJRCJVw0NexxRk0jBWj0whCl4OhGX/MZUo/0uEJacAoH6cmAy+CAkVWrGXc9L7MOl0phaoqYdMHt1cfkyYo+CwvwZSMOpB31zlOA= 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+51790+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 1575562392670831.4715454932793; Thu, 5 Dec 2019 08:13:12 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 05 Dec 2019 08:13:12 -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.11720.1575562378138535946 for ; Thu, 05 Dec 2019 08:12:58 -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-438-DML6iHKWOrWahEQnvCNs_A-1; Thu, 05 Dec 2019 11:12:53 -0500 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEFCA18B5F8A; Thu, 5 Dec 2019 16:12:52 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5655F10013D9; Thu, 5 Dec 2019 16:12:51 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH 5/6] BaseTools/PatchCheck: Add printw() function to print warnings Date: Thu, 5 Dec 2019 17:12:33 +0100 Message-Id: <20191205161234.25071-6-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: DML6iHKWOrWahEQnvCNs_A-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: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= 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=1575562392; bh=AwAkxnMPc93S/XCymHSyVNuZvf54RPVOz8KWacLlsbs=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=B/j9LBSFOr1TrYvrWUC9XMtnTPJgWWM9RhYpnb3rukHhjcFzLel7yWDnf575lRTtUJb 8fvbnj1pSuQx+c5k/jxUrKJPK50ai2zPcAwLdG+beGd/ZdLkOaBu6djdd4TiDpY89fLPX Z6jGIbsy1zD5Dc0xxn5+16dVkvn1WRsCrhI= X-ZohoMail-DKIM: pass (identity @groups.io) Introduce printw() to print warnings. For now there are no logical change, we only call print(). Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index fc1b077f3c64..5692f6eaf8bd 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -28,6 +28,10 @@ def run_git(*args): Result =3D p.communicate() return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].= find(b"fatal") !=3D0 else None =20 +def printw(line): + """Print a warning to the console.""" + print(line) + class Verbose: SILENT, QUIET, ONELINE, NORMAL =3D range(4) level =3D NORMAL @@ -67,14 +71,14 @@ class CommitMessageCheck: =20 def error(self, *err): if self.ok and Verbose.level >=3D Verbose.QUIET: - print('The commit message format is not valid:') + printw('The commit message format is not valid:') self.ok =3D False if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: prefix =3D (' *', ' ')[count > 0] - print(prefix, line) + printw("{}{}".format(prefix, line)) count +=3D 1 =20 # Find 'contributed-under:' at the start of a line ignoring case and @@ -415,14 +419,14 @@ class GitDiffCheck: =20 def error(self, *err): if self.ok and Verbose.level >=3D Verbose.QUIET: - print('Code format is not valid:') + printw('Code format is not valid:') self.ok =3D False if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: prefix =3D (' *', ' ')[count > 0] - print(prefix, line) + printw("{}{}".format(prefix, line)) count +=3D 1 =20 class CheckOnePatch: --=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 (#51790): https://edk2.groups.io/g/devel/message/51790 Mute This Topic: https://groups.io/mt/67004076/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 Mon Apr 29 22:48:39 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+51791+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+51791+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575562395; cv=none; d=zohomail.com; s=zohoarc; b=Zx9JXqfshNkw55dSsIM+giqj+D5K7G3u5T/n4ajyrlSj7AunDmWFxD1Jwv0tUxiUBWYhZ9S08yHAY15EptckZ+eFs5DocIs+Usmkl4AuWtlGk2y7oXWfg4ZC5UtL2q3PEMlIz8i5xIRdb+1kiaOc/0EAH6QDIfnF9CRU/gYv22U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575562395; 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=rqZ7bswg5HPQTx41tWfTqbpON/hMALCu4SwrAXOuEy4=; b=BCj4wpLi4WLXtkFyN+n7q+Guyd+/BertTtQhAiL+c2omSt+EbQHj+Bq1npV2mpvWwFlBG+mOd3XHntjBWwHFt0x4hxRPJjnrX1VprfH04430QplckdJcowW+cYLkiuJPyCzZ7zLiizqwxZme6B/8LTX4+Fm6prPyD6K5zVVUyWY= 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+51791+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 1575562395211804.3796660354488; Thu, 5 Dec 2019 08:13:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 05 Dec 2019 08:13:14 -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.11654.1575562380387106129 for ; Thu, 05 Dec 2019 08:13:00 -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-321-UetMGdkdOaiEjzAlvj79xA-1; Thu, 05 Dec 2019 11:12:56 -0500 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86D89DBE7; Thu, 5 Dec 2019 16:12:54 +0000 (UTC) X-Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C4A110013D9; Thu, 5 Dec 2019 16:12:53 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH 6/6] BaseTools/PatchCheck: Allow to print colored warnings Date: Thu, 5 Dec 2019 17:12:34 +0100 Message-Id: <20191205161234.25071-7-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: UetMGdkdOaiEjzAlvj79xA-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: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= 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=1575562394; bh=E3/3QMAlMoAf6ni0wupFd7OzQKsKbDkHY/NaWwvcIbA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=mOwO8LWYFoX41izKORpQ2fZKg0e3piL0n8RnjgOx6aC3T3bNh68NBx3c/NJzyZr/5Yc /f93aKuirxoiPlwdF1UTfm4DUD52gJlnB+BWjA/n+xjSZdpmnoi/ZQ1Rw3dV0B+SrYMRo CRC2JnSZUWBI2uf34DU0lEs9E7kvtVhDHE0= X-ZohoMail-DKIM: pass (identity @groups.io) If the user has the termcolor package installed, and he configured a 'color.checkpatch.error' color, use it to display colored warnings. Example to display warnings in red: $ git config color.checkpatch.error red Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 5692f6eaf8bd..8e37311bd69a 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -32,6 +32,19 @@ def printw(line): """Print a warning to the console.""" print(line) =20 +if run_git('config', 'color.ui') !=3D 'false': + # If the user configure git color.checkpatch.error and the termcolor p= ackage + # is available, display warnings using the requested color. + warning_color =3D run_git('config', 'color.checkpatch.error') + if warning_color: + try: + from termcolor import colored, cprint + _ =3D colored("check we can parse the color", warning_color.st= rip()) + def printw(line): + cprint(line, color=3Dwarning_color.strip(), attrs=3D['bold= ']) + except: + pass + class Verbose: SILENT, QUIET, ONELINE, NORMAL =3D range(4) level =3D NORMAL --=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 (#51791): https://edk2.groups.io/g/devel/message/51791 Mute This Topic: https://groups.io/mt/67004111/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-