forked from mpv-player/mpv-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·139 lines (122 loc) · 2.54 KB
/
update
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh
do_clone()
{
set -ex
if ! test -e "$1" ; then
git clone "$2" "$1"
fi
(
cd "$1"
git remote set-url origin "$2"
git fetch
)
}
do_clone_all()
{
do_clone "ffmpeg" "https://github.com/FFmpeg/FFmpeg.git"
do_clone "fribidi" "http://anongit.freedesktop.org/git/fribidi/fribidi.git"
do_clone "libass" "https://github.com/libass/libass.git"
do_clone "mpv" "https://github.com/mpv-player/mpv.git"
}
do_gitmaster()
{
set -ex
(
cd "$1"
git checkout --detach origin/master
git remote prune origin
)
}
versort_with_prefix()
{
# Emulate sort -V using a known prefix. Filter out anything else.
sed -n -e "s/^$1\([0-9]\)/\\1/p" |\
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 |\
sed -e "s/^/$1/"
# GNU version of the same:
# grep "^$2[0-9]" | sort -V
}
do_releasetag()
{
(
cd "$1"
version=`git tag | grep -v rc | versort_with_prefix "$2" | tail -n 1`
git checkout --detach refs/tags/"$version"
)
}
do_fixedref()
{
(
cd "$1"
git checkout --detach "$2"
)
}
checkout_ffmpeg=do_releasetag
checkout_fribidi=do_releasetag
checkout_libass=do_gitmaster
checkout_mpv=do_releasetag
checkout_all()
{
set -ex
do_clone_all
$checkout_ffmpeg ffmpeg 'n'
$checkout_fribidi fribidi ''
$checkout_libass libass
$checkout_mpv mpv 'v'
}
do_bootstrap()
{
scripts/mpv-bootstrap
}
do_update_debian_versions()
{
scripts/debian-update-versions $1
}
if [ x"$1" != x"--skip-selfupdate" ]; then
(
set -ex
git pull --rebase
)
exec "$0" --skip-selfupdate "$@"
fi
shift
select_branch()
{
if [ -d config/ ] && [ -f config/"branch-$1" ]; then
case `cat config/"branch-$1"` in
master)
echo do_gitmaster
;;
*)
# "release" is the defined value; but default anything else to it
echo do_releasetag
;;
esac
else
echo "$2"
fi
}
checkout_ffmpeg=`select_branch ffmpeg $checkout_ffmpeg`
checkout_mpv=`select_branch mpv $checkout_mpv`
case "$1" in
--master)
checkout_ffmpeg=do_gitmaster
checkout_fribidi=do_gitmaster
checkout_libass=do_gitmaster
checkout_mpv=do_gitmaster
;;
--release)
checkout_ffmpeg=do_releasetag
checkout_mpv=do_releasetag
;;
'')
;;
*)
echo >&2 "$0 --master"
echo >&2 "$0 --release"
exit 0
;;
esac
checkout_all
do_update_debian_versions
do_bootstrap