public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes
@ 2020-07-02 15:39 Leif Lindholm
  2020-07-02 15:39 ` [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile Leif Lindholm
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Leif Lindholm @ 2020-07-02 15:39 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao

1: https://github.com/tianocore/edk2/pull/549 failed to merge, since
   PatchCheck.py reports an error. Add BaseTools/Conf/diff.order to
   the same exception clause currently used for .gitmodules to permit
   the merge to progress.

2: On Debian 10, PatchCheck.py fails to run with the system default
   python (2). This patch fixes that.
   (This uses the improved version suggested by Bob.)

Leif Lindholm (2):
  BaseTools/PatchCheck.py: add exception for diff orderfile
  BaseTools: explicitly import email.header PatchCheck.py

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>

 BaseTools/Scripts/PatchCheck.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile
  2020-07-02 15:39 [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Leif Lindholm
@ 2020-07-02 15:39 ` Leif Lindholm
  2020-07-02 23:47   ` [edk2-devel] " Bob Feng
  2020-07-02 15:39 ` [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py Leif Lindholm
  2020-07-03  7:20 ` [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Bob Feng
  2 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2020-07-02 15:39 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao

SetupGit.py adds BaseTools/Conf/diff.order as a diff orderfile, but that
file currently has CRLF line endings, which causes all pattern matches
to fail and the ordering remaining unaffected.

Add an exception to PatchCheck.py (to the existing .gitmodules clause),
so that we can merge the fix to the config file.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
---
 BaseTools/Scripts/PatchCheck.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index e38cf61f93da..527761986d4c 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -395,11 +395,12 @@ class GitDiffCheck:
                     # they are identified by their path.
                     #
                     self.force_crlf = False
-                if self.filename == '.gitmodules':
+                if self.filename == '.gitmodules' or \
+                   self.filename == 'BaseTools/Conf/diff.order':
                     #
-                    # .gitmodules is updated by git and uses tabs and LF line
-                    # endings.  Do not enforce no tabs and do not enforce
-                    # CR/LF line endings.
+                    # .gitmodules and diff orderfiles are used internally by git
+                    # use tabs and LF line endings.  Do not enforce no tabs and
+                    # do not enforce CR/LF line endings.
                     #
                     self.force_crlf = False
                     self.force_notabs = False
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py
  2020-07-02 15:39 [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Leif Lindholm
  2020-07-02 15:39 ` [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile Leif Lindholm
@ 2020-07-02 15:39 ` Leif Lindholm
  2020-07-02 15:48   ` [edk2-devel] " Bob Feng
  2020-07-03  7:20 ` [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Bob Feng
  2 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2020-07-02 15:39 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao

On Debian 10 (Buster), when running PatchCheck.py with python2, a
backtrace is printed, starting from:

  File "../edk2/BaseTools/Scripts/PatchCheck.py", line 595,
   in find_patch_pieces
    parts = email.header.decode_header(pmail.get('subject'))
  AttributeError: 'module' object has no attribute 'header'

When using python3, this backtrace does not appear.

Explicitly importing email.header resolves this for python2 and does not
appear to cause any issues with python3.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
---
 BaseTools/Scripts/PatchCheck.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 527761986d4c..52244b0bc4d8 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -20,6 +20,8 @@ import re
 import subprocess
 import sys
 
+import email.header
+
 class Verbose:
     SILENT, ONELINE, NORMAL = range(3)
     level = NORMAL
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py
  2020-07-02 15:39 ` [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py Leif Lindholm
@ 2020-07-02 15:48   ` Bob Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Bob Feng @ 2020-07-02 15:48 UTC (permalink / raw)
  To: devel@edk2.groups.io, leif@nuviainc.com; +Cc: Gao, Liming

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif Lindholm
Sent: Thursday, July 2, 2020 11:40 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py

On Debian 10 (Buster), when running PatchCheck.py with python2, a backtrace is printed, starting from:

  File "../edk2/BaseTools/Scripts/PatchCheck.py", line 595,
   in find_patch_pieces
    parts = email.header.decode_header(pmail.get('subject'))
  AttributeError: 'module' object has no attribute 'header'

When using python3, this backtrace does not appear.

Explicitly importing email.header resolves this for python2 and does not appear to cause any issues with python3.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
---
 BaseTools/Scripts/PatchCheck.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 527761986d4c..52244b0bc4d8 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -20,6 +20,8 @@ import re
 import subprocess
 import sys
 
+import email.header
+
 class Verbose:
     SILENT, ONELINE, NORMAL = range(3)
     level = NORMAL
--
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile
  2020-07-02 15:39 ` [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile Leif Lindholm
@ 2020-07-02 23:47   ` Bob Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Bob Feng @ 2020-07-02 23:47 UTC (permalink / raw)
  To: devel@edk2.groups.io, leif@nuviainc.com; +Cc: Gao, Liming

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif Lindholm
Sent: Thursday, July 2, 2020 11:40 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2-devel] [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile

SetupGit.py adds BaseTools/Conf/diff.order as a diff orderfile, but that file currently has CRLF line endings, which causes all pattern matches to fail and the ordering remaining unaffected.

Add an exception to PatchCheck.py (to the existing .gitmodules clause), so that we can merge the fix to the config file.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
---
 BaseTools/Scripts/PatchCheck.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index e38cf61f93da..527761986d4c 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -395,11 +395,12 @@ class GitDiffCheck:
                     # they are identified by their path.
                     #
                     self.force_crlf = False
-                if self.filename == '.gitmodules':
+                if self.filename == '.gitmodules' or \
+                   self.filename == 'BaseTools/Conf/diff.order':
                     #
-                    # .gitmodules is updated by git and uses tabs and LF line
-                    # endings.  Do not enforce no tabs and do not enforce
-                    # CR/LF line endings.
+                    # .gitmodules and diff orderfiles are used internally by git
+                    # use tabs and LF line endings.  Do not enforce no tabs and
+                    # do not enforce CR/LF line endings.
                     #
                     self.force_crlf = False
                     self.force_notabs = False
--
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes
  2020-07-02 15:39 [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Leif Lindholm
  2020-07-02 15:39 ` [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile Leif Lindholm
  2020-07-02 15:39 ` [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py Leif Lindholm
@ 2020-07-03  7:20 ` Bob Feng
  2 siblings, 0 replies; 6+ messages in thread
From: Bob Feng @ 2020-07-03  7:20 UTC (permalink / raw)
  To: Leif Lindholm, devel@edk2.groups.io; +Cc: Gao, Liming

Merged.

-----Original Message-----
From: Leif Lindholm <leif@nuviainc.com> 
Sent: Thursday, July 2, 2020 11:40 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes

1: https://github.com/tianocore/edk2/pull/549 failed to merge, since
   PatchCheck.py reports an error. Add BaseTools/Conf/diff.order to
   the same exception clause currently used for .gitmodules to permit
   the merge to progress.

2: On Debian 10, PatchCheck.py fails to run with the system default
   python (2). This patch fixes that.
   (This uses the improved version suggested by Bob.)

Leif Lindholm (2):
  BaseTools/PatchCheck.py: add exception for diff orderfile
  BaseTools: explicitly import email.header PatchCheck.py

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>

 BaseTools/Scripts/PatchCheck.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-03  7:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-02 15:39 [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Leif Lindholm
2020-07-02 15:39 ` [PATCH 1/2] BaseTools/PatchCheck.py: add exception for diff orderfile Leif Lindholm
2020-07-02 23:47   ` [edk2-devel] " Bob Feng
2020-07-02 15:39 ` [PATCH 2/2] BaseTools: explicitly import email.header PatchCheck.py Leif Lindholm
2020-07-02 15:48   ` [edk2-devel] " Bob Feng
2020-07-03  7:20 ` [PATCH 0/2] BaseTools: minor PatchCheck.py fixes/changes Bob Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox