find_cached_package: avoid adding duplicates
If PKGDEST is set when makepkg was run, the package will be present in find_cached_package's search path by default, causing an error. This also fixes a display bug which causes no output to be shown when multiple packages are found. Fixes FS#37626. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
This commit is contained in:
parent
3029c8e4bc
commit
1e043445d2
|
@ -181,7 +181,7 @@ pkgver_equal() {
|
|||
find_cached_package() {
|
||||
local searchdirs=("$PWD" "$PKGDEST") results=()
|
||||
local targetname=$1 targetver=$2 targetarch=$3
|
||||
local dir pkg pkgbasename pkgparts name ver rel arch size results
|
||||
local dir pkg pkgbasename pkgparts name ver rel arch size r results
|
||||
|
||||
for dir in "${searchdirs[@]}"; do
|
||||
[[ -d $dir ]] || continue
|
||||
|
@ -189,6 +189,11 @@ find_cached_package() {
|
|||
for pkg in "$dir"/*.pkg.tar?(.?z); do
|
||||
[[ -f $pkg ]] || continue
|
||||
|
||||
# avoid adding duplicates of the same inode
|
||||
for r in "${results[@]}"; do
|
||||
[[ $r -ef $pkg ]] && continue 2
|
||||
done
|
||||
|
||||
# split apart package filename into parts
|
||||
pkgbasename=${pkg##*/}
|
||||
pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
|
||||
|
@ -219,7 +224,7 @@ find_cached_package() {
|
|||
;;
|
||||
*)
|
||||
error 'Multiple packages found:'
|
||||
printf '\t%s\n' "${results[@]}"
|
||||
printf '\t%s\n' "${results[@]}" >&2
|
||||
return 1
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue