Upstream merge-request: https://git.sailfishos.org/mer-core/libresource/merge_requests/5 From 5d4625173c64dec352548f262159da33d8030b1a Mon Sep 17 00:00:00 2001 From: Bart Ribbers Date: Wed, 25 Mar 2020 13:49:33 +0100 Subject: [PATCH] Never run git commands when .tarball-version exists This makes it work in environments where the building takes place in a git repo, but libresource is still built from a release tarball --- build-aux/git-version-gen | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index 819fa04..7769787 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -129,18 +129,21 @@ fi v=`echo "$v" |sed 's/^v//'` -# Don't declare a version "dirty" merely because a time stamp has changed. -git status > /dev/null 2>&1 +if [ ! -f $tarball_version_file ] +then + # Don't declare a version "dirty" merely because a time stamp has changed. + git status > /dev/null 2>&1 -dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= -case "$dirty" in - '') ;; - *) # Append the suffix only if there isn't one already. - case $v in - *-dirty) ;; - *) v="$v-dirty" ;; - esac ;; -esac + dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= + case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; + esac +fi # We default to 0.0.0 instead of UNKNOWN if test "x$v" = "xUNKNOWN"; then -- 2.23.0