Allow the generation of a correctly versioned tarball from any
commitish from with the git repo.  The version is taken from the
nearest tag and inserted into the tarball.

Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
---
diff --git a/mktarball b/mktarball
new file mode 100755
index 0000000..8855204
--- /dev/null
+++ b/mktarball
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+#
+P='mktarball'
+
+if [ "$#" -ne 1 ]; then
+       echo 1>&2 "Usage: $P <commitish>"
+       exit 1
+fi
+commit="$1"
+
+if [ ! .git ]; then
+       echo 1>&2 "$P: not in the source tree"
+       exit 1
+fi
+
+# Get the official name for this commit.
+name=`git describe --tags "$commit"`
+
+# Build a version file to add to the tarball, we know it is not
+# modified as we just took a commit which is unmodified by definition.
+tmp="/tmp/tarball-$$"
+mkdir -p "$tmp/libhugetlbfs-$name"
+echo "$name" >"$tmp/libhugetlbfs-$name/version"
+
+git archive --format=tar --prefix="libhugetlbfs-$name/" "$commit" \
+                                               >"libhugetlbfs-$name.tar"
+tar -C "$tmp" -rf "libhugetlbfs-$name.tar" "libhugetlbfs-$name/version"
+gzip -9 "libhugetlbfs-$name.tar"
+
+# Clean up the version.
+[ -d "$tmp/libhugetlbfs-$name" ] && rm -rf "$tmp"

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to