* [PATCH] BaseTools:Reconfig reset environment value set by edksetup script
@ 2019-12-26 6:29 Fan, ZhijuX
0 siblings, 0 replies; 2+ messages in thread
From: Fan, ZhijuX @ 2019-12-26 6:29 UTC (permalink / raw)
To: devel@edk2.groups.io; +Cc: Gao, Liming, Feng, Bob C
[-- Attachment #1: Type: text/plain, Size: 4252 bytes --]
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1985
Reconfig option should not only update build config files. This option
should reset environment value set by edksetup script, such as
EDK_TOOLS_PATH/PYTHONPATH. If so, this option will be valuable for
the user to switch the different WORKSPACEs.
We can locate BASETOOLS by setting the WORKSPACE in a directory
separate from BASETOOLS,but it can't switch workspaces.
for example, set WORKSPACE=C:\work\edk2 in directory C:\
run C:\work\edk2\edksetup in directory C:\
switch workspaces, set WORKSPACE=C:\workspace\edk2
run C:\workspace\edk2\edksetup in directory C:\
This situation does not apply with Reconfig,
So I use the "clean" option to clear the environment variables
associated with edksetup
run "C:\workspace\edk2\edksetup clean" in directory C:\,
run "C:\workspace\edk2\edksetup" in directory C:\
This patch is going to fix that issue.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
edksetup.bat | 28 ++++++++++++++++++++++++++--
edksetup.sh | 31 ++++++++++++++++++++++++++++---
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/edksetup.bat b/edksetup.bat
index 024f57a4b7..97b55659ac 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -25,6 +25,29 @@
pushd .
cd %~dp0
+if /I "%1" NEQ "Reconfig" (
+ if /I "%1" NEQ "EnvClean" (
+ goto SetEnv
+ )
+ )
+
+set EDK_TOOLS_BIN=
+set CONF_PATH=
+set BASETOOLS_PYTHON_SOURCE=
+set EDK_TOOLS_PATH=
+set WORKSPACE=
+
+if /I "%1"=="Reconfig" (
+ echo reset environment value set by edksetup script
+ goto SetEnv
+)
+
+if /I "%1"=="EnvClean" (
+ echo clean environment value set by edksetup script
+ goto end
+)
+
+:SetEnv
if not defined WORKSPACE (
goto SetWorkSpace
)
@@ -142,9 +165,10 @@ if "%1"=="" goto end
:Usage
@echo.
- @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
+ @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [EnvClean] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
@echo.
- @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
+ @echo Reconfig Reinstall target.txt, tools_def.txt, build_rule.txt and reset environment value set by edksetup script.
+ @echo EnvClean Clean environment value by edksetup script.
@echo Rebuild Perform incremental rebuild of BaseTools binaries.
@echo ForceRebuild Force a full rebuild of BaseTools binaries.
@echo VS2012 Set the env for VS2012 build.
diff --git a/edksetup.sh b/edksetup.sh
index 06d2f041e6..10ce6fb752 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -33,6 +33,8 @@ function HelpMsg()
echo " --reconfig Overwrite the WORKSPACE/Conf/*.txt files with the"
echo " template files from the BaseTools/Conf directory."
echo
+ echo " --envclean Clean environment value by edksetup script."
+ echo
echo Please note: This script must be \'sourced\' so the environment can be changed.
echo ". $SCRIPTNAME"
echo "source $SCRIPTNAME"
@@ -44,6 +46,20 @@ function SetWorkspace()
# If WORKSPACE is already set, then we can return right now
#
export PYTHONHASHSEED=1
+ if [ -n $RECONFIG ]
+ then
+ echo reset environment value set by edksetup script
+ WORKSPACE=
+ CONF_PATH=
+ fi
+
+ if [ -n $ENVCLEAN ]
+ then
+ echo clean environment value by edksetup script
+ WORKSPACE=
+ CONF_PATH=
+ return 0
+ fi
if [ -n "$WORKSPACE" ]
then
return 0
@@ -177,9 +193,14 @@ function SetupPython()
function SourceEnv()
{
- SetWorkspace &&
- SetupEnv
- SetupPython
+ if [ -n $ENVCLEAN ]
+ then
+ SetWorkspace
+ else
+ SetWorkspace &&
+ SetupEnv
+ SetupPython
+ fi
}
I=$#
@@ -194,6 +215,10 @@ do
RECONFIG=TRUE
shift
;;
+ --envclean)
+ ENVCLEAN=TRUE
+ shift
+ ;;
*)
HelpMsg
break
--
2.14.1.windows.1
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 5214 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] BaseTools:Reconfig reset environment value set by edksetup script
@ 2019-09-29 8:02 Fan, ZhijuX
0 siblings, 0 replies; 2+ messages in thread
From: Fan, ZhijuX @ 2019-09-29 8:02 UTC (permalink / raw)
To: devel@edk2.groups.io; +Cc: Gao, Liming, Feng, Bob C
[-- Attachment #1: Type: text/plain, Size: 4251 bytes --]
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1985
Reconfig option should not only update build config files. This option
should reset environment value set by edksetup script, such as
EDK_TOOLS_PATH/PYTHONPATH. If so, this option will be valuable for
the user to switch the different WORKSPACEs.
We can locate BASETOOLS by setting the WORKSPACE in a directory
separate from BASETOOLS,but it can't switch workspaces.
for example, set WORKSPACE=C:\work\edk2 in directory C:\
run C:\work\edk2\edksetup in directory C:\
switch workspaces, set WORKSPACE=C:\workspace\edk2
run C:\workspace\edk2\edksetup in directory C:\
This situation does not apply with Reconfig,
So I use the "clean" option to clear the environment variables
associated with edksetup
run "C:\workspace\edk2\edksetup clean" in directory C:\,
run "C:\workspace\edk2\edksetup" in directory C:\
This patch is going to fix that issue.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
edksetup.bat | 28 ++++++++++++++++++++++++++--
edksetup.sh | 31 ++++++++++++++++++++++++++++---
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/edksetup.bat b/edksetup.bat
index 024f57a4b7..00075ca48e 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -25,6 +25,29 @@
pushd .
cd %~dp0
+if /I "%1" neq "Reconfig" (
+ if /I "%1" neq "EnvClean" (
+ goto CheckCD
+ )
+)
+
+set EDK_TOOLS_BIN=
+set CONF_PATH=
+set BASETOOLS_PYTHON_SOURCE=
+set EDK_TOOLS_PATH=
+set WORKSPACE=
+
+if /I "%1"=="Reconfig" (
+ echo reset environment value set by edksetup script
+ goto CheckCD
+)
+
+if /I "%1"=="EnvClean" (
+ echo clean environment value set by edksetup script
+ goto end
+)
+
+:CheckCD
if not defined WORKSPACE (
goto SetWorkSpace
)
@@ -142,9 +165,10 @@ if "%1"=="" goto end
:Usage
@echo.
- @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
+ @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [EnvClean] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
@echo.
- @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
+ @echo Reconfig Reinstall target.txt, tools_def.txt, build_rule.txt and reset environment value set by edksetup script.
+ @echo EnvClean Clean environment value by edksetup script.
@echo Rebuild Perform incremental rebuild of BaseTools binaries.
@echo ForceRebuild Force a full rebuild of BaseTools binaries.
@echo VS2012 Set the env for VS2012 build.
diff --git a/edksetup.sh b/edksetup.sh
index 06d2f041e6..211cdc7230 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -33,6 +33,8 @@ function HelpMsg()
echo " --reconfig Overwrite the WORKSPACE/Conf/*.txt files with the"
echo " template files from the BaseTools/Conf directory."
echo
+ echo " --envclean Clean environment value by edksetup script."
+ echo
echo Please note: This script must be \'sourced\' so the environment can be changed.
echo ". $SCRIPTNAME"
echo "source $SCRIPTNAME"
@@ -44,6 +46,20 @@ function SetWorkspace()
# If WORKSPACE is already set, then we can return right now
#
export PYTHONHASHSEED=1
+ if [ -n $RECONFIG ]
+ then
+ echo reset environment value set by edksetup script
+ WORKSPACE=
+ CONF_PATH=
+ fi
+
+ if [ -n $ENVCLEAN ]
+ then
+ echo clean environment value by edksetup script
+ WORKSPACE=
+ CONF_PATH=
+ return 0
+ fi
if [ -n "$WORKSPACE" ]
then
return 0
@@ -177,9 +193,14 @@ function SetupPython()
function SourceEnv()
{
- SetWorkspace &&
- SetupEnv
- SetupPython
+ if [ -n $ENVCLEAN ]
+ then
+ SetWorkspace
+ else
+ SetWorkspace &&
+ SetupEnv &&
+ SetupPython
+ fi
}
I=$#
@@ -194,6 +215,10 @@ do
RECONFIG=TRUE
shift
;;
+ --envclean)
+ ENVCLEAN=TRUE
+ shift
+ ;;
*)
HelpMsg
break
--
2.14.1.windows.1
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 5110 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-26 6:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-26 6:29 [PATCH] BaseTools:Reconfig reset environment value set by edksetup script Fan, ZhijuX
-- strict thread matches above, loose matches on Subject: below --
2019-09-29 8:02 Fan, ZhijuX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox