Imported Debian patch 0.0~git20110716.8c27363-1
[deb_libnfs.git] / debian / libnfs-get-orig-source
diff --git a/debian/libnfs-get-orig-source b/debian/libnfs-get-orig-source
new file mode 100755 (executable)
index 0000000..fa4e56a
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Script used to generate the orig source tarball for libnfs.
+
+LIBNFS_GIT_URL="git://github.com/sahlberg/libnfs.git"
+LIBNFS_GIT_COMMIT="8c27363e21f667a01e75f585b897c3b36d8f5245"
+DATE_RETRIEVED="20110716"
+COMMIT_SHORT_FORM="$(echo $LIBNFS_GIT_COMMIT | \
+                     sed -e 's/^\([[:xdigit:]]\{,7\}\).*/\1/')"
+LIBNFS_VERSION="0.0~git${DATE_RETRIEVED}.${COMMIT_SHORT_FORM}"
+
+git clone "$LIBNFS_GIT_URL" "libnfs-${LIBNFS_VERSION}"
+
+cd "libnfs-${LIBNFS_VERSION}"
+git checkout "$LIBNFS_GIT_COMMIT"
+./bootstrap
+cd ..
+
+# Remove temp files and other cruft from source tarball
+# The find command snippet here was taken from debhelper's dh_clean command
+# with some modification to delete more unneeded files.
+echo "Removing temp files and other cruft from source tarball"
+find libnfs-${LIBNFS_VERSION} \( \( -type f -a \
+  \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
+  -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
+  -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
+  -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
+  -o -name config.status -o -name config.cache -o -name config.log \
+  \) -exec rm -f "{}" \; \) -o \
+  \( -type d -a -name autom4te.cache -prune -exec rm -rf "{}" \; \) \)
+rm -rf libnfs-${LIBNFS_VERSION}/.git
+rm -f libnfs-${LIBNFS_VERSION}/.gitignore
+
+# Remove empty directories
+echo "Removing empty directories"
+find libnfs-${LIBNFS_VERSION} -type d -empty -delete
+
+tar --exclude-vcs -czf "libnfs_${LIBNFS_VERSION}.orig.tar.gz" \
+  "libnfs-${LIBNFS_VERSION}/"