public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH%
@ 2018-08-07  1:35 Feng, YunhuaX
  2018-08-07  2:20 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, YunhuaX @ 2018-08-07  1:35 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zhu, Yonghong, Gao, Liming

For non-root folder, such as "X:\bp", the EDK_TOOLS_PATH will
resolve to "X:\bp\edk2\BaseTools". This is OK.

But if WORKSPACE is at a root folder, such as "X:\", the EDK_TOOLS_PATH
will look like "X:\\BaseTools". The *double backslash* can fail the command
like "del" and thus affect the %ERRORLEVEL% variable, which may break
subsequent build processing.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 edksetup.bat | 39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/edksetup.bat b/edksetup.bat
index 97e2330e8c..c32755a471 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -57,26 +57,37 @@ if /I "%1"=="/h" goto Usage
 if /I "%1"=="/?" goto Usage
 if /I "%1"=="/help" goto Usage
 
 if /I "%1"=="NewBuild" shift
 if not defined EDK_TOOLS_PATH (
-  if exist %WORKSPACE%\BaseTools (
-    set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
-  ) else (
-    if defined PACKAGES_PATH (
-      for %%i IN (%PACKAGES_PATH%) DO (
-        if exist %%~fi\BaseTools (
-          set EDK_TOOLS_PATH=%%~fi\BaseTools
-          goto checkNt32Flag
-        )
+  goto SetEdkToolsPath
+) else (
+  goto checkNt32Flag
+)
+
+:SetEdkToolsPath
+if %WORKSPACE:~-1% EQU \ (
+  @set EDK_BASETOOLS=%WORKSPACE%BaseTools
+) else (
+  @set EDK_BASETOOLS=%WORKSPACE%\BaseTools
+)
+if exist %EDK_BASETOOLS% (
+  set EDK_TOOLS_PATH=%EDK_BASETOOLS%
+  set EDK_BASETOOLS=
+) else (
+  if defined PACKAGES_PATH (
+    for %%i IN (%PACKAGES_PATH%) DO (
+      if exist %%~fi\BaseTools (
+        set EDK_TOOLS_PATH=%%~fi\BaseTools
+        goto checkNt32Flag
       )
-    ) else (
-      echo.
-      echo !!! ERROR !!! Cannot find BaseTools !!!
-      echo.
-      goto BadBaseTools
     )
+  ) else (
+    echo.
+    echo !!! ERROR !!! Cannot find BaseTools !!!
+    echo.
+    goto BadBaseTools
   )
 )
 
 :checkNt32Flag
 if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
-- 
2.12.2.windows.2



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

* Re: [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH%
  2018-08-07  1:35 [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH% Feng, YunhuaX
@ 2018-08-07  2:20 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-08-07  2:20 UTC (permalink / raw)
  To: Feng, YunhuaX, edk2-devel@lists.01.org

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

>-----Original Message-----
>From: Feng, YunhuaX
>Sent: Tuesday, August 07, 2018 9:36 AM
>To: edk2-devel@lists.01.org
>Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming
><liming.gao@intel.com>
>Subject: [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH%
>
>For non-root folder, such as "X:\bp", the EDK_TOOLS_PATH will
>resolve to "X:\bp\edk2\BaseTools". This is OK.
>
>But if WORKSPACE is at a root folder, such as "X:\", the EDK_TOOLS_PATH
>will look like "X:\\BaseTools". The *double backslash* can fail the command
>like "del" and thus affect the %ERRORLEVEL% variable, which may break
>subsequent build processing.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
>---
> edksetup.bat | 39 +++++++++++++++++++++++++--------------
> 1 file changed, 25 insertions(+), 14 deletions(-)
>
>diff --git a/edksetup.bat b/edksetup.bat
>index 97e2330e8c..c32755a471 100755
>--- a/edksetup.bat
>+++ b/edksetup.bat
>@@ -57,26 +57,37 @@ if /I "%1"=="/h" goto Usage
> if /I "%1"=="/?" goto Usage
> if /I "%1"=="/help" goto Usage
>
> if /I "%1"=="NewBuild" shift
> if not defined EDK_TOOLS_PATH (
>-  if exist %WORKSPACE%\BaseTools (
>-    set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
>-  ) else (
>-    if defined PACKAGES_PATH (
>-      for %%i IN (%PACKAGES_PATH%) DO (
>-        if exist %%~fi\BaseTools (
>-          set EDK_TOOLS_PATH=%%~fi\BaseTools
>-          goto checkNt32Flag
>-        )
>+  goto SetEdkToolsPath
>+) else (
>+  goto checkNt32Flag
>+)
>+
>+:SetEdkToolsPath
>+if %WORKSPACE:~-1% EQU \ (
>+  @set EDK_BASETOOLS=%WORKSPACE%BaseTools
>+) else (
>+  @set EDK_BASETOOLS=%WORKSPACE%\BaseTools
>+)
>+if exist %EDK_BASETOOLS% (
>+  set EDK_TOOLS_PATH=%EDK_BASETOOLS%
>+  set EDK_BASETOOLS=
>+) else (
>+  if defined PACKAGES_PATH (
>+    for %%i IN (%PACKAGES_PATH%) DO (
>+      if exist %%~fi\BaseTools (
>+        set EDK_TOOLS_PATH=%%~fi\BaseTools
>+        goto checkNt32Flag
>       )
>-    ) else (
>-      echo.
>-      echo !!! ERROR !!! Cannot find BaseTools !!!
>-      echo.
>-      goto BadBaseTools
>     )
>+  ) else (
>+    echo.
>+    echo !!! ERROR !!! Cannot find BaseTools !!!
>+    echo.
>+    goto BadBaseTools
>   )
> )
>
> :checkNt32Flag
> if exist %EDK_TOOLS_PATH%\Source set
>BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
>--
>2.12.2.windows.2



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

end of thread, other threads:[~2018-08-07  2:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-07  1:35 [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH% Feng, YunhuaX
2018-08-07  2:20 ` Gao, Liming

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