summaryrefslogtreecommitdiffstats
path: root/scripts/ci/checkout-oe.sh
blob: 9a4ade2e5051d0a631832cd982504e66b718b85d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash

set -euo pipefail

set -x

REMOTE_SOURCE=${REMOTE_SOURCE:-https://github.com/advancedtelematic}
MANIFEST=${MANIFEST:-master}
CURRENT_PROJECT=${CURRENT_PROJECT:-meta-updater}

#CURRENT_REV=$(git rev-parse HEAD)
LOCAL_REPO=$PWD

mkdir -p updater-repo

cd updater-repo

repo init -m "${MANIFEST}.xml" -u "$REMOTE_SOURCE/updater-repo"

git -C .repo/manifests reset --hard

# patch manifest
MANIFEST_FILE=".repo/manifests/${MANIFEST}.xml"
xmlstarlet ed --omit-decl -L \
    -s "/manifest" -t elem -n "remote" -v "" \
    -i "/manifest/remote[last()]" -t attr -n "name" -v "ats" \
    -i "/manifest/remote[last()]" -t attr -n "fetch" -v "$REMOTE_SOURCE" \
    -u "/manifest/project[contains(@name, 'advancedtelematic')]/@remote" -v "ats" \
    -d "/manifest/project[@path=\"$CURRENT_PROJECT\"]" \
    "$MANIFEST_FILE"

# hack: sed on `advancedtelematic/` names
sed -i 's#name="advancedtelematic/#name="#g' "$MANIFEST_FILE"

repo manifest

repo forall -c 'git reset --hard ; git clean -fdx'

repo sync -d --force-sync

rm -f "$CURRENT_PROJECT"
ln -s "$LOCAL_REPO" "$CURRENT_PROJECT"

repo manifest -r