[pacman-dev] [PATCH v3 3/5] makepkg: devel_check(): consolidate common code

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


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

---
 scripts/makepkg.sh.in |   37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 46e787f..74dfd96 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1730,47 +1730,24 @@ devel_check() {
 			return 0
 		fi
 
+		if ! type -p "$vcs" >/dev/null; then
+			warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs"
+			return 0
+		fi
+
+		msg "$(gettext "Determining latest %s revision...")" "$vcs"
+
 		if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then
-			if ! type -p darcs >/dev/null; then
-				warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs"
-				return 0
-			fi
-			msg "$(gettext "Determining latest %s revision...")" 'darcs'
 			newpkgver=$(date +%Y%m%d)
 		elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then
-			if ! type -p cvs >/dev/null; then
-				warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "cvs" "cvs"
-				return 0
-			fi
-			msg "$(gettext "Determining latest %s revision...")" 'cvs'
 			newpkgver=$(date +%Y%m%d)
 		elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then
-			if ! type -p git >/dev/null; then
-				warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "git" "git"
-				return 0
-			fi
-			msg "$(gettext "Determining latest %s revision...")" 'git'
 			newpkgver=$(date +%Y%m%d)
 		elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then
-			if ! type -p svn >/dev/null; then
-				warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "svn" "svn"
-				return 0
-			fi
-			msg "$(gettext "Determining latest %s revision...")" 'svn'
 			newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
 		elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then
-			if ! type -p bzr >/dev/null; then
-				warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "bzr" "bzr"
-				return 0
-			fi
-			msg "$(gettext "Determining latest %s revision...")" 'bzr'
 			newpkgver=$(bzr revno ${_bzrtrunk})
 		elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then
-			if ! type -p hg >/dev/null; then
-				warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "hg" "hg"
-				return 0
-			fi
-			msg "$(gettext "Determining latest %s revision...")" 'hg'
 			if [[ -d ./src/$_hgrepo ]] ; then
 				cd ./src/$_hgrepo
 				local ret=0
-- 
1.7.9.3



More information about the pacman-dev mailing list