2014-03-02 08:33:28 +01:00
|
|
|
# This hook generates a file in ${wrksrc}/.xbps_git_revs with the last
|
|
|
|
# commit sha1 (in short mode) for all files of a source pkg.
|
|
|
|
|
|
|
|
hook() {
|
|
|
|
local GITREVS_FILE=${wrksrc}/.xbps_${sourcepkg}_git_revs
|
2014-08-26 07:53:31 +02:00
|
|
|
local GIT_CMD rev
|
2014-03-02 08:33:28 +01:00
|
|
|
|
|
|
|
# If XBPS_USE_GIT_REVS is disabled in conf file don't continue.
|
|
|
|
if [ -z $XBPS_USE_GIT_REVS ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# If the file exists don't regenerate it again.
|
|
|
|
if [ -s ${GITREVS_FILE} ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-08-26 07:53:31 +02:00
|
|
|
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
|
|
|
|
|
2014-06-27 12:00:24 +02:00
|
|
|
cd $XBPS_SRCPKGDIR
|
2014-08-26 07:53:31 +02:00
|
|
|
rev="$($GIT_CMD rev-parse --short HEAD)"
|
2014-06-27 12:00:24 +02:00
|
|
|
echo "${sourcepkg}:${rev}"
|
|
|
|
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
|
2014-03-02 08:33:28 +01:00
|
|
|
}
|