common: improve performance of find_cached_package
find_cached_package was unnecessarily looping over all packages which uses a lot of CPU and could be exceptionally slow when PKGDEST contains a lot of packages. Fix this by adding the target pkgname, pkgver and arch to the glob and only process potential candidates.
This commit is contained in:
parent
20f89df443
commit
5d02c6df7f
|
@ -146,7 +146,7 @@ find_cached_package() {
|
|||
[[ -d $dir ]] || continue
|
||||
|
||||
shopt -s extglob nullglob
|
||||
mapfile -t packages < <(printf "%s\n" "$dir"/*.pkg.tar?(.!(sig|*.*)))
|
||||
mapfile -t packages < <(printf "%s\n" "$dir"/${targetname}-${targetver}-*${targetarch}.pkg.tar?(.!(sig|*.*)))
|
||||
shopt -u extglob nullglob
|
||||
|
||||
for pkg in "${packages[@]}"; do
|
||||
|
|
Loading…
Reference in New Issue