Browse Source

create_tarball: Add automatic creation of SCM metadata

pull/1/head
Slávek Banko 8 years ago
parent
commit
c5010d9665
  1. 22
      create_tarball

22
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

Loading…
Cancel
Save