From cf49b68c09b6639d163c0d8406ccfc7ee5ed3212 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 27 Jun 2014 12:00:24 +0200 Subject: [PATCH] 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. --- .../hooks/post-install/05-generate-gitrevs.sh | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/common/hooks/post-install/05-generate-gitrevs.sh b/common/hooks/post-install/05-generate-gitrevs.sh index 2804e0e4541..938dc710a5b 100644 --- a/common/hooks/post-install/05-generate-gitrevs.sh +++ b/common/hooks/post-install/05-generate-gitrevs.sh @@ -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 }