aboutsummaryrefslogtreecommitdiff
path: root/util/update_chibios_mirror.sh
diff options
context:
space:
mode:
Diffstat (limited to 'util/update_chibios_mirror.sh')
-rwxr-xr-xutil/update_chibios_mirror.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/util/update_chibios_mirror.sh b/util/update_chibios_mirror.sh
new file mode 100755
index 000000000..3df689f54
--- /dev/null
+++ b/util/update_chibios_mirror.sh
@@ -0,0 +1,55 @@
1#!/bin/bash
2
3################################
4# Configuration
5
6# The branches to mirror
7branches="trunk stable_20.3.x stable_21.6.x"
8
9# The tags to mirror
10tags="ver19.1.3 ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0"
11
12################################
13# Actions
14
15set -eEuo pipefail
16umask 022
17
18this_script="$(realpath "${BASH_SOURCE[0]}")"
19script_dir="$(realpath "$(dirname "$this_script")")"
20qmk_firmware_dir="$(realpath "$script_dir/../")"
21chibios_dir="$qmk_firmware_dir/lib/chibios"
22
23chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')")
24chibios_git_config=$(realpath "$chibios_git_location/config")
25
26cd "$chibios_dir"
27
28if [[ -z "$(cat "$chibios_git_config" | grep '\[svn-remote "svn"\]')" ]] ; then
29 git svn init --stdlayout --prefix='svn/' http://svn.osdn.net/svnroot/chibios/
30fi
31
32if [[ -z "$(cat "$chibios_git_config" | grep '\[remote "qmk"\]')" ]] ; then
33 git remote add qmk git@github.com:qmk/ChibiOS.git
34 git remote set-url qmk git@github.com:qmk/ChibiOS.git --push
35fi
36
37echo "Updating remotes..."
38git fetch --all --tags --prune
39
40echo "Fetching latest from subversion..."
41git svn fetch
42
43echo "Updating branches..."
44for branch in $branches ; do
45 echo "Creating branch 'svn-mirror/$branch' from 'svn/$branch'..."
46 git branch -f svn-mirror/$branch svn/$branch \
47 && git push qmk svn-mirror/$branch
48done
49
50echo "Updating tags..."
51for tagname in $tags ; do
52 echo "Creating tag 'svn-mirror/$tagname' from 'svn/tags/$tagname'..."
53 GIT_COMMITTER_DATE="$(git log -n1 --pretty=format:'%ad' svn/tags/$tagname)" git tag -f -a -m "Tagging $tagname" svn-mirror/$tagname svn/tags/$tagname
54 git push qmk svn-mirror/$tagname
55done \ No newline at end of file