From 8edb443c125cb668e6609b5ff696e565b15a6069 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <archlinux@cryptocrack.de>
Date: Tue, 27 Sep 2011 09:43:26 +0200
Subject: [PATCH] finddeps: Remove redundant cd(1)

Source the PKGBUILD using the correct path (relative to our base
directory) instead of using cd(1) to switch to the ABS base directory
first and to the package directory afterwards.

This is very useful when trying to track errors, also:

    $ ~/src/devtools/finddeps libdaq
    ./community/snort (depends)
    PKGBUILD: line 17: ruby: command not found
    PKGBUILD: line 19: [: =: unary operator expected

Versus:

    $ ~/src/devtools/finddeps libdaq
    ./community/snort (depends)
    ./community/ruby-pkgconfig/PKGBUILD: line 17: ruby: command not found
    ./community/lmms/PKGBUILD: line 19: [: =: unary operator expected

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
---
 finddeps.in | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/finddeps.in b/finddeps.in
index 0d59634..ec8cde4 100644
--- a/finddeps.in
+++ b/finddeps.in
@@ -4,7 +4,6 @@
 #
 
 match=$1
-tld=$(pwd)
 
 if [[ -z $match ]]; then
 	echo 'usage: finddeps <depname>'
@@ -16,10 +15,9 @@ if [[ -z $match ]]; then
 fi
 
 for d in "$(find . -type d)"; do
-	cd "$d"
-	if [[ -f PKGBUILD ]]; then
+	if [[ -f "$d/PKGBUILD" ]]; then
 		unset pkgname depends makedepends
-		. PKGBUILD
+		. "$d/PKGBUILD"
 		for dep in "${depends[@]}"; do
 			# lose the version comparator, if any
 			depname=${dep%%[<>=]*}
@@ -36,5 +34,4 @@ for d in "$(find . -type d)"; do
 			[[ $depname = $match ]] && echo "$d (optdepends)"
 		done
 	fi
-	cd "$tld"
 done
-- 
GitLab