diff options
author | Slávek Banko <[email protected]> | 2014-03-31 02:58:47 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2014-03-31 02:59:49 +0200 |
commit | c5010d9665e5d4525177093ca813846e93eba6f4 (patch) | |
tree | c504ef1e49117a514c74b4d41e6e8ff5d5415f80 | |
parent | a48d32b281a28dd71ab81b85888965984ba79cb9 (diff) | |
download | scripts-c5010d9665e5d4525177093ca813846e93eba6f4.tar.gz scripts-c5010d9665e5d4525177093ca813846e93eba6f4.zip |
create_tarball: Add automatic creation of SCM metadata
-rwxr-xr-x | create_tarball | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/create_tarball b/create_tarball index 230a944..939f856 100755 --- a/create_tarball +++ b/create_tarball @@ -67,6 +67,23 @@ if [[ -n "$target_tag" ]] && \ exit 1 fi +# Get submodule name +REMOTE_URL=$(git config --get remote.origin.url) +if [ "$REMOTE_URL" = "${REMOTE_URL%/tde}" ]; then + TDEROOT=$( cd `git rev-parse --show-toplevel` && + cd .. && + cd `git rev-parse --show-toplevel` && + pwd ) + SUBROOT=$( cd `git rev-parse --show-toplevel` && + pwd ) +elif [ -f .gitignore ]; then + TDEROOT=$( cd `git rev-parse --show-toplevel` && + pwd ) + SUBROOT=$PWD + METAPACKAGE=true +fi +MODULE=${SUBROOT#$TDEROOT/main/} + # Calculate version tag=`git tag | sort -r | while read t; do \ git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ @@ -87,11 +104,14 @@ fi echo "Package name: $package" if [ ! -e $TARBALL_DIR/$package.tar.$TAR_SUFFIX ]; then echo "Creating tarball in $TARBALL_DIR." - trap "rm $TARBALL_DIR/tar-$$; exit 1" INT + echo $MODULE > .tdescmmodule + echo $branch-$(git rev-parse HEAD) > .tdescmrevision + trap "rm $TARBALL_DIR/tar-$$; rm .tdescmmodule .tdescmrevision; exit 1" INT tar c --owner=root --group=users --exclude .git --exclude .gitmodules --transform "s|^\.\(/\|$\)|$package\1|" ./ | \ $COMPRESS -9 >$TARBALL_DIR/tar-$$ && \ mv $TARBALL_DIR/tar-$$ $TARBALL_DIR/$package.tar.$TAR_SUFFIX || \ rm $TARBALL_DIR/tar-$$ + rm .tdescmmodule .tdescmrevision else echo "Unchanged tarball in $TARBALL_DIR." exit 2 |