aboutsummaryrefslogtreecommitdiffstats
path: root/build-root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'build-root/scripts')
-rwxr-xr-xbuild-root/scripts/verdist31
-rwxr-xr-xbuild-root/scripts/version45
2 files changed, 67 insertions, 9 deletions
diff --git a/build-root/scripts/verdist b/build-root/scripts/verdist
new file mode 100755
index 00000000000..9d1f1b5adcd
--- /dev/null
+++ b/build-root/scripts/verdist
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Add version to dist tarball.
+#
+BR=$1
+prefix=$2
+verstring=$3
+BASE=`pwd`
+
+git rev-parse 2> /dev/null
+if [ $? == 0 ]; then
+ git archive --prefix=${prefix}/ HEAD | gzip -9 > ${verstring}.tar.gz
+else
+ cd ..
+ tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
+ cp ${verstring}.tar.gz $BASE
+ cd $BASE
+fi
+
+mkdir ${BASE}/tmp
+cd ${BASE}/tmp
+tar -xzf ${BASE}/${verstring}.tar.gz
+rm ${BASE}/${verstring}.tar.gz
+
+cp ${BR}/scripts/.version ${BASE}/tmp/${prefix}/build-root/scripts
+tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
+mv ${verstring}.tar.gz ${BASE}
+
+cd ${BASE}
+rm -rf tmp
diff --git a/build-root/scripts/version b/build-root/scripts/version
index 84ee5dbe4de..af447286912 100755
--- a/build-root/scripts/version
+++ b/build-root/scripts/version
@@ -1,8 +1,32 @@
#!/bin/bash
-TAG=$(git describe | cut -d- -f1 | sed -e 's/^v//')
-ADD=$(git describe | cut -s -d- -f2)
-CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
+path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
+
+cd "$path"
+
+git rev-parse 2> /dev/null
+if [ $? == 0 ]; then
+ vstring=$(git describe)
+elif [ -f .version ]; then
+ vstring=$(cat .version)
+else
+ if [ -f ../rpm/*.gz ]; then
+ vstring=$(ls ../rpm/*.gz)
+ else
+ exit 1
+ fi
+fi
+
+TAG=$(echo ${vstring} | cut -d- -f1 | sed -e 's/^v//')
+ADD=$(echo ${vstring} | cut -s -d- -f2)
+
+git rev-parse 2> /dev/null
+if [ $? == 0 ]; then
+ CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
+else
+ CMT=$(echo ${vstring} | cut -s -d- -f3,4)
+fi
+CMTR=$(echo $CMT | sed 's/-/_/')
if [ -n "${BUILD_NUMBER}" ]; then
BLD="~b${BUILD_NUMBER}"
@@ -15,13 +39,16 @@ fi
if [ "$1" = "rpm-release" ]; then
[ -z "${ADD}" ] && echo release && exit
- CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4 | sed 's/-/_/')
- echo ${ADD}${CMT:+~${CMT}}${BLD}
+ echo ${ADD}${CMTR:+~${CMTR}}${BLD}
exit
fi
-if [ -n "${ADD}" ]; then
- echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
-else
- echo ${TAG}
+ if [ -n "${ADD}" ]; then
+ if [ "$1" = "rpm-string" ]; then
+ echo ${TAG}-${ADD}${CMTR:+~${CMTR}}${BLD}
+ else
+ echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
+ fi
+ else
+ echo ${TAG}
fi