File: get-orig-source.sh

package info (click to toggle)
g3dviewer 0.2.99.5~svn130-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,236 kB
  • sloc: sh: 10,366; ansic: 2,446; makefile: 134; xml: 75
file content (29 lines) | stat: -rwxr-xr-x 883 bytes parent folder | download | duplicates (4)
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
#! /bin/sh
set -e

if [ -z "$DIR" ]; then
	DIR=g3dviewer
fi

# try to download source package
if [ "$1" != "snapshot" ]; then
	uscan --verbose --force-download
else
	umask 000
	TMP="`mktemp -t -d`"
	MANIFEST="`mktemp -t`"
	R="$(svn info "svn://svn.gna.org/svn/${DIR}/trunk"|grep '^Revision'| sed 's/^Revision: //')"
	VERSION=$(dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p' | sed -e 's/[\+~]svn.*$//')
	REV="${VERSION}+svn${R}"
	svn export -r"${R}" "svn://svn.gna.org/svn/${DIR}/trunk" "${TMP}/${DIR}-${REV}/"
	rm -rf "${TMP}/${DIR}-${REV}/debian"
	TARNAME="${DIR}_${REV}.orig.tar"
	(
		cd "${TMP}"
		find "${DIR}-${REV}/" -type f |sed 's/^\.*\/*//'|sort > "$MANIFEST"
		tar cf "${TARNAME}" --owner 0 --group 0 --numeric-owner --no-recursion --files-from "$MANIFEST"
	)
	mv "${TMP}/${TARNAME}" .
	gzip -n -f "${TARNAME}"
	rm -rf "${TMP}" "$MANIFEST"
fi