From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: michael.a.kubacki@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Tue, 01 Oct 2019 15:58:11 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Oct 2019 15:58:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,572,1559545200"; d="scan'208";a="195802167" Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga006.jf.intel.com with ESMTP; 01 Oct 2019 15:58:10 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Michael D Kinney Subject: [PATCH V1 1/1] BaseTools: Fix GenMake multi-workspace failure Date: Tue, 1 Oct 2019 15:57:56 -0700 Message-Id: <20191001225756.47384-1-michael.a.kubacki@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 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 Cc: Liming Gao Cc: Michael D Kinney Signed-off-by: Michael Kubacki --- BaseTools/Source/Python/AutoGen/GenMake.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 584156dab9..97ba158ff2 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -637,13 +637,11 @@ cleanlib: while not found and os.sep in package_rel_dir: index = package_rel_dir.index(os.sep) current_dir = mws.join(current_dir, package_rel_dir[:index]) - try: + if os.path.exists(current_dir): for fl in os.listdir(current_dir): if fl.endswith('.dec'): found = True break - except: - EdkLogger.error('build', FILE_NOT_FOUND, "WORKSPACE does not exist.") package_rel_dir = package_rel_dir[index + 1:] MakefileTemplateDict = { -- 2.16.2.windows.1