Debian Codegraph @

debian/get-orig-source

raw
1 #!/bin/sh
2 # if you need to repack for whatever reason you can
3 # use this script via uscan or directly
4 #
5 # FIXME: currently the code is not conform to Debian Policy
6 # http://www.debian.org/doc/debian-policy/ch-source.html
7 # "get-orig-source (optional)"
8 # This target may be invoked in any directory, ...
9 # --> currently it is assumed the script is called in the
10 # source directory featuring the debian/ dir
11
12 # For an example how to fetch source from sourceforge SVN see
13 # git://anonscm.debian.org/debian-med/kmer-tools.git
14
15 COMPRESS=xz
16 ONAME=ArtificialFastqGenerator
17
18 set -e
19 NAME=`dpkg-parsechangelog | awk '/^Source/ { print $2 }'`
20
21 if ! echo $@ | grep -q upstream-version ; then
22 VERSION=`dpkg-parsechangelog | awk '/^Version:/ { print $2 }' | sed 's/\([0-9\.]\+\)-[0-9]\+$/\1/'`
23 uscan --force-download
24 else
25 VERSION=`echo $@ | sed "s?^.*--upstream-version \([0-9.]\+\) .*${NAME}.*?\1?"`
26 if echo "$VERSION" | grep -q "upstream-version" ; then
27 echo "Unable to parse version number"
28 exit
29 fi
30 fi
31
32 set -x
33 TARDIR=${NAME}-${VERSION}
34 mkdir -p ../tarballs
35 cd ../tarballs
36 # need to clean up the tarballs dir first because upstream tarball might
37 # contain a directory with unpredictable name
38 rm -rf *
39 mkdir ${TARDIR}
40 cd ${TARDIR}
41 unzip -q ../../${ONAME}*.zip
42
43 unzip -q ArtificialFastqGenerator.jar
44 find . -name "*.class" -delete
45 rm *.jar
46 cd ..
47
48 GZIP="--best --no-name" tar --owner=root --group=root --mode=a+rX -caf "$NAME"_"$VERSION".orig.tar.${COMPRESS} "${TARDIR}"
49 rm -rf ${TARDIR}