diff options
author | Matthew Monaco <matthew.monaco@0x01b.net> | 2012-03-13 02:14:21 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-04-07 18:26:31 +0200 |
commit | 0fd477238f190976efffabd04110fb1d79448be3 (patch) | |
tree | 3a57d66dca80a7519f0c280fa6414ac3579a42b3 | |
parent | 0666b1366990064b0f9b47fe321be8e6593336ce (diff) | |
download | pacman-0fd477238f190976efffabd04110fb1d79448be3.tar.gz pacman-0fd477238f190976efffabd04110fb1d79448be3.tar.xz |
makepkg: devel_check(): set newpkgver (cleanup)
The case structure allows the syntax to focus on what's actually being
done here.
-rw-r--r-- | scripts/makepkg.sh.in | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2502e881..a486a521 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1744,34 +1744,41 @@ devel_check() { msg "$(gettext "Determining latest %s revision...")" "$vcs" - if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then - newpkgver=$(date +%Y%m%d) - elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then - newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') - elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then - newpkgver=$(bzr revno ${_bzrtrunk}) - elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then - if [[ -d ./src/$_hgrepo ]] ; then - cd ./src/$_hgrepo - local ret=0 - hg pull || ret=$? - if (( ! ret )); then - hg update - elif (( ret != 1 )); then - return 1 + case "$vcs" in + darcs) + newpkgver=$(date +%Y%m%d) + ;; + cvs) + newpkgver=$(date +%Y%m%d) + ;; + git) + newpkgver=$(date +%Y%m%d) + ;; + svn) + newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') + ;; + bzr) + newpkgver=$(bzr revno ${_bzrtrunk}) + ;; + hg) + if [[ -d ./src/$_hgrepo ]] ; then + cd ./src/$_hgrepo + local ret=0 + hg pull || ret=$? + if (( ! ret )); then + hg update + elif (( ret != 1 )); then + return 1 + fi + else + [[ ! -d ./src/ ]] && mkdir ./src/ + hg clone $_hgroot/$_hgrepo ./src/$_hgrepo + cd ./src/$_hgrepo fi - else - [[ ! -d ./src/ ]] && mkdir ./src/ - hg clone $_hgroot/$_hgrepo ./src/$_hgrepo - cd ./src/$_hgrepo - fi - newpkgver=$(hg tip --template "{rev}") - cd ../../ - fi + newpkgver=$(hg tip --template "{rev}") + cd ../../ + ;; + esac if [[ -n $newpkgver ]]; then msg2 "$(gettext "Version found: %s")" "$newpkgver" |