summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-12-24 16:26:14 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-01-11 11:22:59 +0000
commite0186558c066876c79be6617d2253b12ff39da0b (patch)
treef3c4432d072abe477b07234c937c8f13a0413834
parent224964cc7fe74d5edc279def3325cf7426df760f (diff)
jenkins-helpers.sh: Add "^^ true/false" switch to manifest handling
In tcwg_kernel-bisect.sh we need to call tcwg_kernel-build.sh with various options. We also generate manifest for each call so that we can reproduce /bisect/ runs. With current support we need to write something like this to handle reproductions of bisects: === if $reproduce_bisect; then ./tcwg_kernel-build.sh @@ /path/to/manifest.sh else ./tcwg_kernel-build.sh %% /path/to/manifest.sh --build options fi === which is cumbersome and obstructs script logic. This patch adds a "reproduction switch" -- "^^ true/false". When "^^ true %% manifest.sh --build options" it provided, then manifest.sh is sourced and all "--build options" are discarded to avoid changing build environment that manifest.sh sets up. When "^^ false %% manifest.sh --build options" is given, then manifest.sh is created and populated with "--build options". Change-Id: I38fcf37dc024891f5aa858dbd110082692dc09c9
-rw-r--r--jenkins-helpers.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 016b680b..db20f32e 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -652,7 +652,13 @@ manifest_out ()
# variables and arrays.
# "--var value" defines shell variable "$var" to "value".
# "++arr elem" defines shell array "$arr[@]" and adds "elem" to it.
-# "@@file" sources CONF_DIR/file, where CONF_DIR matches $0 with .sh stripped.
+# "@@ file" sources file.
+# "%% file" starts manifest in file. Also see "^^ true".
+# "^^ true/false %% manifest" whether to reproduce the build using manifest.
+# If "true" -- source manifest instead of generating it, then discard
+# all following options at to separator "--".
+# If "false" -- do nothing and proceed as usual.
+#
# Shell array $CONVERTED_ARGS is set to the arguments processed.
# Shell variable $SHIFT_CONVERTED_ARGS is set to number of arguments processed.
# $@: Pairs of def/val arguments, stops at "--" marker.
@@ -726,6 +732,29 @@ jenkins_scripts_rev=$(git_rev_parse $(dirname "$0") HEAD)
EOF
num=2
;;
+ "^^")
+ if [ x"$2" = x"true" ]; then
+ # Check that we have a manifest to reproduce
+ if [ x"$3" != x"%%" -o ! -f "$4" ]; then
+ echo "ERROR: '^^ true' must be followed by '%% <MANIFEST>'"
+ exit 1
+ fi
+
+ # Source the manifest for reproduction.
+ source "$4"
+
+ # Skip processing all following arguments.
+ num=0
+ for i in "$@"; do
+ if [ x"$i" = x"--" ]; then
+ break
+ fi
+ num=$(($num+1))
+ done
+ else
+ num=2
+ fi
+ ;;
*)
echo "ERROR: option does not start with '--' / '++' / '@@' / '%%' : $1"
exit 1