summaryrefslogtreecommitdiff
path: root/ci/make-git-snapshot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/make-git-snapshot.sh')
-rwxr-xr-xci/make-git-snapshot.sh26
1 files changed, 9 insertions, 17 deletions
diff --git a/ci/make-git-snapshot.sh b/ci/make-git-snapshot.sh
index 1a137bff..67cf14c9 100755
--- a/ci/make-git-snapshot.sh
+++ b/ci/make-git-snapshot.sh
@@ -1,31 +1,23 @@
-#!/bin/sh
+#!/bin/bash
+set -xeuo pipefail
-srcdir=$1
-shift
-PKG_VER=$1
-shift
-GITREV=$1
-shift
+TOP=$(git rev-parse --show-toplevel)
+GITREV=$(git rev-parse HEAD)
+gitdescribe=$(git describe --always --tags $GITREV)
+version=$(echo "$gitdescribe" | sed -e 's,-,\.,g' -e 's,^v,,')
+name=$(basename $(pwd))
+PKG_VER="${name}-${version}"
TARFILE=${PKG_VER}.tar
TARFILE_TMP=${TARFILE}.tmp
-set -x
-set -e
-
-test -n "${srcdir}"
-test -n "${PKG_VER}"
-test -n "${GITREV}"
-
-TOP=$(git rev-parse --show-toplevel)
-
echo "Archiving ${PKG_VER} at ${GITREV} to ${TARFILE_TMP}"
(cd ${TOP}; git archive --format=tar --prefix=${PKG_VER}/ ${GITREV}) > ${TARFILE_TMP}
ls -al ${TARFILE_TMP}
(cd ${TOP}; git submodule status) | while read line; do
rev=$(echo ${line} | cut -f 1 -d ' '); path=$(echo ${line} | cut -f 2 -d ' ')
echo "Archiving ${path} at ${rev}"
- (cd ${srcdir}/${path}; git archive --format=tar --prefix=${PKG_VER}/${path}/ ${rev}) > submodule.tar
+ (cd ${TOP}/${path}; git archive --format=tar --prefix=${PKG_VER}/${path}/ ${rev}) > submodule.tar
tar -A -f ${TARFILE_TMP} submodule.tar
rm submodule.tar
done