From aec1b80e86162983dc8410f272bc2fde5c59f60e Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 26 Aug 2014 07:53:31 +0200 Subject: [PATCH] hooks/generate-gitrevs: fallback to the git cmd for bootstrap builds. --- common/hooks/post-install/05-generate-gitrevs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/hooks/post-install/05-generate-gitrevs.sh b/common/hooks/post-install/05-generate-gitrevs.sh index 52dc023a887..e4e06909735 100644 --- a/common/hooks/post-install/05-generate-gitrevs.sh +++ b/common/hooks/post-install/05-generate-gitrevs.sh @@ -3,7 +3,7 @@ hook() { local GITREVS_FILE=${wrksrc}/.xbps_${sourcepkg}_git_revs - local rev + local GIT_CMD rev # If XBPS_USE_GIT_REVS is disabled in conf file don't continue. if [ -z $XBPS_USE_GIT_REVS ]; then @@ -14,8 +14,16 @@ hook() { return fi + if command -v chroot-git &>/dev/null; then + GIT_CMD=$(command -v chroot-git) + elif command -v git &>/dev/null; then + GIT_CMD=$(command -v git) + else + msg_error "$pkgver: cannot find chroot-git or git utility, exiting...\n" + fi + cd $XBPS_SRCPKGDIR - rev="$(chroot-git rev-parse --short HEAD)" + rev="$($GIT_CMD rev-parse --short HEAD)" echo "${sourcepkg}:${rev}" echo "${sourcepkg}:${rev}" > $GITREVS_FILE }