[pacman-dev] [PATCH v3 5/5] makepkg: devel_check(): cleanup for hg version

Matthew Monaco dgbaley27 at 0x01b.net
Mon Mar 12 21:14:22 EDT 2012


From: Matthew Monaco <matthew.monaco at 0x01b.net>

Use pushd/popd, quote args, handle some more errors
---
 scripts/makepkg.sh.in |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 5dcaf60..98e9a5a 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1754,8 +1754,7 @@ devel_check() {
 				newpkgver=$(bzr revno ${_bzrtrunk})
 				;;
 			hg)
-				if [[ -d ./src/$_hgrepo ]] ; then
-					cd ./src/$_hgrepo
+				if pushd "./src/$_hgrepo" > /dev/null; then
 					local ret=0
 					hg pull || ret=$?
 					if (( ! ret )); then
@@ -1765,11 +1764,14 @@ devel_check() {
 					fi
 				else
 					[[ ! -d ./src/ ]] && mkdir ./src/
-					hg clone $_hgroot/$_hgrepo ./src/$_hgrepo
-					cd ./src/$_hgrepo
+					hg clone "$_hgroot/$_hgrepo" "./src/$_hgrepo"
+					if ! pushd "./src/$_hgrepo" > /dev/null; then
+						warning "$(gettext "An error occured while determining the hg version number.")"
+						return 0
+					fi
 				fi
 				newpkgver=$(hg tip --template "{rev}")
-				cd ../../
+				popd > /dev/null
 				;;
 		esac
 
-- 
1.7.9.3



More information about the pacman-dev mailing list