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.
This commit is contained in:
Juan RP 2014-06-27 12:00:24 +02:00
parent 11a3a30291
commit cf49b68c09

View file

@ -3,7 +3,7 @@
hook() {
local GITREVS_FILE=${wrksrc}/.xbps_${sourcepkg}_git_revs
local _revs= _out= f= _filerev= _files=
local rev
# If XBPS_USE_GIT_REVS is disabled in conf file don't continue.
if [ -z $XBPS_USE_GIT_REVS ]; then
@ -13,27 +13,9 @@ hook() {
if [ -s ${GITREVS_FILE} ]; then
return
fi
# Get the git revisions from this source pkg.
cd ${XBPS_SRCPKGDIR}
_files=$(git ls-files ${sourcepkg})
[ -z "${_files}" ] && return
for f in ${_files}; do
_filerev=$(git rev-list --abbrev-commit HEAD $f | head -n1)
[ -z "${_filerev}" ] && continue
_out="${f} ${_filerev}"
if [ -z "${_revs}" ]; then
_revs="${_out}"
else
_revs="${_revs} ${_out}"
fi
done
set -- ${_revs}
while [ $# -gt 0 ]; do
local _file=$1; local _rev=$2
echo "${_file}: ${_rev}"
echo "${_file}: ${_rev}" >> ${GITREVS_FILE}
shift 2
done
cd $XBPS_SRCPKGDIR
rev="$(git rev-parse --short HEAD)"
echo "${sourcepkg}:${rev}"
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
}