-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsyncmirror
106 lines (92 loc) · 2.67 KB
/
syncmirror
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
tag=$1
deltag=$2
# needed to avoid issues with authentification
git config --unset-all http.https://github.com/.extraheader
# set identity for tagging
git config --global user.email "[email protected]"
git config --global user.name "A Dedner"
syncmodule()
{
set +e
m=$1 # module name (name)
p=$2 # module path (dune-project's gitlab)
# first checkout the current version of the git repo this will make it
# possible to later push the tags generated on github which are lost
# during the mirroring process:
git clone https://user:[email protected]/adedner/$m gh$m
# now clone the original
git clone --mirror $p $m
cd $m
if [ "$m" = "dune-alugrid" ] ; then
echo "running bfg.jar..."
# this rewrites the history of dune-alugrid to exclude some '*.out'
# files which are too large. Note that every commit hash changes but
# the origin is stored in the new log message
cd ..
java -jar bfg.jar --strip-blobs-bigger-than 90M $m >& /dev/null
cd $m
git reflog expire --expire=now --all && git gc --prune=now --aggressive
fi
# mirror to github and remove original repo
git push --mirror https://user:[email protected]/adedner/$m
cd ..
rm -rf $m
if [ "$tag" = "automatic" ] ; then
cd gh$m
git checkout master
# first push the older tags
git push --tags
# possibly remove a tag
if [ ! -z $deltag ] ; then
git push origin :refs/tags/$deltag
fi
# get the new data from the mirror step
git fetch
git pull
# generate the new tag and push it
git tag -a $tag -m "from github action"
git push origin $tag
cd ..
fi
# remove gh repo
rm -rf gh$m
}
base="https://gitlab.dune-project.org"
coreurl="$base/core"
femurl="$base/dune-fem"
exturl="$base/extensions"
declare -A coremodules
coremodules+=(
[dune-common]='dune-common.git'
[dune-geometry]='dune-geometry.git'
[dune-grid]='dune-grid.git'
[dune-istl]='dune-istl.git'
[dune-localfunctions]='dune-localfunctions.git'
)
declare -A femmodules
femmodules=(
[dune-fem]='dune-fem.git'
[dune-fem-dg]='dune-fem-dg.git'
[dune-vem]='dune-vem.git'
)
declare -A extramodules
extramodules=(
[dune-alugrid]='dune-alugrid.git'
[dune-polygongrid]='dune-polygongrid.git'
[dune-spgrid]='dune-spgrid.git'
)
echo "Syncing core modules and tagging with $tag"
for m in "${!coremodules[@]}" ; do
p="${coremodules[$m]}"
syncmodule $m "$coreurl/$p"
done
echo "Syncing fem modules and tagging with $tag"
for m in "${!femmodules[@]}" ; do
p="${femmodules[$m]}"
syncmodule $m "$femurl/$p"
done
echo "Syncing extension modules and tagging with $tag"
for m in "${!extramodules[@]}" ; do
p="${extramodules[$m]}"
syncmodule $m "$exturl/$p"
done