purge-distfiles: grep instead of sourcing template
To catch all SHA256 hashes from a template, even the ones which are used only under certain preconditions, use grep [0-9a-f]{64} to find all hashes in a template. The may be some false positives which does not hurt the intended purpose to purge obsolete distfiles. Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
This commit is contained in:
parent
899da38831
commit
87779af6c8
|
@ -4,10 +4,7 @@
|
|||
|
||||
|
||||
purge_distfiles() {
|
||||
# Ignore msg_error calls when sourcing templates
|
||||
msg_error() {
|
||||
:
|
||||
}
|
||||
readonly HASHLEN=64
|
||||
if [ -z "$XBPS_SRCDISTDIR" ]; then
|
||||
msg_error "The variable \$XBPS_SRCDISTDIR is not set."
|
||||
exit 1
|
||||
|
@ -28,8 +25,7 @@ purge_distfiles() {
|
|||
pkg=${template#*/}
|
||||
pkg=${pkg%/*}
|
||||
if [ ! -L "srcpkgs/$pkg" ]; then
|
||||
unset checksum
|
||||
source $template 2>/dev/null
|
||||
checksum="$(grep -Ehrow [0-9a-f]{$HASHLEN} ${template}|sort|uniq)"
|
||||
read -a _my_hashes <<< ${checksum}
|
||||
i=0
|
||||
while [ -n "${_my_hashes[$i]}" ]; do
|
||||
|
@ -77,7 +73,6 @@ purge_distfiles() {
|
|||
echo
|
||||
|
||||
hashes=($XBPS_SRCDISTDIR/by_sha256/*)
|
||||
readonly HASHLEN=64
|
||||
for file in ${hashes[@]}; do
|
||||
hash_distfile=${file##*/}
|
||||
hash=${hash_distfile:0:$HASHLEN}
|
||||
|
|
Loading…
Reference in New Issue
Block a user