void-packages/common/hooks/post-install/05-generate-gitrevs.sh
Juan RP cf49b68c09 hooks/generate-gitrevs: simplify and just use "sourcepkg:gitshortrev".
Previous way was way too slow and somewhat redundant. Just with the
latest git short rev is enough to know at what point a pkg was built.
2014-06-27 12:00:24 +02:00

22 lines
553 B
Bash

# 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
local rev
# 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
cd $XBPS_SRCPKGDIR
rev="$(git rev-parse --short HEAD)"
echo "${sourcepkg}:${rev}"
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
}