blob: d548a78cea899de0baa84cf807fe71e08e91e21c (
plain)
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
|
#!/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.
if [ "$1" != "--upstream-version" ]
then
echo "Script called with unexpected arguments: $*" >&2
echo "Expected $0 --upstream-version <uversion>" >&2
exit 1
fi
if ! hg --version > /dev/null
then
echo 'Need to install the "mercurial" package to run uscan on ruamel.yaml' >&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
|