diff options
Diffstat (limited to 'util/update_chibios_mirror.sh')
-rwxr-xr-x | util/update_chibios_mirror.sh | 46 |
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 |
7 | branches="trunk stable_20.3.x stable_21.6.x" | 7 | chibios_branches="trunk stable_20.3.x stable_21.6.x" |
8 | 8 | ||
9 | # The tags to mirror | 9 | # The ChibiOS tags to mirror |
10 | tags="ver19.1.3 ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" | 10 | chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" |
11 | |||
12 | # The ChibiOS-Contrib branches to mirror | ||
13 | contrib_branches="master chibios-20.3.x" | ||
11 | 14 | ||
12 | ################################ | 15 | ################################ |
13 | # Actions | 16 | # Actions |
@@ -19,9 +22,12 @@ this_script="$(realpath "${BASH_SOURCE[0]}")" | |||
19 | script_dir="$(realpath "$(dirname "$this_script")")" | 22 | script_dir="$(realpath "$(dirname "$this_script")")" |
20 | qmk_firmware_dir="$(realpath "$script_dir/../")" | 23 | qmk_firmware_dir="$(realpath "$script_dir/../")" |
21 | chibios_dir="$qmk_firmware_dir/lib/chibios" | 24 | chibios_dir="$qmk_firmware_dir/lib/chibios" |
25 | contrib_dir="$qmk_firmware_dir/lib/chibios-contrib" | ||
22 | 26 | ||
23 | chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')") | 27 | chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')") |
24 | chibios_git_config=$(realpath "$chibios_git_location/config") | 28 | chibios_git_config=$(realpath "$chibios_git_location/config") |
29 | contrib_git_location=$(realpath "$contrib_dir/$(cat "$contrib_dir/.git" | awk '/gitdir:/ {print $2}')") | ||
30 | contrib_git_config=$(realpath "$contrib_git_location/config") | ||
25 | 31 | ||
26 | cd "$chibios_dir" | 32 | cd "$chibios_dir" |
27 | 33 | ||
@@ -40,16 +46,38 @@ git fetch --all --tags --prune | |||
40 | echo "Fetching latest from subversion..." | 46 | echo "Fetching latest from subversion..." |
41 | git svn fetch | 47 | git svn fetch |
42 | 48 | ||
43 | echo "Updating branches..." | 49 | echo "Updating ChibiOS branches..." |
44 | for branch in $branches ; do | 50 | for 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 |
48 | done | 54 | done |
49 | 55 | ||
50 | echo "Updating tags..." | 56 | echo "Updating ChibiOS tags..." |
51 | for tagname in $tags ; do | 57 | for 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 |
55 | done \ No newline at end of file | 61 | done |
62 | |||
63 | cd "$contrib_dir" | ||
64 | |||
65 | if [[ -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 | ||
68 | fi | ||
69 | |||
70 | if [[ -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 | ||
73 | fi | ||
74 | |||
75 | echo "Updating remotes..." | ||
76 | git fetch --all --tags --prune | ||
77 | |||
78 | echo "Updating ChibiOS-Contrib branches..." | ||
79 | for 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 | ||
83 | done | ||