diff options
Diffstat (limited to 'scripts/ci/checkout-oe.sh')
-rwxr-xr-x | scripts/ci/checkout-oe.sh | 82 |
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 | |||
3 | set -euo pipefail | ||
4 | |||
5 | set -x | ||
6 | |||
7 | REMOTE_SOURCE=${REMOTE_SOURCE:-https://github.com/advancedtelematic} | ||
8 | MANIFEST=${MANIFEST:-master} | ||
9 | CURRENT_PROJECT=${CURRENT_PROJECT:-} | ||
10 | |||
11 | # list of projects to pin to one version in the format: | ||
12 | # "project:rev;project2:rev2..." | ||
13 | PIN_LIST=${PIN_LIST:-} | ||
14 | |||
15 | #CURRENT_REV=$(git rev-parse HEAD) | ||
16 | LOCAL_REPO=$PWD | ||
17 | |||
18 | mkdir -p updater-repo | ||
19 | |||
20 | cd updater-repo | ||
21 | |||
22 | # it seems like it's always required now, even if repo is only used to fetch | ||
23 | git config --global user.email "meta-updater-ci@example.org" | ||
24 | git config --global user.name "meta-updater-ci" | ||
25 | |||
26 | if [ -d .repo/manifests ]; then | ||
27 | git -C .repo/manifests reset --hard | ||
28 | fi | ||
29 | |||
30 | repo 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 | ||
35 | MANIFEST_FILE=".repo/manifests/${MANIFEST}.xml" | ||
36 | xmlstarlet 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 | ||
45 | sed -i 's#name="advancedtelematic/#name="#g' "$MANIFEST_FILE" | ||
46 | |||
47 | # pin projects from the list | ||
48 | ( | ||
49 | IFS=";" | ||
50 | for 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=";" | ||
59 | done | ||
60 | ) | ||
61 | |||
62 | # Remove the current project from the manifest if we have it checked out | ||
63 | if [ -n "$CURRENT_PROJECT" ]; then | ||
64 | xmlstarlet ed --omit-decl -L \ | ||
65 | -d "/manifest/project[@name=\"$CURRENT_PROJECT\"]" \ | ||
66 | "$MANIFEST_FILE" | ||
67 | fi | ||
68 | |||
69 | repo 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. | ||
73 | repo forall -c 'git reset --hard ; git clean -fdx' || true | ||
74 | |||
75 | repo sync -d --force-sync | ||
76 | |||
77 | if [ -n "$CURRENT_PROJECT" ]; then | ||
78 | rm -f "$CURRENT_PROJECT" | ||
79 | ln -s "$LOCAL_REPO" "$CURRENT_PROJECT" | ||
80 | fi | ||
81 | |||
82 | repo manifest -r | ||