]> git.decadent.org.uk Git - ion3.git/blob - debian/get-orig-source
Added get-orig-source script and rule to download and combine both upstream tarballs.
[ion3.git] / debian / get-orig-source
1 #!/bin/bash
2
3 set -e
4
5 # Get the main upstream tarball URL and version via uscan.
6 while read line; do
7     if [ "${line#http://}" != "$line" -a "${line#* }" = "$line" ]; then
8         main_url="${line}"
9     fi
10     if [ "${line#Newest version }" != "$line" ]; then
11         version="${line#Newest version on remote site is }"
12         version="${version%, local version is *}"
13     fi
14 done < <(LANG=C uscan --report --verbose)
15 test -n "$main_url" -a -n "$version"
16
17 # Get the document tarball URL and the filenames of the tarballs.
18 # Download them.
19 main_file=${main_url##*/}
20 doc_url=${main_url/ion/ion-doc}
21 doc_file=${doc_url##*/}
22 wget -O $main_file $main_url
23 wget -O $doc_file $doc_url
24
25 # Work out what directories we expect to be in them, and check this.
26 main_dir=${main_file%.tar.gz}
27 doc_dir=${doc_file%.tar.gz}
28 test -z "$(tar tzf $main_file | grep -v "^$main_dir/")"
29 test -z "$(tar tzf $doc_file | grep -v "^$doc_dir/")"
30
31 # Unpack, combine and repack.
32 tar xzf $main_file
33 tar xzf $doc_file
34 mv $main_dir ion3-$version.orig
35 mv $doc_dir ion3-$version.orig/doc
36 tar cf - ion3-$version.orig | gzip -c9 > ion3_$version.orig.tar.gz
37
38 # Clean up.
39 rm -rf $main_file $doc_file ion3-$version.orig