[edk2-devel] [PATCH v5 1/5] BaseTools: PatchCheck: Exclude bash scripts from CRLF check

PierreGondois posted 5 patches 5 years, 7 months ago
[edk2-devel] [PATCH v5 1/5] BaseTools: PatchCheck: Exclude bash scripts from CRLF check
Posted by PierreGondois 5 years, 7 months ago
From: Pierre Gondois <pierre.gondois@arm.com>

Bash scripts require LF line endings to work.
PatchCheck.py checks that the files added in a patch have CRLF
line endings. It excludes files ending with the ".sh" extension
from this check.

Some bash script don't have a ".sh" extension. Most of them are
located in:
 - BaseTools/BinWrappers/PosixLike/
 - BaseTools/Bin/CYGWIN_NT-5.1-i686/

This patch excludes these folder plus BaseTools/BuildEnv from
this CRLF check.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---

The changes can be seen at: https://github.com/PierreARM/edk2/commits/803_Compile_AML_bytecode_array_into_OBJ_file_v5

Notes:
    v5:
     - Exclude some directories/files having LF line
       endings from the PatchCheck,py script. [Bob]

 BaseTools/Scripts/PatchCheck.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 106b434c750d71d8aa1658109f146dc066633c2c..e38cf61f93da50f77d4e1e2e37de5f6a08d25408 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -3,6 +3,7 @@
 #
 #  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
 #  Copyright (C) 2020, Red Hat, Inc.<BR>
+#  Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -384,9 +385,14 @@ class GitDiffCheck:
                 self.is_newfile = False
                 self.force_crlf = True
                 self.force_notabs = True
-                if self.filename.endswith('.sh'):
+                if self.filename.endswith('.sh') or \
+                    self.filename.startswith('BaseTools/BinWrappers/PosixLike/') or \
+                    self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-i686/') or \
+                    self.filename == 'BaseTools/BuildEnv':
                     #
                     # Do not enforce CR/LF line endings for linux shell scripts.
+                    # Some linux shell scripts don't end with the ".sh" extension,
+                    # they are identified by their path.
                     #
                     self.force_crlf = False
                 if self.filename == '.gitmodules':
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'

�.�Ȩ.)䱊.������Y��Ơz���h����.�X���^�\��X�{�}�hm��?��d�
躛"��?u�ޗ���Ơ{���]��ד�+�����i��஋��*?����m�Ӎ?׿;۾Ʈ��;	ޭׯz_��w�y�6��.�ȨR{.n�+�����l����h+��l����ׯz_�˛�jh�׫��\��(�
Re: [edk2-devel] [PATCH v5 1/5] BaseTools: PatchCheck: Exclude bash scripts from CRLF check
Posted by Bob Feng 5 years, 7 months ago
Reviewed-by: Bob Feng<bob.c.feng@intel.com>


-----Original Message-----
From: PierreGondois <pierre.gondois@arm.com> 
Sent: Wednesday, July 1, 2020 10:06 PM
To: devel@edk2.groups.io
Cc: Pierre Gondois <Pierre.Gondois@arm.com>; sami.mujawar@arm.com; tomas.pilar@arm.com; Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; nd@arm.com
Subject: [PATCH v5 1/5] BaseTools: PatchCheck: Exclude bash scripts from CRLF check

From: Pierre Gondois <pierre.gondois@arm.com>

Bash scripts require LF line endings to work.
PatchCheck.py checks that the files added in a patch have CRLF line endings. It excludes files ending with the ".sh" extension from this check.

Some bash script don't have a ".sh" extension. Most of them are located in:
 - BaseTools/BinWrappers/PosixLike/
 - BaseTools/Bin/CYGWIN_NT-5.1-i686/

This patch excludes these folder plus BaseTools/BuildEnv from this CRLF check.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---

The changes can be seen at: https://github.com/PierreARM/edk2/commits/803_Compile_AML_bytecode_array_into_OBJ_file_v5

Notes:
    v5:
     - Exclude some directories/files having LF line
       endings from the PatchCheck,py script. [Bob]

 BaseTools/Scripts/PatchCheck.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 106b434c750d71d8aa1658109f146dc066633c2c..e38cf61f93da50f77d4e1e2e37de5f6a08d25408 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -3,6 +3,7 @@
 #
 #  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>  #  Copyright (C) 2020, Red Hat, Inc.<BR>
+#  Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -384,9 +385,14 @@ class GitDiffCheck:
                 self.is_newfile = False
                 self.force_crlf = True
                 self.force_notabs = True
-                if self.filename.endswith('.sh'):
+                if self.filename.endswith('.sh') or \
+                    self.filename.startswith('BaseTools/BinWrappers/PosixLike/') or \
+                    self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-i686/') or \
+                    self.filename == 'BaseTools/BuildEnv':
                     #
                     # Do not enforce CR/LF line endings for linux shell scripts.
+                    # Some linux shell scripts don't end with the ".sh" extension,
+                    # they are identified by their path.
                     #
                     self.force_crlf = False
                 if self.filename == '.gitmodules':
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61939): https://edk2.groups.io/g/devel/message/61939
Mute This Topic: https://groups.io/mt/75236040/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-