ostree/ci/make-git-snapshot.sh
Luca BRUNO 4202082019
ci: adjust git tags filtering
Another attempt at fixing logic for version detection in COPR.
2022-11-21 15:12:31 +00:00

30 lines
1004 B
Bash
Executable File

#!/bin/bash
set -xeuo pipefail
TOP=$(git rev-parse --show-toplevel)
GITREV=$(git rev-parse HEAD)
gitdescribe=$(git describe --always --tags --match 'v2???.*' $GITREV)
version=$(echo "$gitdescribe" | sed -e 's,-,\.,g' -e 's,^v,,')
name=libostree
PKG_VER="${name}-${version}"
TARFILE=${PKG_VER}.tar
TARFILE_TMP=${TARFILE}.tmp
if ! test -f ${TOP}/libglnx/README.md || ! test -f ${TOP}/bsdiff/README.md; then
git submodule update --init
fi
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 ${TOP}/${path}; git archive --format=tar --prefix=${PKG_VER}/${path}/ ${rev}) > submodule.tar
tar -A -f ${TARFILE_TMP} submodule.tar
rm submodule.tar
done
mv ${TARFILE_TMP} ${TARFILE}
xz "${TARFILE}"