summaryrefslogtreecommitdiff
path: root/tcwg_kernel-build.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-12-11 13:59:52 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-12-12 09:44:22 +0000
commit80a6ec676e8e41ed679c2bed471f2c1500ca788c (patch)
tree0161347344b9fe8a3f12f1cd53773c95fb0ee512 /tcwg_kernel-build.sh
parent72cc72574129d4298bb8e0c59dd9652ff8ddf491 (diff)
tcwg_kernel-build.sh: Make reset_artifacts depend only on ${rr[]}
Rename rr[current_project]="$current_project" rr[current_rev]="$current_rev" rr[git_read_only]="$git_read_only" rr[mode]="$mode" Change-Id: I6bb6a946f9a78d5ae89456b1b7345f020de9734a
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-xtcwg_kernel-build.sh41
1 files changed, 24 insertions, 17 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index 4a9d7beb..72ac4c88 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -98,6 +98,11 @@ fi
run_step_init "$start_at" "$finish_at" "${rr[top_artifacts]}" "$base_artifacts_opt" "$verbose"
+rr[current_project]="$current_project"
+rr[current_rev]="$current_rev"
+rr[git_read_only]="$git_read_only"
+rr[mode]="$mode"
+
# Reset artifacts to an empty state. ${rr[top_artifacts]}/results is the most
# important artifact, since it records the metric of how successful the build
# is.
@@ -136,22 +141,22 @@ clone_repo ()
set -euf -o pipefail
local project="$1"
- if [ x"$mode" = x"bisect" ]; then
+ if [ x"${rr[mode]}" = x"bisect" ]; then
# Don't touch anything in bisect mode.
return 0
fi
local branch
# Select the branch to build.
- # $current_rev specifies branch for $current_project, and everything else
+ # ${rr[current_rev]} specifies branch for ${rr[current_project]}, and everything else
# uses baseline branch.
- if [ x"$project" = x"$current_project" ]; then
- if [ x"$current_rev" = x"default" ]; then
+ if [ x"$project" = x"${rr[current_project]}" ]; then
+ if [ x"${rr[current_rev]}" = x"default" ]; then
branch=${rr[${current_project}_rev]}
- elif [ x"$current_rev" = x"baseline" ]; then
+ elif [ x"${rr[current_rev]}" = x"baseline" ]; then
branch="refs/remotes/baseline/${rr[baseline_branch]}"
else
- branch=$current_rev
+ branch=${rr[current_rev]}
fi
else
branch="refs/remotes/baseline/${rr[baseline_branch]}"
@@ -162,8 +167,8 @@ clone_repo ()
# developers without ssh keys on Linaro git servers to reproduce builds
# in --mode "baseline".
local read_only="true"
- if [ x"$project" = x"$current_project" ]; then
- read_only="$git_read_only"
+ if [ x"$project" = x"${rr[current_project]}" ]; then
+ read_only="${rr[git_read_only]}"
fi
# Clone origin remote
@@ -176,13 +181,15 @@ clone_repo ()
cd $project
git rev-parse HEAD > $run_step_artifacts/revision
- if [ x"$project" = x"$current_project" ]; then
+ if [ x"$project" = x"${rr[current_project]}" ]; then
+ local baseline_rev bad_rev
+
baseline_rev=$(git rev-parse refs/remotes/baseline/${rr[baseline_branch]})
bad_rev=$(git rev-parse HEAD)
# Prepare for failure. If build fails we will bisect sha1 for
- # $current_rev and sha1 for $baseline_rev.
+ # ${rr[current_rev]} and sha1 for $baseline_rev.
cat > ${rr[top_artifacts]}/trigger-bisect-on-failure <<EOF
-current_project=$current_project
+current_project=${rr[current_project]}
baseline_rev=$baseline_rev
bad_rev=$bad_rev
EOF
@@ -424,7 +431,7 @@ build_linux ()
# Use ccache only when bisecting linux. Otherwise the compiler is
# new in every build and we would only clobber ccache volume.
local ccache=""
- if [ x"$mode" = x"bisect" -a x"$current_project" = x"linux" ]; then
+ if [ x"${rr[mode]}" = x"bisect" -a x"${rr[current_project]}" = x"linux" ]; then
ccache="ccache"
fi
cat > $(pwd)/bin/$target-cc <<EOF
@@ -573,27 +580,27 @@ update_baseline ()
# in base-artifacts.git repo.
rsync -a --del --exclude /.git ${rr[top_artifacts]}/ base-artifacts/
- build_rev=$(git -C $current_project rev-parse HEAD)
+ build_rev=$(git -C ${rr[current_project]} rev-parse HEAD)
cd base-artifacts
git add .
- git commit $amend -m "$current_project-$build_rev: $(tail -n1 ${rr[top_artifacts]}/results)
+ git commit $amend -m "${rr[current_project]}-$build_rev: $(tail -n1 ${rr[top_artifacts]}/results)
$(cat ${rr[top_artifacts]}/results)"
)
}
-# Push to $current_project baseline branch and to base-artifacts repo.
+# Push to ${rr[current_project]} baseline branch and to base-artifacts repo.
push_baseline ()
{
(
set -euf -o pipefail
- assert ! $git_read_only
+ assert ! ${rr[git_read_only]}
git_init_linaro_local_remote base-artifacts baseline false
git_push base-artifacts baseline ${rr[baseline_branch]}
- git_push $current_project baseline ${rr[baseline_branch]}
+ git_push ${rr[current_project]} baseline ${rr[baseline_branch]}
)
}