File: update.sh

package info (click to toggle)
giada 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,532 kB
  • sloc: cpp: 30,620; sh: 144; xml: 66; makefile: 55; ansic: 1
file content (62 lines) | stat: -rwxr-xr-x 1,106 bytes parent folder | download
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
#!/bin/sh

error() {
    echo "$*" 1>&2
}

usage() {
	cat >/dev/stderr <<EOF

usage: $0 <tag>

	updates the missing sources from the giada tarball

	this is done via a git checkout, so you must provide the
        git tag (or other ref).

	the Debian package version is "${pkgversion}"


EOF
exit $1
}

trytwice() {
    "$@" || (sleep 2 && "$@")
}

deps() {
	cat <<EOF
geompp
mcl-atomic-swapper
mcl-audio-buffer
mcl-utils
EOF
}

srcdir="$(cd "${0%/*}"; pwd)"
pkgdir="$(cd "${srcdir}/../.."; pwd)"
pkgversion="$(cd "${pkgdir}"; dpkg-parsechangelog -SVersion)"

workdir=$(mktemp -d)
#trap 'rm -rf "${workdir}"' EXIT INT TERM

tag="$1"

if [ -z "${tag}" ]; then
	usage 1
fi


trytwice git clone --revision="${tag}" --depth 1 https://github.com/monocasual/giada.git "${workdir}/giada"
trytwice git -C "${workdir}/giada" submodule update --init

deps | while read dep; do
    depdir="${srcdir}/${dep}"
    if ! test -d "${workdir}/giada/src/deps/${dep}/src"; then
        error "skipping ${dep}"
        continue
    fi
    rm -rf "${depdir}"
    cp -rav "${workdir}/giada/src/deps/${dep}/src" "${depdir}"
done