]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTool: Fixed incremental rebuild issue.
authorFeng, Bob C <bob.c.feng@intel.com>
Wed, 20 Feb 2019 15:21:31 +0000 (23:21 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Fri, 22 Feb 2019 07:47:14 +0000 (15:47 +0800)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1540

This issue in introduced by commit
d943b0c339fe3d35ffdf9f580ccb7a55915c6854

To convert bytes to string, we need to use bytes.decode()
instead of using str(bytes).

If the source file is not a txt file, ignore that file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/Workspace/DscBuildData.py

index 53c5b8577d0947bd57808e16b2b4e237c02a8f08..b441817b52bf63e987a8af77059cc723e2138725 100644 (file)
@@ -1045,14 +1045,14 @@ cleanlib:
                     EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))\r
                 if len(FileContent) == 0:\r
                     continue\r
-\r
-                if FileContent[0] == 0xff or FileContent[0] == 0xfe:\r
-                    FileContent = FileContent.decode('utf-16')\r
-                else:\r
-                    try:\r
-                        FileContent = str(FileContent)\r
-                    except:\r
-                        pass\r
+                try:\r
+                    if FileContent[0] == 0xff or FileContent[0] == 0xfe:\r
+                        FileContent = FileContent.decode('utf-16')\r
+                    else:\r
+                        FileContent = FileContent.decode()\r
+                except:\r
+                    # The file is not txt file. for example .mcb file\r
+                    continue\r
                 IncludedFileList = gIncludePattern.findall(FileContent)\r
 \r
                 for Inc in IncludedFileList:\r
index 1ffefe6e7e6dba378013bc839105fa73f46a3424..7221946062415a97b77cae4570d44d8510c3b4f8 100644 (file)
@@ -155,15 +155,14 @@ def GetDependencyList(FileStack, SearchPathList):
             if len(FileContent) == 0:\r
                 continue\r
 \r
-            if FileContent[0] == 0xff or FileContent[0] == 0xfe:\r
-                FileContent = FileContent.decode('utf-16')\r
-                IncludedFileList = gIncludePattern.findall(FileContent)\r
-            else:\r
-                try:\r
-                    FileContent = str(FileContent)\r
-                    IncludedFileList = gIncludePattern.findall(FileContent)\r
-                except:\r
-                    pass\r
+            try:\r
+                if FileContent[0] == 0xff or FileContent[0] == 0xfe:\r
+                    FileContent = FileContent.decode('utf-16')\r
+                else:\r
+                    FileContent = FileContent.decode()\r
+            except:\r
+                # The file is not txt file. for example .mcb file\r
+                continue\r
             IncludedFileList = gIncludePattern.findall(FileContent)\r
 \r
             for Inc in IncludedFileList:\r