Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/common.sh
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-11-03 18:57:07 -0500
committerPierre Schmitz <pierre@archlinux.de>2013-11-04 10:02:20 +0100
commit1e043445d2fc264efa73089086f6a769183ad52b (patch)
tree344cbbbef73055aea2c2860f9d4ede780fa27024 /lib/common.sh
parent3029c8e4bcaf090327bddd8668a6fa1462e22e42 (diff)
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>
Diffstat (limited to 'lib/common.sh')
-rw-r--r--lib/common.sh9
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
}