diff options
Diffstat (limited to 'debian/get-hg-version')
-rwxr-xr-x | debian/get-hg-version | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/debian/get-hg-version b/debian/get-hg-version new file mode 100755 index 0000000..4e3f60e --- /dev/null +++ b/debian/get-hg-version @@ -0,0 +1,40 @@ +#!/bin/bash + +# This script is called by uscan(1) as: +# get-hg-version --upstream-version <version> + +# We create a temporary directory, clone the upstream repository into it, +# check out the current upstream version, tar this directory, and then +# copy it to the parent directory in place of the existing downloaded +# .orig.tar.gz file. + +# set -e + +if [ "$1" != "--upstream-version" ] +then + echo "Script called with unexpected arguments: $*" >&2 + echo "Expected $0 --upstream-version <uversion>" >&2 + exit 1 +fi + +PWD=$(pwd) +cd .. +PPWD=$(pwd) +TMP=$(mktemp -d) +trap "rm -rf '$TMP'" INT QUIT TERM EXIT + +uversion=$2 +cd "$TMP" + +hg clone http://hg.code.sf.net/p/ruamel-yaml/code ruamel.yaml-$uversion +cd ruamel.yaml-$uversion +hg update $uversion +cd .. +tar Jcpf ruamel.yaml_$uversion.orig.tar.xz --exclude=.hg ruamel.yaml-$uversion +rm -f "$PPWD"/ruamel.yaml_$uversion.orig.tar.gz +mv ruamel.yaml_$uversion.orig.tar.xz "$PPWD" +cd "$PWD" +rm -rf "$TMP" + +trap - INT QUIT TERM EXIT + |