diff options
Diffstat (limited to 'util/update_chibios_mirror.sh')
-rwxr-xr-x | util/update_chibios_mirror.sh | 55 |
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 | ||
7 | branches="trunk stable_20.3.x stable_21.6.x" | ||
8 | |||
9 | # The tags to mirror | ||
10 | tags="ver19.1.3 ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" | ||
11 | |||
12 | ################################ | ||
13 | # Actions | ||
14 | |||
15 | set -eEuo pipefail | ||
16 | umask 022 | ||
17 | |||
18 | this_script="$(realpath "${BASH_SOURCE[0]}")" | ||
19 | script_dir="$(realpath "$(dirname "$this_script")")" | ||
20 | qmk_firmware_dir="$(realpath "$script_dir/../")" | ||
21 | chibios_dir="$qmk_firmware_dir/lib/chibios" | ||
22 | |||
23 | chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')") | ||
24 | chibios_git_config=$(realpath "$chibios_git_location/config") | ||
25 | |||
26 | cd "$chibios_dir" | ||
27 | |||
28 | if [[ -z "$(cat "$chibios_git_config" | grep '\[svn-remote "svn"\]')" ]] ; then | ||
29 | git svn init --stdlayout --prefix='svn/' http://svn.osdn.net/svnroot/chibios/ | ||
30 | fi | ||
31 | |||
32 | if [[ -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 | ||
35 | fi | ||
36 | |||
37 | echo "Updating remotes..." | ||
38 | git fetch --all --tags --prune | ||
39 | |||
40 | echo "Fetching latest from subversion..." | ||
41 | git svn fetch | ||
42 | |||
43 | echo "Updating branches..." | ||
44 | for 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 | ||
48 | done | ||
49 | |||
50 | echo "Updating tags..." | ||
51 | for 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 | ||
55 | done \ No newline at end of file | ||