xbps-src: use $XBPS_GIT_CMD for git

This commit is contained in:
Đoàn Trần Công Danh 2020-04-22 20:59:26 +07:00 committed by Danh Doan
parent f1773b7792
commit 20f9bedefb
3 changed files with 14 additions and 21 deletions

View file

@ -3,7 +3,7 @@
hook() {
local GITREVS_FILE=${XBPS_STATEDIR}/gitrev
local GIT_CMD rev
local rev
# If XBPS_USE_GIT_REVS is disabled in conf file don't continue.
if [ -z $XBPS_USE_GIT_REVS ]; then
@ -14,16 +14,12 @@ 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"
if [ -z "$XBPS_GIT_CMD" ]; then
msg_error "BUG: post-install: XBPS_GIT_CMD is not set\n"
fi
cd $XBPS_SRCPKGDIR
rev="$($GIT_CMD rev-parse --short HEAD)"
rev="$($XBPS_GIT_CMD rev-parse --short HEAD)"
echo "${sourcepkg}:${rev}"
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
}