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.sh46
1 files changed, 37 insertions, 9 deletions
diff --git a/util/update_chibios_mirror.sh b/util/update_chibios_mirror.sh
index 3df689f54..d4593a843 100755
--- a/util/update_chibios_mirror.sh
+++ b/util/update_chibios_mirror.sh
@@ -3,11 +3,14 @@
3################################ 3################################
4# Configuration 4# Configuration
5 5
6# The branches to mirror 6# The ChibiOS branches to mirror
7branches="trunk stable_20.3.x stable_21.6.x" 7chibios_branches="trunk stable_20.3.x stable_21.6.x"
8 8
9# The tags to mirror 9# The ChibiOS tags to mirror
10tags="ver19.1.3 ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" 10chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0"
11
12# The ChibiOS-Contrib branches to mirror
13contrib_branches="master chibios-20.3.x"
11 14
12################################ 15################################
13# Actions 16# Actions
@@ -19,9 +22,12 @@ this_script="$(realpath "${BASH_SOURCE[0]}")"
19script_dir="$(realpath "$(dirname "$this_script")")" 22script_dir="$(realpath "$(dirname "$this_script")")"
20qmk_firmware_dir="$(realpath "$script_dir/../")" 23qmk_firmware_dir="$(realpath "$script_dir/../")"
21chibios_dir="$qmk_firmware_dir/lib/chibios" 24chibios_dir="$qmk_firmware_dir/lib/chibios"
25contrib_dir="$qmk_firmware_dir/lib/chibios-contrib"
22 26
23chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')") 27chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')")
24chibios_git_config=$(realpath "$chibios_git_location/config") 28chibios_git_config=$(realpath "$chibios_git_location/config")
29contrib_git_location=$(realpath "$contrib_dir/$(cat "$contrib_dir/.git" | awk '/gitdir:/ {print $2}')")
30contrib_git_config=$(realpath "$contrib_git_location/config")
25 31
26cd "$chibios_dir" 32cd "$chibios_dir"
27 33
@@ -40,16 +46,38 @@ git fetch --all --tags --prune
40echo "Fetching latest from subversion..." 46echo "Fetching latest from subversion..."
41git svn fetch 47git svn fetch
42 48
43echo "Updating branches..." 49echo "Updating ChibiOS branches..."
44for branch in $branches ; do 50for branch in $chibios_branches ; do
45 echo "Creating branch 'svn-mirror/$branch' from 'svn/$branch'..." 51 echo "Creating branch 'svn-mirror/$branch' from 'svn/$branch'..."
46 git branch -f svn-mirror/$branch svn/$branch \ 52 git branch -f svn-mirror/$branch svn/$branch \
47 && git push qmk svn-mirror/$branch 53 && git push qmk svn-mirror/$branch
48done 54done
49 55
50echo "Updating tags..." 56echo "Updating ChibiOS tags..."
51for tagname in $tags ; do 57for tagname in $chibios_tags ; do
52 echo "Creating tag 'svn-mirror/$tagname' from 'svn/tags/$tagname'..." 58 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 59 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 60 git push qmk svn-mirror/$tagname
55done \ No newline at end of file 61done
62
63cd "$contrib_dir"
64
65if [[ -z "$(cat "$contrib_git_config" | grep '\[remote "qmk"\]')" ]] ; then
66 git remote add qmk git@github.com:qmk/ChibiOS-Contrib.git
67 git remote set-url qmk git@github.com:qmk/ChibiOS-Contrib.git --push
68fi
69
70if [[ -z "$(cat "$contrib_git_config" | grep '\[remote "upstream"\]')" ]] ; then
71 git remote add upstream git@github.com:ChibiOS/ChibiOS-Contrib.git
72 git remote set-url upstream git@github.com:ChibiOS/ChibiOS-Contrib.git --push
73fi
74
75echo "Updating remotes..."
76git fetch --all --tags --prune
77
78echo "Updating ChibiOS-Contrib branches..."
79for branch in $contrib_branches ; do
80 echo "Creating branch 'mirror/$branch' from 'upstream/$branch'..."
81 git branch -f mirror/$branch upstream/$branch \
82 && git push qmk mirror/$branch
83done