xbps-src: use $XBPS_GIT_CMD for git
This commit is contained in:
parent
f1773b7792
commit
20f9bedefb
|
@ -1,19 +1,17 @@
|
||||||
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
|
# If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
|
||||||
# only run this, if SOURCE_DATE_EPOCH isn't set.
|
# only run this, if SOURCE_DATE_EPOCH isn't set.
|
||||||
|
|
||||||
|
if [ -z "$XBPS_GIT_CMD" ]; then
|
||||||
|
msg_error "BUG: environment/setup: XBPS_GIT_CMD is not set\n"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
|
if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
|
||||||
unset SOURCE_DATE_EPOCH
|
unset SOURCE_DATE_EPOCH
|
||||||
return 0
|
elif [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
|
||||||
fi
|
|
||||||
if [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
|
|
||||||
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)
|
|
||||||
fi
|
|
||||||
# check if the template is under version control:
|
# check if the template is under version control:
|
||||||
if $GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} status -u normal --porcelain template | grep "^?? " &> /dev/null; then
|
if $XBPS_GIT_CMD -C ${XBPS_SRCPKGDIR}/${basepkg} status -u normal --porcelain template | grep "^?? " &> /dev/null; then
|
||||||
export SOURCE_DATE_EPOCH="$(stat -c %Y ${XBPS_SRCPKGDIR}/${basepkg}/template)"
|
export SOURCE_DATE_EPOCH="$(stat -c %Y ${XBPS_SRCPKGDIR}/${basepkg}/template)"
|
||||||
else
|
else
|
||||||
export SOURCE_DATE_EPOCH="$($GIT_CMD -C ${XBPS_DISTDIR} log --pretty='%ct' -n1 HEAD)"
|
export SOURCE_DATE_EPOCH="$($XBPS_GIT_CMD -C ${XBPS_DISTDIR} log --pretty='%ct' -n1 HEAD)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
hook() {
|
hook() {
|
||||||
local GITREVS_FILE=${XBPS_STATEDIR}/gitrev
|
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 XBPS_USE_GIT_REVS is disabled in conf file don't continue.
|
||||||
if [ -z $XBPS_USE_GIT_REVS ]; then
|
if [ -z $XBPS_USE_GIT_REVS ]; then
|
||||||
|
@ -14,16 +14,12 @@ hook() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v chroot-git &>/dev/null; then
|
if [ -z "$XBPS_GIT_CMD" ]; then
|
||||||
GIT_CMD=$(command -v chroot-git)
|
msg_error "BUG: post-install: XBPS_GIT_CMD is not set\n"
|
||||||
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
|
fi
|
||||||
|
|
||||||
cd $XBPS_SRCPKGDIR
|
cd $XBPS_SRCPKGDIR
|
||||||
rev="$($GIT_CMD rev-parse --short HEAD)"
|
rev="$($XBPS_GIT_CMD rev-parse --short HEAD)"
|
||||||
echo "${sourcepkg}:${rev}"
|
echo "${sourcepkg}:${rev}"
|
||||||
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
|
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
|
||||||
}
|
}
|
||||||
|
|
5
xbps-src
5
xbps-src
|
@ -508,14 +508,13 @@ fi
|
||||||
|
|
||||||
# Try using chroot-git then git from the host system
|
# Try using chroot-git then git from the host system
|
||||||
if command -v chroot-git &>/dev/null; then
|
if command -v chroot-git &>/dev/null; then
|
||||||
XBPS_GIT_CMD=$(command -v chroot-git)
|
export XBPS_GIT_CMD=$(command -v chroot-git)
|
||||||
elif command -v git &>/dev/null; then
|
elif command -v git &>/dev/null; then
|
||||||
XBPS_GIT_CMD=$(command -v git)
|
export XBPS_GIT_CMD=$(command -v git)
|
||||||
else
|
else
|
||||||
echo "neither chroot-git or git are available in your system!" 1>&2
|
echo "neither chroot-git or git are available in your system!" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
readonly XBPS_GIT_CMD
|
|
||||||
|
|
||||||
if [ -n "$XBPS_HOSTDIR" ]; then
|
if [ -n "$XBPS_HOSTDIR" ]; then
|
||||||
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
||||||
|
|
Loading…
Reference in New Issue