xbps-src: implement a by_sha256 hash cache

This commit is contained in:
jbu 2015-07-03 18:30:34 +02:00
parent 8366f4892a
commit b30cbd9870
3 changed files with 51 additions and 7 deletions

View file

@ -0,0 +1,12 @@
# vim: set ts=4 sw=4 et:
update_hash_cache() {
local cache="$XBPS_SRCDISTDIR/by_sha256"
local distfile curfile
mkdir -p "$cache"
find "$XBPS_SRCDISTDIR" -type f | grep -v by_sha256 | while read -r distfile; do
cksum=$(cat "$distfile" | sha256sum | cut -d " " -f 1)
curfile="$(basename ${distfile})"
ln -vf "$distfile" "${cache}/${cksum}_${curfile}"
done
}