summaryrefslogtreecommitdiff
path: root/tcwg_kernel-build.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-11-07 16:02:06 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-11-13 08:28:51 +0000
commitdd9fdad57aa4048c2a1e839d2101af25769c561f (patch)
treea40aeba5ccd32680d7f65fa4c95f4cff6bd97123 /tcwg_kernel-build.sh
parent950f62f3bfb1c2c0a3ac138a0ae6b1928c5ca569 (diff)
tcwg_kernel-build.sh: Fill in clone_repo and add git_init_linaro_local_remote
Change-Id: I36ed5078a80360c42ed6079ae98f76fa94354de7
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-xtcwg_kernel-build.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index 08e88736..ad0c4d24 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -123,8 +123,69 @@ reset_artifacts ()
)
}
+# Clone repository for $project
+# $1: Repo / project name
clone_repo ()
{
+ (
+ set -euf -o pipefail
+ local project="$1"
+
+ if [ x"$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
+ # uses baseline branch.
+ if [ x"$project" = x"$current_project" ]; then
+ if [ x"$current_rev" = x"default" ]; then
+ branch=${git_branch[$current_project]}
+ elif [ x"$current_rev" = x"baseline" ]; then
+ branch="refs/remotes/baseline/$baseline"
+ else
+ branch=$current_rev
+ fi
+ else
+ branch="refs/remotes/baseline/$baseline"
+ fi
+
+ local dir=${git_dirs[$project]}
+
+ # Decide on whether to use read-only or read-write mode for
+ # refs/remotes/baseline. We use read-only wherever possible to allow
+ # 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"
+ fi
+
+ # Clone origin remote
+ clone_or_update_repo_no_checkout $dir ${git_repo[$project]} auto > /dev/null
+ # Add baseline remote
+ git_init_linaro_local_remote $dir baseline $read_only
+ # Checkout, now that we have both origin and baseline remotes ready.
+ clone_or_update_repo $dir $branch ${git_repo[$project]} > /dev/null
+
+ cd $dir
+
+ git rev-parse HEAD > $run_step_artifacts/revision
+ if [ x"$project" = x"$current_project" ]; then
+ baseline_rev=$(git rev-parse refs/remotes/baseline/$baseline)
+ bad_rev=$(git rev-parse HEAD)
+ # Prepare for failure. If build fails we will bisect sha1 for
+ # $current_rev and sha1 for $baseline_rev.
+ cat > $top_artifacts/trigger-bisect-on-failure <<EOF
+current_project=$current_project
+baseline_rev=$baseline_rev
+bad_rev=$bad_rev
+EOF
+ git rev-list --count HEAD ^$baseline_rev > $top_artifacts/distance-to-baseline
+ fi
+ )
}
prepare_abe ()