index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <dreisner@archlinux.org> | 2013-11-03 18:57:07 -0500 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-11-04 10:02:20 +0100 |
commit | 1e043445d2fc264efa73089086f6a769183ad52b (patch) | |
tree | 344cbbbef73055aea2c2860f9d4ede780fa27024 /lib/common.sh | |
parent | 3029c8e4bcaf090327bddd8668a6fa1462e22e42 (diff) |
-rw-r--r-- | lib/common.sh | 9 |
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 } |