[edk2-devel] [PATCH v6 02/12] BaseTools/PatchCheck.py: Add PCCTS to tab exemption list

Michael Kubacki posted 12 patches 1 year, 6 months ago
There is a newer version of this series
[edk2-devel] [PATCH v6 02/12] BaseTools/PatchCheck.py: Add PCCTS to tab exemption list
Posted by Michael Kubacki 1 year, 6 months ago
From: Michael Kubacki <michael.kubacki@microsoft.com>

Purdue Compiler Construction Tool Set (PCCTS) source code was copied/
pasted into BaseTools/Source/C/VfrCompile/Pccts/.

The code contains tab characters instead of spaces.

PatchCheck.py gives an error on modifications to files that
contain tabs.

This change adds that directory to the pre-existing list of
directories in which tab checks are ignored in PatchCheck.py.

The goal of my upcoming change there is not to mix tabs and spaces
but to fix a bug while preserving its current formatting characters.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 BaseTools/Scripts/PatchCheck.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index fcdabfc8acea..84d56b8c8b70 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -383,7 +383,9 @@ class GitDiffCheck:
                     self.force_crlf = False
                     self.force_notabs = False
                 if os.path.basename(self.filename) == 'GNUmakefile' or \
-                   os.path.basename(self.filename) == 'Makefile':
+                   os.path.basename(self.filename) == 'Makefile' or \
+                   self.filename.startswith(
+                        'BaseTools/Source/C/VfrCompile/Pccts/'):
                     self.force_notabs = False
             elif len(line.rstrip()) != 0:
                 self.format_error("didn't find diff command")
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101826): https://edk2.groups.io/g/devel/message/101826
Mute This Topic: https://groups.io/mt/97832892/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v6 02/12] BaseTools/PatchCheck.py: Add PCCTS to tab exemption list
Posted by Rebecca Cran 1 year, 6 months ago
I sent out a patch to fix this same issue earlier today!

I took a slightly different approach: see "[edk2-devel] [PATCH v2 1/1] 
BaseTools/Scripts/PatchCheck.py: Improve check for Makefiles"


diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index fcdabfc8acea..241467f10ea5 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -383,7 +383,8 @@ class GitDiffCheck:
                      self.force_crlf = False
                      self.force_notabs = False
                  if os.path.basename(self.filename) == 'GNUmakefile' or \
-                   os.path.basename(self.filename) == 'Makefile':
+                   os.path.basename(self.filename).lower() == 'makefile' or \
+                   os.path.splitext(self.filename)[1] == ".makefile":
                      self.force_notabs = False
              elif len(line.rstrip()) != 0:
                  self.format_error("didn't find diff command")


On 3/24/23 2:48 PM, Michael Kubacki wrote:
> From: Michael Kubacki <michael.kubacki@microsoft.com>
>
> Purdue Compiler Construction Tool Set (PCCTS) source code was copied/
> pasted into BaseTools/Source/C/VfrCompile/Pccts/.
>
> The code contains tab characters instead of spaces.
>
> PatchCheck.py gives an error on modifications to files that
> contain tabs.
>
> This change adds that directory to the pre-existing list of
> directories in which tab checks are ignored in PatchCheck.py.
>
> The goal of my upcoming change there is not to mix tabs and spaces
> but to fix a bug while preserving its current formatting characters.
>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>   BaseTools/Scripts/PatchCheck.py | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
> index fcdabfc8acea..84d56b8c8b70 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -383,7 +383,9 @@ class GitDiffCheck:
>                       self.force_crlf = False
>                       self.force_notabs = False
>                   if os.path.basename(self.filename) == 'GNUmakefile' or \
> -                   os.path.basename(self.filename) == 'Makefile':
> +                   os.path.basename(self.filename) == 'Makefile' or \
> +                   self.filename.startswith(
> +                        'BaseTools/Source/C/VfrCompile/Pccts/'):
>                       self.force_notabs = False
>               elif len(line.rstrip()) != 0:
>                   self.format_error("didn't find diff command")


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101837): https://edk2.groups.io/g/devel/message/101837
Mute This Topic: https://groups.io/mt/97832892/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-