]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: PatchCheck: Exclude bash scripts from CRLF check
authorPierre Gondois <pierre.gondois@arm.com>
Wed, 1 Jul 2020 14:06:00 +0000 (22:06 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 2 Jul 2020 09:29:38 +0000 (09:29 +0000)
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>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Scripts/PatchCheck.py

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