diff options
Diffstat (limited to 'lib/common.sh')
-rw-r--r-- | lib/common.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/common.sh b/lib/common.sh index 1812cb7..cb9db76 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -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 } |