Imported Debian patch 0.0~git20110716.8c27363-1
[deb_libnfs.git] / debian / libnfs-get-orig-source
1 #!/bin/sh
2
3 # Script used to generate the orig source tarball for libnfs.
4
5 LIBNFS_GIT_URL="git://github.com/sahlberg/libnfs.git"
6 LIBNFS_GIT_COMMIT="8c27363e21f667a01e75f585b897c3b36d8f5245"
7 DATE_RETRIEVED="20110716"
8 COMMIT_SHORT_FORM="$(echo $LIBNFS_GIT_COMMIT | \
9 sed -e 's/^\([[:xdigit:]]\{,7\}\).*/\1/')"
10 LIBNFS_VERSION="0.0~git${DATE_RETRIEVED}.${COMMIT_SHORT_FORM}"
11
12 git clone "$LIBNFS_GIT_URL" "libnfs-${LIBNFS_VERSION}"
13
14 cd "libnfs-${LIBNFS_VERSION}"
15 git checkout "$LIBNFS_GIT_COMMIT"
16 ./bootstrap
17 cd ..
18
19 # Remove temp files and other cruft from source tarball
20 # The find command snippet here was taken from debhelper's dh_clean command
21 # with some modification to delete more unneeded files.
22 echo "Removing temp files and other cruft from source tarball"
23 find libnfs-${LIBNFS_VERSION} \( \( -type f -a \
24 \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
25 -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
26 -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
27 -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
28 -o -name config.status -o -name config.cache -o -name config.log \
29 \) -exec rm -f "{}" \; \) -o \
30 \( -type d -a -name autom4te.cache -prune -exec rm -rf "{}" \; \) \)
31 rm -rf libnfs-${LIBNFS_VERSION}/.git
32 rm -f libnfs-${LIBNFS_VERSION}/.gitignore
33
34 # Remove empty directories
35 echo "Removing empty directories"
36 find libnfs-${LIBNFS_VERSION} -type d -empty -delete
37
38 tar --exclude-vcs -czf "libnfs_${LIBNFS_VERSION}.orig.tar.gz" \
39 "libnfs-${LIBNFS_VERSION}/"