File: get-orig-source.sh

package info (click to toggle)
pd-mrpeach 0.1~svn17672-9
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,208 kB
  • sloc: ansic: 18,192; makefile: 1,189; sh: 214; cpp: 19
file content (48 lines) | stat: -rwxr-xr-x 1,518 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

pkg=mrpeach
version=$1

# ${version} could be:
# - empty (""): get current SVN
# - a revision ("17615"): get named revision
# - a full version ("0.1~svn17615"): extract revision and get that
if [ "x${version}" != "x" ]; then
    revision=${version##*svn}
    revision=${revision%%-*}
    version=${version%svn*}
    version=${version%~}
fi
if [ "x${revision}" = "x" ]; then
    revision=$(curl "https://sourceforge.net/p/pure-data/svn/HEAD/log/?path=/trunk/externals/${pkg}" 2>/dev/null\
                     | grep "/tree/trunk/externals/${pkg}" \
                     | sed -e 's|.*/svn/\([0-9]*\)/tree/trunk/externals/.*|\1|' \
                     | sort -n \
                     | tail -1)
fi

echo "revision: ${revision}"

tempdir=$(mktemp -d)
echo "tempdir ${tempdir}"
pkgdir="${tempdir}/${pkg}-${revision}"

## clone revision
svn export "https://svn.code.sf.net/p/pure-data/svn/trunk/externals/${pkg}@${revision}" "${tempdir}/${pkg}"

if [ "x${version}" = "x" ]; then
    version=$(sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' ${tempdir}/${pkg}/${pkg}-meta.pd)
fi

echo "version: ${version}"
if [  -d "${tempdir}/${pkg}" ]; then
    outfile="../${pkg}-${version}~svn${revision}.tar.gz"
    tar czf "${outfile}" -C "${tempdir}" "${pkg}"
fi

rm -rf "${tempdir}"

if [ "x${outfile}" != "x" ]; then
 echo "To import the new upstream version run something like: gbp import-orig ${outfile}"
 echo "To update the upstream changelog, please run: debian/mk-changelog.sh ${revision}"
fi