public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] Add --reconfig option to edksetup.sh
@ 2016-10-20 15:46 Leif Lindholm
  2016-10-20 15:46 ` [PATCH 1/2] edksetup.sh: rework argument parsing and update usage information Leif Lindholm
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Leif Lindholm @ 2016-10-20 15:46 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu

This mini series performs some minor reworking of edksetup.sh, and then
adds the --reconfig command line option, to force overwriting existing
cached config files in $WORKSPACE/Conf/.

Leif Lindholm (2):
  edksetup.sh: rework argument parsing and update usage information
  edksetup.sh, BaseTools/BuildEnv: add --reconfig support

 BaseTools/BuildEnv |  3 ++-
 edksetup.sh        | 75 ++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 49 insertions(+), 29 deletions(-)

-- 
2.9.3



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

* [PATCH 1/2] edksetup.sh: rework argument parsing and update usage information
  2016-10-20 15:46 [PATCH 0/2] Add --reconfig option to edksetup.sh Leif Lindholm
@ 2016-10-20 15:46 ` Leif Lindholm
  2016-10-20 15:46 ` [PATCH 2/2] edksetup.sh, BaseTools/BuildEnv: add --reconfig support Leif Lindholm
  2016-10-24  2:53 ` [PATCH 0/2] Add --reconfig option to edksetup.sh Gao, Liming
  2 siblings, 0 replies; 5+ messages in thread
From: Leif Lindholm @ 2016-10-20 15:46 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu

Rework the argument parsing logic to a more extensible traditional
while/case setup to prepare for further additions.

While doing that, align the Usage printout to look a bit more like
the output of Edk2Setup.bat (and be more correct).

And also stop passing around command line options to the BuildEnv
script (which does not check them anyway).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 edksetup.sh | 65 +++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 37 insertions(+), 28 deletions(-)

diff --git a/edksetup.sh b/edksetup.sh
index 27c0994..7b54223 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -1,5 +1,6 @@
 #
 # Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
@@ -22,12 +23,21 @@
 # Please reference edk2 user manual for more detail descriptions at https://github.com/tianocore-docs/Docs/raw/master/User_Docs/EDK_II_UserManual_0_7.pdf
 #
 
+SCRIPTNAME="edksetup.sh"
+
 function HelpMsg()
 {
+  echo "Usage: $SCRIPTNAME [Options]"
+  echo
+  echo "The system environment variable, WORKSPACE, is always set to the current"
+  echo "working directory."
+  echo
+  echo "Options: "
+  echo "  --help, -h, -?        Print this help screen and exit."
+  echo
   echo Please note: This script must be \'sourced\' so the environment can be changed.
-  echo ". edksetup.sh" 
-  echo "source edksetup.sh"
-  return 1
+  echo ". $SCRIPTNAME"
+  echo "source $SCRIPTNAME"
 }
 
 function SetWorkspace()
@@ -71,10 +81,10 @@ function SetupEnv()
 {
   if [ -n "$EDK_TOOLS_PATH" ]
   then
-    . $EDK_TOOLS_PATH/BuildEnv $*
+    . $EDK_TOOLS_PATH/BuildEnv
   elif [ -f "$WORKSPACE/BaseTools/BuildEnv" ]
   then
-    . $WORKSPACE/BaseTools/BuildEnv $*
+    . $WORKSPACE/BaseTools/BuildEnv
   elif [ -n "$PACKAGES_PATH" ]
   then 
     PATH_LIST=$PACKAGES_PATH
@@ -84,7 +94,7 @@ function SetupEnv()
       if [ -f "$DIR/BaseTools/BuildEnv" ]
       then
         export EDK_TOOLS_PATH=$DIR/BaseTools
-        . $DIR/BaseTools/BuildEnv $*
+        . $DIR/BaseTools/BuildEnv
         break
       fi
     done
@@ -99,32 +109,31 @@ function SetupEnv()
 
 function SourceEnv()
 {
-  if [ \
-       "$1" = "-?" -o \
-       "$1" = "-h" -o \
-       "$1" = "--help" \
-     ]
-  then
-    HelpMsg
-  else
-    SetWorkspace &&
-    SetupEnv "$*"
-  fi
+  SetWorkspace &&
+  SetupEnv
 }
 
-if [ $# -gt 1 ]
-then
-  HelpMsg
-elif [ $# -eq 1 ] && [ "$1" != "BaseTools" ]
-then
-  HelpMsg
-fi
+I=$#
+while [ $I -gt 0 ]
+do
+  case "$1" in
+    BaseTools)
+      # Ignore argument for backwards compatibility
+      shift
+    ;;
+    -?|-h|--help|*)
+      HelpMsg
+      break
+    ;;
+  esac
+  I=$(($I - 1))
+done
 
-RETVAL=$?
-if [ $RETVAL -ne 0 ]
+if [ $I -gt 0 ]
 then
-  return $RETVAL
+  return 1
 fi
 
-SourceEnv "$*"
+SourceEnv
 
+return $?
-- 
2.9.3



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

* [PATCH 2/2] edksetup.sh, BaseTools/BuildEnv: add --reconfig support
  2016-10-20 15:46 [PATCH 0/2] Add --reconfig option to edksetup.sh Leif Lindholm
  2016-10-20 15:46 ` [PATCH 1/2] edksetup.sh: rework argument parsing and update usage information Leif Lindholm
@ 2016-10-20 15:46 ` Leif Lindholm
  2016-10-24  2:53 ` [PATCH 0/2] Add --reconfig option to edksetup.sh Gao, Liming
  2 siblings, 0 replies; 5+ messages in thread
From: Leif Lindholm @ 2016-10-20 15:46 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu

Add command line option --reconfig to edksetup.sh, forcing cached
copies of Conf/*.txt to be overwritten.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 BaseTools/BuildEnv |  3 ++-
 edksetup.sh        | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv
index 7c77454..cb6403a 100755
--- a/BaseTools/BuildEnv
+++ b/BaseTools/BuildEnv
@@ -3,6 +3,7 @@
 # This file must be "sourced" not merely executed. For example: ". edksetup.sh"
 #
 # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
@@ -215,7 +216,7 @@ CopySingleTemplateFile() {
 
   if [ -e $DST_FILENAME ]
   then
-    return
+    [ $RECONFIG != TRUE ] && return
   fi
 
   echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
diff --git a/edksetup.sh b/edksetup.sh
index 7b54223..ec54f9e 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -24,6 +24,7 @@
 #
 
 SCRIPTNAME="edksetup.sh"
+RECONFIG=FALSE
 
 function HelpMsg()
 {
@@ -35,6 +36,9 @@ function HelpMsg()
   echo "Options: "
   echo "  --help, -h, -?        Print this help screen and exit."
   echo
+  echo "  --reconfig            Overwrite the WORKSPACE/Conf/*.txt files with the"
+  echo "                        template files from the BaseTools/Conf directory."
+  echo
   echo Please note: This script must be \'sourced\' so the environment can be changed.
   echo ". $SCRIPTNAME"
   echo "source $SCRIPTNAME"
@@ -121,6 +125,10 @@ do
       # Ignore argument for backwards compatibility
       shift
     ;;
+    --reconfig)
+      RECONFIG=TRUE
+      shift
+    ;;
     -?|-h|--help|*)
       HelpMsg
       break
@@ -136,4 +144,6 @@ fi
 
 SourceEnv
 
+unset SCRIPTNAME RECONFIG
+
 return $?
-- 
2.9.3



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

* Re: [PATCH 0/2] Add --reconfig option to edksetup.sh
  2016-10-20 15:46 [PATCH 0/2] Add --reconfig option to edksetup.sh Leif Lindholm
  2016-10-20 15:46 ` [PATCH 1/2] edksetup.sh: rework argument parsing and update usage information Leif Lindholm
  2016-10-20 15:46 ` [PATCH 2/2] edksetup.sh, BaseTools/BuildEnv: add --reconfig support Leif Lindholm
@ 2016-10-24  2:53 ` Gao, Liming
  2016-10-24 12:56   ` Leif Lindholm
  2 siblings, 1 reply; 5+ messages in thread
From: Gao, Liming @ 2016-10-24  2:53 UTC (permalink / raw)
  To: Leif Lindholm, edk2-devel@lists.01.org

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

> -----Original Message-----
> From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
> Sent: Thursday, October 20, 2016 11:46 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
> <yonghong.zhu@intel.com>
> Subject: [PATCH 0/2] Add --reconfig option to edksetup.sh
> 
> This mini series performs some minor reworking of edksetup.sh, and then
> adds the --reconfig command line option, to force overwriting existing
> cached config files in $WORKSPACE/Conf/.
> 
> Leif Lindholm (2):
>   edksetup.sh: rework argument parsing and update usage information
>   edksetup.sh, BaseTools/BuildEnv: add --reconfig support
> 
>  BaseTools/BuildEnv |  3 ++-
>  edksetup.sh        | 75 ++++++++++++++++++++++++++++++++++-------------
> -------
>  2 files changed, 49 insertions(+), 29 deletions(-)
> 
> --
> 2.9.3



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

* Re: [PATCH 0/2] Add --reconfig option to edksetup.sh
  2016-10-24  2:53 ` [PATCH 0/2] Add --reconfig option to edksetup.sh Gao, Liming
@ 2016-10-24 12:56   ` Leif Lindholm
  0 siblings, 0 replies; 5+ messages in thread
From: Leif Lindholm @ 2016-10-24 12:56 UTC (permalink / raw)
  To: Gao, Liming; +Cc: edk2-devel@lists.01.org, Zhu, Yonghong

Thanks, pushed as
44f79425589ef58cc10e58e1d1d882e02871158d..c112e371ce0aa40204fc9a1674cd2e0df0d743c8

On 24 October 2016 at 03:53, Gao, Liming <liming.gao@intel.com> wrote:
> Reviewed-by: Liming Gao <liming.gao@intel.com>
>
>> -----Original Message-----
>> From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
>> Sent: Thursday, October 20, 2016 11:46 PM
>> To: edk2-devel@lists.01.org
>> Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong
>> <yonghong.zhu@intel.com>
>> Subject: [PATCH 0/2] Add --reconfig option to edksetup.sh
>>
>> This mini series performs some minor reworking of edksetup.sh, and then
>> adds the --reconfig command line option, to force overwriting existing
>> cached config files in $WORKSPACE/Conf/.
>>
>> Leif Lindholm (2):
>>   edksetup.sh: rework argument parsing and update usage information
>>   edksetup.sh, BaseTools/BuildEnv: add --reconfig support
>>
>>  BaseTools/BuildEnv |  3 ++-
>>  edksetup.sh        | 75 ++++++++++++++++++++++++++++++++++-------------
>> -------
>>  2 files changed, 49 insertions(+), 29 deletions(-)
>>
>> --
>> 2.9.3
>


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

end of thread, other threads:[~2016-10-24 12:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-20 15:46 [PATCH 0/2] Add --reconfig option to edksetup.sh Leif Lindholm
2016-10-20 15:46 ` [PATCH 1/2] edksetup.sh: rework argument parsing and update usage information Leif Lindholm
2016-10-20 15:46 ` [PATCH 2/2] edksetup.sh, BaseTools/BuildEnv: add --reconfig support Leif Lindholm
2016-10-24  2:53 ` [PATCH 0/2] Add --reconfig option to edksetup.sh Gao, Liming
2016-10-24 12:56   ` Leif Lindholm

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