summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2021-08-06 16:40:12 +1000
committerGitHub <noreply@github.com>2021-08-06 16:40:12 +1000
commitf24bca5bb30c77fc8290a97ef38370a4fade7d2c (patch)
tree3b837e18623b4c9c642a5c5637c2dc86ac6f2ac7 /util
parent538d9d7890353b1766e647576c5cb1f5e9d147d3 (diff)
downloadqmk_firmware-f24bca5bb30c77fc8290a97ef38370a4fade7d2c.tar.gz
qmk_firmware-f24bca5bb30c77fc8290a97ef38370a4fade7d2c.zip
Update ChibiOS-Contrib, mirroring script. (#13896)
Diffstat (limited to 'util')
-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 3df689f54e..d4593a8432 100755
--- a/util/update_chibios_mirror.sh
+++ b/util/update_chibios_mirror.sh
@@ -3,11 +3,14 @@
################################
# Configuration
-# The branches to mirror
-branches="trunk stable_20.3.x stable_21.6.x"
+# The ChibiOS branches to mirror
+chibios_branches="trunk stable_20.3.x stable_21.6.x"
-# The tags to mirror
-tags="ver19.1.3 ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0"
+# The ChibiOS tags to mirror
+chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0"
+
+# The ChibiOS-Contrib branches to mirror
+contrib_branches="master chibios-20.3.x"
################################
# Actions
@@ -19,9 +22,12 @@ this_script="$(realpath "${BASH_SOURCE[0]}")"
script_dir="$(realpath "$(dirname "$this_script")")"
qmk_firmware_dir="$(realpath "$script_dir/../")"
chibios_dir="$qmk_firmware_dir/lib/chibios"
+contrib_dir="$qmk_firmware_dir/lib/chibios-contrib"
chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')")
chibios_git_config=$(realpath "$chibios_git_location/config")
+contrib_git_location=$(realpath "$contrib_dir/$(cat "$contrib_dir/.git" | awk '/gitdir:/ {print $2}')")
+contrib_git_config=$(realpath "$contrib_git_location/config")
cd "$chibios_dir"
@@ -40,16 +46,38 @@ git fetch --all --tags --prune
echo "Fetching latest from subversion..."
git svn fetch
-echo "Updating branches..."
-for branch in $branches ; do
+echo "Updating ChibiOS branches..."
+for branch in $chibios_branches ; do
echo "Creating branch 'svn-mirror/$branch' from 'svn/$branch'..."
git branch -f svn-mirror/$branch svn/$branch \
&& git push qmk svn-mirror/$branch
done
-echo "Updating tags..."
-for tagname in $tags ; do
+echo "Updating ChibiOS tags..."
+for tagname in $chibios_tags ; do
echo "Creating tag 'svn-mirror/$tagname' from 'svn/tags/$tagname'..."
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
git push qmk svn-mirror/$tagname
-done \ No newline at end of file
+done
+
+cd "$contrib_dir"
+
+if [[ -z "$(cat "$contrib_git_config" | grep '\[remote "qmk"\]')" ]] ; then
+ git remote add qmk git@github.com:qmk/ChibiOS-Contrib.git
+ git remote set-url qmk git@github.com:qmk/ChibiOS-Contrib.git --push
+fi
+
+if [[ -z "$(cat "$contrib_git_config" | grep '\[remote "upstream"\]')" ]] ; then
+ git remote add upstream git@github.com:ChibiOS/ChibiOS-Contrib.git
+ git remote set-url upstream git@github.com:ChibiOS/ChibiOS-Contrib.git --push
+fi
+
+echo "Updating remotes..."
+git fetch --all --tags --prune
+
+echo "Updating ChibiOS-Contrib branches..."
+for branch in $contrib_branches ; do
+ echo "Creating branch 'mirror/$branch' from 'upstream/$branch'..."
+ git branch -f mirror/$branch upstream/$branch \
+ && git push qmk mirror/$branch
+done