From: "Fan, ZhijuX" <zhijux.fan@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>,
"Feng, Bob C" <bob.c.feng@intel.com>
Subject: [PATCH] BaseTools:Reconfig reset environment value set by edksetup script
Date: Sun, 29 Sep 2019 08:02:42 +0000 [thread overview]
Message-ID: <FAD0D7E0AE0FA54D987F6E72435CAFD50AFC4B85@SHSMSX101.ccr.corp.intel.com> (raw)
[-- 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 --]
next reply other threads:[~2019-09-29 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-29 8:02 Fan, ZhijuX [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-12-26 6:29 [PATCH] BaseTools:Reconfig reset environment value set by edksetup script Fan, ZhijuX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FAD0D7E0AE0FA54D987F6E72435CAFD50AFC4B85@SHSMSX101.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox