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
|
#!/bin/sh
#
# Repackage upstream source to exclude non-distributable files.
# Should be called as "repack sh --upstream-source <version> <file>
# (for example, via uscan).
set -e
set -u
if [ $# -ne 3 ]; then
echo "Usage: $0 --upstream-source <version> <file>"
exit 1
fi
OPT_VERSION=$2
OPT_FILE=$3
TMPDIR=`mktemp -d`
trap "rm -rf $TMPDIR" QUIT INT EXIT
echo "Repackaging $OPT_FILE"
orig_file_path=$(readlink --canonicalize $OPT_FILE)
package_name=$(dpkg-parsechangelog | sed -n 's/^Source: //p')
dfsg_directory=${package_name}_${OPT_VERSION}.dfsg1
dfsg_file_path=$(dirname ${orig_file_path})/${dfsg_directory}.orig.tar.gz
zcat "${orig_file_path}" | \
tar --wildcards \
--delete '*/src/file-*' \
--delete '*/laholator.py' | \
gzip -c > $dfsg_file_path
echo "File $OPT_FILE repackaged successfully to $dfsg_file_path"
|