public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: check CONF_PATH env to get the configure files
@ 2016-08-18  2:28 Yonghong Zhu
  2016-08-18  5:47 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2016-08-18  2:28 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Add CONF_PATH env check. First priority is user set the conf dir by
--conf option, then the CONF_PATH env, the last one is the standard
WORKSPACE(PACKAGE_PATH)/Conf.
Also print the conf path directory in the build log.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/GenFds.py | 7 +++++--
 BaseTools/Source/Python/build/build.py   | 9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 68232c5..f2de47e 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -150,12 +150,15 @@ def main():
             if not os.path.isabs(ConfDirectoryPath):
                 # Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE
                 # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
                 ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)
         else:
-            # Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
-            ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
+            if "CONF_PATH" in os.environ.keys():
+                ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])
+            else:
+                # Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
+                ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')
         GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
         BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
         if os.path.isfile(BuildConfigurationFile) == True:
             TargetTxt = TargetTxtClassObject.TargetTxtClassObject()
             TargetTxt.LoadTargetTxtFile(BuildConfigurationFile)
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index d9afdcc..be02119 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -773,12 +773,15 @@ class Build():
             if not os.path.isabs(ConfDirectoryPath):
                 # Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE
                 # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
                 ConfDirectoryPath = mws.join(self.WorkspaceDir, ConfDirectoryPath)
         else:
-            # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf
-            ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
+            if "CONF_PATH" in os.environ:
+                ConfDirectoryPath = os.path.normcase(os.path.normpath(os.environ["CONF_PATH"]))
+            else:
+                # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf
+                ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
         GlobalData.gConfDirectory = ConfDirectoryPath
         GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
 
         if BuildOptions.DisableCache:
             self.Db         = WorkspaceDatabase(":memory:")
@@ -810,11 +813,11 @@ class Build():
         EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))
         EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))
         if "EDK_TOOLS_BIN" in os.environ:
             # Print the same path style with WORKSPACE env. 
             EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN", os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"]))))
-
+        EdkLogger.quiet("%-16s = %s" % ("CONF_PATH", GlobalData.gConfDirectory))
         self.InitPreBuild()
         self.InitPostBuild()
         if self.PrebuildScript:
             EdkLogger.quiet("%-16s = %s" % ("PREBUILD", self.PrebuildScript))
         if self.PostbuildScript:
-- 
2.6.1.windows.1



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

* Re: [Patch] BaseTools: check CONF_PATH env to get the configure files
  2016-08-18  2:28 [Patch] BaseTools: check CONF_PATH env to get the configure files Yonghong Zhu
@ 2016-08-18  5:47 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2016-08-18  5:47 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Yonghong Zhu
> Sent: Thursday, August 18, 2016 10:28 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [Patch] BaseTools: check CONF_PATH env to get the
> configure files
> 
> Add CONF_PATH env check. First priority is user set the conf dir by
> --conf option, then the CONF_PATH env, the last one is the standard
> WORKSPACE(PACKAGE_PATH)/Conf.
> Also print the conf path directory in the build log.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BaseTools/Source/Python/GenFds/GenFds.py | 7 +++++--
>  BaseTools/Source/Python/build/build.py   | 9 ++++++---
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
> b/BaseTools/Source/Python/GenFds/GenFds.py
> index 68232c5..f2de47e 100644
> --- a/BaseTools/Source/Python/GenFds/GenFds.py
> +++ b/BaseTools/Source/Python/GenFds/GenFds.py
> @@ -150,12 +150,15 @@ def main():
>              if not os.path.isabs(ConfDirectoryPath):
>                  # Since alternate directory name is not absolute, the alternate
> directory is located within the WORKSPACE
>                  # This also handles someone specifying the Conf directory in the
> workspace. Using --conf=Conf
>                  ConfDirectoryPath =
> os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)
>          else:
> -            # Get standard WORKSPACE/Conf, use the absolute path to the
> WORKSPACE/Conf
> -            ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir,
> 'Conf')
> +            if "CONF_PATH" in os.environ.keys():
> +                ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])
> +            else:
> +                # Get standard WORKSPACE/Conf, use the absolute path to the
> WORKSPACE/Conf
> +                ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir,
> 'Conf')
>          GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
>          BuildConfigurationFile =
> os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
>          if os.path.isfile(BuildConfigurationFile) == True:
>              TargetTxt = TargetTxtClassObject.TargetTxtClassObject()
>              TargetTxt.LoadTargetTxtFile(BuildConfigurationFile)
> diff --git a/BaseTools/Source/Python/build/build.py
> b/BaseTools/Source/Python/build/build.py
> index d9afdcc..be02119 100644
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -773,12 +773,15 @@ class Build():
>              if not os.path.isabs(ConfDirectoryPath):
>                  # Since alternate directory name is not absolute, the alternate
> directory is located within the WORKSPACE
>                  # This also handles someone specifying the Conf directory in the
> workspace. Using --conf=Conf
>                  ConfDirectoryPath = mws.join(self.WorkspaceDir, ConfDirectoryPath)
>          else:
> -            # Get standard WORKSPACE/Conf use the absolute path to the
> WORKSPACE/Conf
> -            ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
> +            if "CONF_PATH" in os.environ:
> +                ConfDirectoryPath =
> os.path.normcase(os.path.normpath(os.environ["CONF_PATH"]))
> +            else:
> +                # Get standard WORKSPACE/Conf use the absolute path to the
> WORKSPACE/Conf
> +                ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
>          GlobalData.gConfDirectory = ConfDirectoryPath
>          GlobalData.gDatabasePath =
> os.path.normpath(os.path.join(ConfDirectoryPath,
> GlobalData.gDatabasePath))
> 
>          if BuildOptions.DisableCache:
>              self.Db         = WorkspaceDatabase(":memory:")
> @@ -810,11 +813,11 @@ class Build():
>          EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE",
> os.environ["EFI_SOURCE"]))
>          EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH",
> os.environ["EDK_TOOLS_PATH"]))
>          if "EDK_TOOLS_BIN" in os.environ:
>              # Print the same path style with WORKSPACE env.
>              EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN",
> os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"]))))
> -
> +        EdkLogger.quiet("%-16s = %s" % ("CONF_PATH",
> GlobalData.gConfDirectory))
>          self.InitPreBuild()
>          self.InitPostBuild()
>          if self.PrebuildScript:
>              EdkLogger.quiet("%-16s = %s" % ("PREBUILD", self.PrebuildScript))
>          if self.PostbuildScript:
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2016-08-18  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18  2:28 [Patch] BaseTools: check CONF_PATH env to get the configure files Yonghong Zhu
2016-08-18  5:47 ` Gao, Liming

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