Skip to contentSkip to conversation

arch-run: Add reserved variables to the default environ

PATCH Superseded Andrew Jones 1 participant 2 messages Apr 4, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch-run: Add reserved variables to the default environ

Add the already reserved (see README) variables to the default environ. To do so neatly we rework the environ creation a bit too. mkstandalone also learns to honor config.mak as to whether or not to make environs, and we allow the $ERRATATXT file to be selected at configure time.

---
 configure               |  12 +++-
 scripts/arch-run.bash   | 120 ++++++++++++++++++++++++----------------
 scripts/mkstandalone.sh |   4 +-
 3 files changed, 86 insertions(+), 50 deletions(-)
configure +11 -1
index 579765165fdf..5e858899987c 100755
@@ -17,6 +17,7 @@ environ_default=yes
 u32_long=
 vmm="qemu"
 errata_force=0
+erratatxt="errata.txt"
 
 usage() {
     cat <<-EOF
@@ -37,6 +38,7 @@ usage() {
 	    --[enable|disable]-default-environ
 	                           enable or disable the generation of a default environ when
 	                           no environ is provided by the user (enabled by default)
+	    --erratatxt=FILE       specify a file to use instead of errata.txt
 EOF
     exit 1
 }
@@ -85,6 +87,9 @@ while [[ "$1" = -* ]]; do
 	--disable-default-environ)
 	    environ_default=no
 	    ;;
+	--erratatxt)
+	    erratatxt="$arg"
+	    ;;
 	--help)
 	    usage
 	    ;;
@@ -94,6 +99,11 @@ while [[ "$1" = -* ]]; do
     esac
 done
 
+if [ ! -f $erratatxt ]; then
+    echo "erratatxt: $erratatxt does not exist or is not a regular file"
+    exit 1
+fi
+
 arch_name=$arch
 [ "$arch" = "aarch64" ] && arch="arm64"
 [ "$arch_name" = "arm64" ] && arch_name="aarch64"
@@ -194,7 +204,7 @@ FIRMWARE=$firmware
 ENDIAN=$endian
 PRETTY_PRINT_STACKS=$pretty_print_stacks
 ENVIRON_DEFAULT=$environ_default
-ERRATATXT=errata.txt
+ERRATATXT=$erratatxt
 U32_LONG_FMT=$u32_long
 EOF
 
scripts/arch-run.bash +73 -47

157 lines not on this page · raw message

scripts/mkstandalone.sh +2 -2
index c1ecb7f99cdc..96158b015e78 100755
@@ -36,7 +36,7 @@ generate_test ()
 
 	echo "#!/usr/bin/env bash"
 	echo "export STANDALONE=yes"
-	echo "export ENVIRON_DEFAULT=yes"
+	echo "export ENVIRON_DEFAULT=$ENVIRON_DEFAULT"
 	echo "export HOST=\$(uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/')"
 	echo "export PRETTY_PRINT_STACKS=no"
 
@@ -59,7 +59,7 @@ generate_test ()
 		echo 'export FIRMWARE'
 	fi
 
-	if [ "$ERRATATXT" ]; then
+	if [ "$ENVIRON_DEFAULT" = "yes" ] && [ "$ERRATATXT" ]; then
 		temp_file ERRATATXT "$ERRATATXT"
 		echo 'export ERRATATXT'
 	fi
Signature · 1 line
2.25.1
#1 lore raw

On Sat, Apr 04, 2020 at 07:22:35PM +0200, Andrew Jones wrote:
...

Quoted 14 lines
scripts/mkstandalone.sh +1 -1
index c1ecb7f99cdc..96158b015e78 100755
@@ -36,7 +36,7 @@ generate_test ()
 
 	echo "#!/usr/bin/env bash"
 	echo "export STANDALONE=yes"
-	echo "export ENVIRON_DEFAULT=yes"
+	echo "export ENVIRON_DEFAULT=$ENVIRON_DEFAULT"
 	echo "export HOST=\$(uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/')"
 	echo "export PRETTY_PRINT_STACKS=no"
 

scripts/mkstandalone.sh generate_test () · line 62

Quoted 5 lines
scripts/mkstandalone.sh +1 -1
@@ -59,7 +59,7 @@ generate_test ()
 		echo 'export FIRMWARE'
 	fi
 
-	if [ "$ERRATATXT" ]; then
+	if [ "$ENVIRON_DEFAULT" = "yes" ] && [ "$ERRATATXT" ]; then

^ I should have added a -f here while touching it
I'll send a v2 with it after reviewers have a chance to look

Quoted 6 lines
scripts/mkstandalone.sh +0 -0
 		temp_file ERRATATXT "$ERRATATXT"
 		echo 'export ERRATATXT'
 	fi
Signature · 1 line
2.25.1