diff --git a/.pytool/Plugin/CodeQL/CodeQlAnalyzePlugin.py b/.pytool/Plugin/CodeQL/CodeQlAnalyzePlugin.py index 26d2344657..fc5576c5fc 100644 --- a/.pytool/Plugin/CodeQL/CodeQlAnalyzePlugin.py +++ b/.pytool/Plugin/CodeQL/CodeQlAnalyzePlugin.py @@ -35,18 +35,18 @@ def do_post_build(self, builder: UefiBuilder) -> int: int: The number of CodeQL errors found. Zero indicates that AuditOnly mode is enabled or no failures were found. """ - - pp = builder.pp.split(os.pathsep) - edk2_path = Edk2Path(builder.ws, pp) - self.builder = builder - self.package = edk2_path.GetContainingPackage( - builder.mws.join(builder.ws, - builder.env.GetValue( - "ACTIVE_PLATFORM"))) + self.package = builder.edk2path.GetContainingPackage( + builder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath( + builder.env.GetValue("ACTIVE_PLATFORM") + ) + ) + self.package_path = Path( - edk2_path.GetAbsolutePathOnThisSystemFromEdk2RelativePath( - self.package)) + builder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath( + self.package + ) + ) self.target = builder.env.GetValue("TARGET") self.codeql_db_path = codeql_plugin.get_codeql_db_path( diff --git a/.pytool/Plugin/CodeQL/CodeQlBuildPlugin.py b/.pytool/Plugin/CodeQL/CodeQlBuildPlugin.py index 2fbf554f8f..2f6c928c21 100644 --- a/.pytool/Plugin/CodeQL/CodeQlBuildPlugin.py +++ b/.pytool/Plugin/CodeQL/CodeQlBuildPlugin.py @@ -36,14 +36,13 @@ def do_pre_build(self, builder: UefiBuilder) -> int: """ if not builder.SkipBuild: - pp = builder.pp.split(os.pathsep) - edk2_path = Edk2Path(builder.ws, pp) - self.builder = builder - self.package = edk2_path.GetContainingPackage( - builder.mws.join(builder.ws, - builder.env.GetValue( - "ACTIVE_PLATFORM"))) + self.package = builder.edk2path.GetContainingPackage( + builder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath( + builder.env.GetValue("ACTIVE_PLATFORM") + ) + ) + self.target = builder.env.GetValue("TARGET") self.build_output_dir = builder.env.GetValue("BUILD_OUTPUT_BASE") @@ -89,9 +88,7 @@ def do_pre_build(self, builder: UefiBuilder) -> int: # Since it's unclear how quotes are handled and may change in the # future, this code is going to use the workaround to place the # command in an executable file that is instead passed to CodeQL. - self.codeql_cmd_path = Path(builder.mws.join( - builder.ws, self.build_output_dir, - "codeql_build_command")) + self.codeql_cmd_path = Path(self.build_output_dir, "codeql_build_command") build_params = self._get_build_params() diff --git a/.pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheckBuildPlugin.py b/.pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheckBuildPlugin.py index b154466602..aa3a2bbcab 100644 --- a/.pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheckBuildPlugin.py +++ b/.pytool/Plugin/DebugMacroCheck/BuildPlugin/DebugMacroCheckBuildPlugin.py @@ -58,12 +58,12 @@ def do_pre_build(self, builder: UefiBuilder) -> int: if "no-target" in build_target: return 0 - pp = builder.pp.split(os.pathsep) - edk2 = Edk2Path(builder.ws, pp) + edk2 = builder.edk2path package = edk2.GetContainingPackage( - builder.mws.join(builder.ws, - builder.env.GetValue( - "ACTIVE_PLATFORM"))) + builder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath( + builder.env.GetValue("ACTIVE_PLATFORM") + ) + ) package_path = Path( edk2.GetAbsolutePathOnThisSystemFromEdk2RelativePath( package)) diff --git a/.pytool/Plugin/ImageValidation/ImageValidation.py b/.pytool/Plugin/ImageValidation/ImageValidation.py index aa86e45185..ea7060106b 100644 --- a/.pytool/Plugin/ImageValidation/ImageValidation.py +++ b/.pytool/Plugin/ImageValidation/ImageValidation.py @@ -68,9 +68,7 @@ def do_post_build(self, thebuilder): fdf_parser = FdfParser() dsc_parser = DscParser() - ws = thebuilder.ws - pp = thebuilder.pp.split(os.pathsep) - edk2 = Edk2Path(ws, pp) + edk2 = thebuilder.edk2path ActiveDsc = edk2.GetAbsolutePathOnThisSystemFromEdk2RelativePath( thebuilder.env.GetValue("ACTIVE_PLATFORM")) diff --git a/BaseTools/Plugin/BmpCheck/BmpCheckPlugin.py b/BaseTools/Plugin/BmpCheck/BmpCheckPlugin.py index d018fc4e91..539fb290ca 100644 --- a/BaseTools/Plugin/BmpCheck/BmpCheckPlugin.py +++ b/BaseTools/Plugin/BmpCheck/BmpCheckPlugin.py @@ -121,9 +121,7 @@ def do_pre_build(self, thebuilder): fp = FdfParser() dp = DscParser() - ws = thebuilder.ws - pp = thebuilder.pp.split(";") - edk2 = Edk2Path(ws, pp) + edk2 = thebuilder.edk2path ActiveDsc = edk2.GetAbsolutePathOnThisSystemFromEdk2RelativePath( thebuilder.env.GetValue("ACTIVE_PLATFORM")) diff --git a/BaseTools/Plugin/FdSizeReport/FdSizeReportGenerator.py b/BaseTools/Plugin/FdSizeReport/FdSizeReportGenerator.py index 42e2a6c0d9..abcc4110f9 100644 --- a/BaseTools/Plugin/FdSizeReport/FdSizeReportGenerator.py +++ b/BaseTools/Plugin/FdSizeReport/FdSizeReportGenerator.py @@ -53,7 +53,7 @@ def do_post_build(self, thebuilder): #1 - Get the output path for report file OutF = thebuilder.env.GetValue("FDSIZEREPORT_FILE") #2 - Get the FDF path - FdfF = thebuilder.mws.join(thebuilder.ws, thebuilder.env.GetValue("FLASH_DEFINITION")) + FdfF = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(thebuilder.env.GetValue("FLASH_DEFINITION")) #3 - Get the product name Product = thebuilder.env.GetValue("PRODUCT_NAME") if Product is None: diff --git a/BaseTools/Plugin/OverrideValidation/OverrideValidation.py b/BaseTools/Plugin/OverrideValidation/OverrideValidation.py index 7b475aee8d..63c31465de 100644 --- a/BaseTools/Plugin/OverrideValidation/OverrideValidation.py +++ b/BaseTools/Plugin/OverrideValidation/OverrideValidation.py @@ -106,9 +106,7 @@ def override_plat_validate(self, thebuilder): result = self.OverrideResult.OR_ALL_GOOD InfFileList = self.get_dsc_inf_list(thebuilder) - ws = thebuilder.ws - pp = thebuilder.pp.split(os.pathsep) - self.PathTool = Edk2Path(ws, pp) + self.PathTool = thebuilder.edk2path if (InfFileList == []): return result @@ -120,7 +118,7 @@ def override_plat_validate(self, thebuilder): for file in InfFileList: temp_list = [] modulenode = self.ModuleNode(file, self.OverrideResult.OR_ALL_GOOD, 0) - fullpath = thebuilder.mws.join(thebuilder.ws, file) + fullpath = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(file) m_result = self.override_detect_process(thebuilder, fullpath, temp_list, modulenode, status) # Do not log the module that does not have any override records @@ -291,7 +289,7 @@ def override_process_line_with_version1(self, thebuilder, filelist, OverrideEntr # Step 2: Process the path to overridden module # Normalize the path to support different slashes, then strip the initial '\\' to make sure os.path.join will work correctly overriddenpath = os.path.normpath(OverrideEntry[1].strip()).strip('\\') - fullpath = os.path.normpath(thebuilder.mws.join(thebuilder.ws, overriddenpath)) + fullpath = os.path.normpath(thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(overriddenpath)) # Search overridden module in workspace if not os.path.isfile(fullpath) and not os.path.isdir(fullpath): logging.info("Inf Overridden File/Path Not Found in Workspace or Packages_Path: %s" %(overriddenpath)) @@ -354,7 +352,7 @@ def override_process_line_with_version2(self, thebuilder, filelist, OverrideEntr # if we failed, do a diff of the overridden file (as long as exist) and show the output if result != self.OverrideResult.OR_ALL_GOOD and result != self.OverrideResult.OR_TARGET_INF_NOT_FOUND: overriddenpath = os.path.normpath(OverrideEntry[1].strip()).strip('\\') - fullpath = os.path.normpath(thebuilder.mws.join(thebuilder.ws, overriddenpath)) + fullpath = os.path.normpath(thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(overriddenpath)) if os.path.exists(fullpath): patch = ModuleGitPatch(fullpath, GitHash) # TODO: figure out how to get the log file @@ -429,7 +427,7 @@ def override_log_print(self, thebuilder, modulelist, status): # stack: the stack of paths collected during a dfs for loop detection, should be absolute path and lower case all the time # log: log file object, must be readily open for file write when called def node_dfs(self, thebuilder, node, stack, log): - fullpath = os.path.normpath(thebuilder.mws.join(thebuilder.ws, node.path)).lower() + fullpath = os.path.normpath(thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(node.path)).lower() if (node.path in stack): return stack.append(fullpath) @@ -458,19 +456,19 @@ def get_dsc_inf_list(self, thebuilder): logging.debug("Parse Active Platform DSC file") input_vars = thebuilder.env.GetAllBuildKeyValues() input_vars["TARGET"] = thebuilder.env.GetValue("TARGET") - dscp = DscParser().SetEdk2Path(Edk2Path(thebuilder.ws, thebuilder.pp.split(os.pathsep))).SetInputVars(input_vars) + dscp = DscParser().SetEdk2Path(thebuilder.edk2path).SetInputVars(input_vars) plat_dsc = thebuilder.env.GetValue("ACTIVE_PLATFORM") if (plat_dsc is None): return InfFileList # Parse the DSC - pa = thebuilder.mws.join(thebuilder.ws, plat_dsc) + pa = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(plat_dsc) dscp.ParseFile(pa) # Add the DSC itself (including all the includes) InfFileList.extend(dscp.GetAllDscPaths()) # Add the FDF if "FLASH_DEFINITION" in dscp.LocalVars: - fd = thebuilder.mws.join(thebuilder.ws, dscp.LocalVars["FLASH_DEFINITION"]) + fd = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(dscp.LocalVars["FLASH_DEFINITION"]) InfFileList.append(fd) # Here we collect all the reference libraries, IA-32 modules, x64 modules and other modules if (dscp.Parsed) : diff --git a/PolicyServicePkg/Plugins/UpdatePolicyHdr/UpdatePolicyHdr.py b/PolicyServicePkg/Plugins/UpdatePolicyHdr/UpdatePolicyHdr.py index c41d77e962..dbe0a8768a 100644 --- a/PolicyServicePkg/Plugins/UpdatePolicyHdr/UpdatePolicyHdr.py +++ b/PolicyServicePkg/Plugins/UpdatePolicyHdr/UpdatePolicyHdr.py @@ -90,17 +90,15 @@ def do_pre_build(self, thebuilder): yaml_list = [] exception_list = [] - ws = thebuilder.ws - pp = thebuilder.pp.split(os.pathsep) - edk2 = Edk2Path(ws, pp) + edk2 = thebuilder.edk2path # Form the exception list of formatted absolute paths. And always ignore our own samples. - exception_list.append (thebuilder.mws.join (thebuilder.ws, "PolicyServicePkg", "Samples")) + exception_list.append (edk2.GetAbsolutePathOnThisSystemFromEdk2RelativePath("PolicyServicePkg", "Samples")) platform_exception = thebuilder.env.GetValue("POLICY_IGNORE_PATHS") if platform_exception is not None: plat_list = platform_exception.split(';') for each in plat_list: - exception_list.append(os.path.normpath (thebuilder.mws.join (thebuilder.ws, each))) + exception_list.append(os.path.normpath (edk2.GetAbsolutePathOnThisSystemFromEdk2RelativePath(each))) # Look for *_policy_def.yaml files in all package paths. for pkg_path in pp: @@ -151,11 +149,11 @@ def do_pre_build(self, thebuilder): os.mkdir (final_dir) # Set up a playground first - op_dir = thebuilder.mws.join(thebuilder.ws, thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), "ConfPolicy") + op_dir = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), "ConfPolicy") if not os.path.isdir(op_dir): os.makedirs(op_dir) - cmd = thebuilder.mws.join(thebuilder.ws, "PolicyServicePkg", "Tools", "GenCfgData.py") + cmd = thebuilder.edk2path.GetAbsolutePathOnThisSystemFromEdk2RelativePath("PolicyServicePkg", "Tools", "GenCfgData.py") conf_file = setting if conf_file is None: