I tried to prepare a script that under the proposed
rules create a tarball for
module from the active folder. In the script is solved searching for last tag
in current branch. Besides, are added checks if the current tree corresponds
to the state on the server. And it is also added support for the creation of
the final tarballs, when the number of commits since the last tag is zero.
Please, test it. If it proved to be useful, script could be added into the git
scripts.
Looks pretty good. May I suggest the following changes:
--- create_tarball 2012-11-14 20:09:47.000000000 -0600
+++ create_tarball.new 2012-11-14 19:57:58.000000000 -0600
@@ -2,6 +2,14 @@
TARGET=14.0.0
+# When $SUFFIX = true then the package tarball name will be $package-trinity.
+# When $SUFFIX != true then the package tarball name will be trinity-$package.
+# Choose the option that satisfies any distro package name rules.
+SUFFIX=${SUFFIX:-"true"}
+
+#When $TARBALL_DIR = "" then the tarball will be created in the parent
directory (..).
+TARBALL_DIR=${TARBALL_DIR:-""}
+
if [[ ! -e .git ]] ||
[[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then
echo "This script can only be run from a top level git directory.
Exiting..."
@@ -34,11 +42,21 @@
count=`git log $tag --pretty=oneline | wc -l`
-package=$(basename $PWD)-trinity-$TARGET
+if [ "$SUFFIX" = "true" ]; then
+ package=$(basename $PWD)-trinity-$TARGET
+else
+ package=trinity-$(basename $PWD)-$TARGET
+fi
if [[ "$count" -gt 0 ]]; then
package=$package~pre$count+$(git rev-parse HEAD | cut -c 1-8)
fi
+echo "Package name: $package"
+
+if [ "$TARBALL_DIR" = "" ]; then
+ TARBALL_DIR=".."
+fi
+echo "Creating tarball in $TARBALL_DIR."
tar cv --exclude .git --exclude .gitmodules --transform "s|^\.|$package|" ./ |
\
-xz -9 >../$package.tar.xz
+xz -9 >$TARBALL_DIR/$package.tar.xz
Is the tilde (~) in the text string "~pre" a Debian convention?
Darrell