summaryrefslogtreecommitdiffstats
path: root/create_tarball
diff options
context:
space:
mode:
Diffstat (limited to 'create_tarball')
-rwxr-xr-xcreate_tarball76
1 files changed, 57 insertions, 19 deletions
diff --git a/create_tarball b/create_tarball
index 0e0d6e8..3eef5a9 100755
--- a/create_tarball
+++ b/create_tarball
@@ -1,7 +1,8 @@
#!/bin/bash
# Set the current target version
-TARGET=${TARGET:-"14.0.5"}
+# The default is the version detected from TDE core header.
+TARGET=${TARGET:-}
# When $SUFFIX = true then the package tarball name will be $package-trinity.
# When $SUFFIX != true then the package tarball name will be trinity-$package.
@@ -27,13 +28,67 @@ if [[ ! -e .git ]] ||
fi
# Check remote branch
-branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
+branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
+if [[ -z "$branch" ]]; then
+ branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
+fi
if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..."
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/}
+
+# Set target version
+if [ -z "$TARGET" ]; then
+ if [ -f $TDEROOT/main/tdelibs/tdecore/tdeversion.h ]; then
+ tdeversionHeader=$TDEROOT/main/tdelibs/tdecore/tdeversion.h
+ fi
+ if [ -f $TDEROOT/main/tdelibs/kdecore/kdeversion.h ]; then
+ tdeversionHeader=$TDEROOT/main/tdelibs/kdecore/kdeversion.h
+ fi
+ if [ -z "$tdeversionHeader" ]; then
+ echo "Cannot find TDE core headers. Exiting."
+ exit 1
+ fi
+ TARGET=`sed -n 's|#define [KT]DE_VERSION_STRING "[^0-9]\?\([^ "]*\).*|\1|p' $tdeversionHeader`
+fi
+
+# Check branch by target
+if [ "$TARGET" != "${TARGET#3.5.}" ]; then
+ if [ "$TARGET" != "${TARGET#3.5.13.}" ]; then
+ targetBranch=v3.5.13-sru
+ else
+ targetBranch=master
+ fi
+else
+ if [ "$TARGET" != "${TARGET%.0}" ]; then
+ targetBranch=master
+ else
+ targetBranch=r${TARGET%.*}.x
+ fi
+fi
+if [ "$branch" != "$targetBranch" ]; then
+ echo "Target $TARGET is not valid on $branch branch. Exiting."
+ exit 1
+fi
+
# Check submodules
if [[ -e .gitmodules ]]; then
sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <.gitmodules | \
@@ -67,23 +122,6 @@ 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 | \
sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \