From ccaf155ad09a4204821332032a5744cc6aa1502c Mon Sep 17 00:00:00 2001 From: Guillaume Bougard Date: Fri, 22 Oct 2021 15:44:22 +0200 Subject: [PATCH] build: Fix rpmbuild for beta revision --- contrib/unix/glpi-agent-rpm-build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/unix/glpi-agent-rpm-build.sh b/contrib/unix/glpi-agent-rpm-build.sh index 283abb68b..3138b29f0 100755 --- a/contrib/unix/glpi-agent-rpm-build.sh +++ b/contrib/unix/glpi-agent-rpm-build.sh @@ -44,8 +44,15 @@ if [ -n "${GITHUB_REF%refs/tags/*}" -o -z "$VER" ]; then VER=$(perl -Ilib -MGLPI::Agent::Version -e '$v = $GLPI::Agent::Version::VERSION; $v =~ s/-.*//; print $v') fi if [ -z "$REV" ]; then - REV=$([ -n "$GITHUB_SHA" ] && echo $GITHUB_SHA| cut -c 1-8 || git log --pretty=format:%h -n 1) - [ -n "$REV" ] && REV="git$REV" || REV=1 + if [ -z "${VER%%*-*}" ]; then + REV="${VER#*-}" + VER="${VER%%-*}" + elif [ -n "$GITHUB_REF" ]; then + REV=1 + else + REV=$([ -n "$GITHUB_SHA" ] && echo $GITHUB_SHA| cut -c 1-8 || git log --pretty=format:%h -n 1) + [ -n "$REV" ] && REV="git$REV" || REV=1 + fi fi [ -z "$DIST" ] && unset DISTRO || DISTRO=".$DIST"