]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix GenMake multi-workspace failure
authorKubacki, Michael A <michael.a.kubacki@intel.com>
Tue, 1 Oct 2019 22:57:56 +0000 (06:57 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Fri, 4 Oct 2019 03:13:37 +0000 (11:13 +0800)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2232

Commit 0075ab2cec introduced an issue that causes an exception
when multiple workspace packages paths are specified. For example,
if edk2-platforms is used, the root directory will contain an edk
and edk2-platforms directory representing the respective
repositories.

In GenMake, the path to the package DEC file for a module is
discovered by getting the relative path of the INF to the
workspace root directory. Each directory in the relative path
is incrementally joined to the WORKSPACE directory. The file
list in the joined path is searched for a DEC file.

As an example, if the build command is used on a package outside
the edk2 repository, the INF file path is relative to the
edk2-platforms directory not edk2. This causes directory paths
to be built that do not exist. Commit 0075ab2cec replaced the
os.path.exists() call with a try except block that always fails
when os.listdir() is invoked to enumerate the list of files in
the built directory path on packages outside edk2.

This commit restores the original conditional statement which
avoids calling os.listdir() with an invalid directory path.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py

index 584156dab97224b42fcd01e7d0f46aa44f71a022..97ba158ff271090d69baa0682a3f21d36e925747 100755 (executable)
@@ -637,13 +637,11 @@ cleanlib:
         while not found and os.sep in package_rel_dir:\r
             index = package_rel_dir.index(os.sep)\r
             current_dir = mws.join(current_dir, package_rel_dir[:index])\r
-            try:\r
+            if os.path.exists(current_dir):\r
                 for fl in os.listdir(current_dir):\r
                     if fl.endswith('.dec'):\r
                         found = True\r
                         break\r
-            except:\r
-                EdkLogger.error('build', FILE_NOT_FOUND, "WORKSPACE does not exist.")\r
             package_rel_dir = package_rel_dir[index + 1:]\r
 \r
         MakefileTemplateDict = {\r