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:
parent
11a3a30291
commit
cf49b68c09
1 changed files with 5 additions and 23 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
hook() {
|
hook() {
|
||||||
local GITREVS_FILE=${wrksrc}/.xbps_${sourcepkg}_git_revs
|
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 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
|
||||||
|
@ -13,27 +13,9 @@ hook() {
|
||||||
if [ -s ${GITREVS_FILE} ]; then
|
if [ -s ${GITREVS_FILE} ]; then
|
||||||
return
|
return
|
||||||
fi
|
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
|
cd $XBPS_SRCPKGDIR
|
||||||
_filerev=$(git rev-list --abbrev-commit HEAD $f | head -n1)
|
rev="$(git rev-parse --short HEAD)"
|
||||||
[ -z "${_filerev}" ] && continue
|
echo "${sourcepkg}:${rev}"
|
||||||
_out="${f} ${_filerev}"
|
echo "${sourcepkg}:${rev}" > $GITREVS_FILE
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue