summaryrefslogtreecommitdiffstats
path: root/scripts/ci/checkout-oe.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ci/checkout-oe.sh')
-rwxr-xr-xscripts/ci/checkout-oe.sh82
1 files changed, 0 insertions, 82 deletions
diff --git a/scripts/ci/checkout-oe.sh b/scripts/ci/checkout-oe.sh
deleted file mode 100755
index ed74595..0000000
--- a/scripts/ci/checkout-oe.sh
+++ /dev/null
@@ -1,82 +0,0 @@
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5set -x
6
7REMOTE_SOURCE=${REMOTE_SOURCE:-https://github.com/advancedtelematic}
8MANIFEST=${MANIFEST:-master}
9CURRENT_PROJECT=${CURRENT_PROJECT:-}
10
11# list of projects to pin to one version in the format:
12# "project:rev;project2:rev2..."
13PIN_LIST=${PIN_LIST:-}
14
15#CURRENT_REV=$(git rev-parse HEAD)
16LOCAL_REPO=$PWD
17
18mkdir -p updater-repo
19
20cd updater-repo
21
22# it seems like it's always required now, even if repo is only used to fetch
23git config --global user.email "meta-updater-ci@example.org"
24git config --global user.name "meta-updater-ci"
25
26if [ -d .repo/manifests ]; then
27 git -C .repo/manifests reset --hard
28fi
29
30repo init -m "${MANIFEST}.xml" -u "$REMOTE_SOURCE/updater-repo"
31
32# patch manifest:
33# - add a new "ats" remote that points to "$REMOTE_SOURCE"
34# - change projects that contain "advancedtelematic" to use the ats remote
35MANIFEST_FILE=".repo/manifests/${MANIFEST}.xml"
36xmlstarlet ed --omit-decl -L \
37 -s "/manifest" -t elem -n "remote" -v "" \
38 -i "/manifest/remote[last()]" -t attr -n "name" -v "ats" \
39 -i "/manifest/remote[last()]" -t attr -n "fetch" -v "$REMOTE_SOURCE" \
40 -d "/manifest/project[contains(@name, 'advancedtelematic')]/@remote" \
41 -i "/manifest/project[contains(@name, 'advancedtelematic')]" -t attr -n "remote" -v "ats" \
42 "$MANIFEST_FILE"
43
44# hack: sed on `advancedtelematic/` names, to remove this unwanted prefix
45sed -i 's#name="advancedtelematic/#name="#g' "$MANIFEST_FILE"
46
47# pin projects from the list
48(
49IFS=";"
50for pin in $PIN_LIST; do
51 IFS=":"
52 read -r project rev <<< "$pin"
53 xmlstarlet ed --omit-decl -L \
54 -d "/manifest/project[@name=\"$project\"]/@revision" \
55 -i "/manifest/project[@name=\"$project\"]/@revision" -t attr -n "revision" -v "$rev" \
56 -i "/manifest/project[@name=\"$project\"]" -t attr -n "revision" -v "$rev" \
57 "$MANIFEST_FILE"
58 IFS=";"
59done
60)
61
62# Remove the current project from the manifest if we have it checked out
63if [ -n "$CURRENT_PROJECT" ]; then
64 xmlstarlet ed --omit-decl -L \
65 -d "/manifest/project[@name=\"$CURRENT_PROJECT\"]" \
66 "$MANIFEST_FILE"
67fi
68
69repo manifest
70
71# Try to clean up the repos in case they are messed up, but this returns an
72# error code if the repos don't exist, which the subsequent repo sync will fix.
73repo forall -c 'git reset --hard ; git clean -fdx' || true
74
75repo sync -d --force-sync
76
77if [ -n "$CURRENT_PROJECT" ]; then
78 rm -f "$CURRENT_PROJECT"
79 ln -s "$LOCAL_REPO" "$CURRENT_PROJECT"
80fi
81
82repo manifest -r