File: get-orig-source.sh

package info (click to toggle)
mupen64plus-input-sdl 1.99.5-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 396 kB
  • sloc: ansic: 1,503; makefile: 250; sh: 22
file content (26 lines) | stat: -rwxr-xr-x 818 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
#! /bin/sh
set -e

if [ -z "$DIR" ]; then
	DIR=mupen64plus-input-sdl
fi
if [ -z "$OWNER" ]; then
	OWNER=richard42
fi

# try to download source package
if [ "$1" != "snapshot" ]; then
	uscan --verbose --force-download
else
	MODULE="${OWNER}/${DIR}"
	TMP="`mktemp -t -d`"
	hg clone --noupdate "http://bitbucket.org/${MODULE}" "${TMP}"
	REV="`hg --repository "${TMP}" log -r tip --template '{latesttag}+{latesttagdistance}+{node|short}\n'`"
	LONGREV="`hg --repository "${TMP}" log -r tip --template '{node}\n'`"
	TARNAME="${DIR}_${REV}.orig.tar"
	echo "${LONGREV}"
	EXCLUDE="--exclude ${TMP}/.hgtags --exclude ${TMP}/.hg_archival.txt --exclude ${TMP}/.hgignore"
	hg --repository "${TMP}" archive --no-decode --type tar --prefix "${DIR}-${REV}/" ${EXCLUDE} -r tip "${TARNAME}"
	gzip -n -f "${TARNAME}"
	rm -rf "${TMP}"
fi