[pacman-dev] [PATCH] makepkg: tidy version package tests
The use if "! -z" to check if a string is not null is not good practice so replace with the "-n" option. Also use the AND comparison within one test rather than on two separate tests. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3b7490a..57f0a59 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1145,27 +1145,27 @@ devel_check() { # number to avoid having to determine the version number twice. # Also do a brief check to make sure we have the VCS tool available. oldpkgver=$pkgver - if [ ! -z ${_darcstrunk} ] && [ ! -z ${_darcsmod} ] ; then + if [ -n "${_darcstrunk}" -a -n "${_darcsmod}" ] ; then [ $(type -p darcs) ] || return 0 msg "$(gettext "Determining latest darcs revision...")" newpkgver=$(date +%Y%m%d) - elif [ ! -z ${_cvsroot} ] && [ ! -z ${_cvsmod} ] ; then + elif [ -n "${_cvsroot}" -a -n "${_cvsmod}" ] ; then [ $(type -p cvs) ] || return 0 msg "$(gettext "Determining latest cvs revision...")" newpkgver=$(date +%Y%m%d) - elif [ ! -z ${_gitroot} ] && [ ! -z ${_gitname} ] ; then + elif [ -n "${_gitroot}" -a -n "${_gitname}" ] ; then [ $(type -p git) ] || return 0 msg "$(gettext "Determining latest git revision...")" newpkgver=$(date +%Y%m%d) - elif [ ! -z ${_svntrunk} ] && [ ! -z ${_svnmod} ] ; then + elif [ -n "${_svntrunk}" -a -n "${_svnmod}" ] ; then [ $(type -p svn) ] || return 0 msg "$(gettext "Determining latest svn revision...")" newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') - elif [ ! -z ${_bzrtrunk} ] && [ ! -z ${_bzrmod} ] ; then + elif [ -n "${_bzrtrunk}" -a -n "${_bzrmod}" ] ; then [ $(type -p bzr) ] || return 0 msg "$(gettext "Determining latest bzr revision...")" newpkgver=$(bzr revno ${_bzrtrunk}) - elif [ ! -z ${_hgroot} ] && [ ! -z ${_hgrepo} ] ; then + elif [ -n "${_hgroot}" -a -n "${_hgrepo}" ] ; then [ $(type -p hg) ] || return 0 msg "$(gettext "Determining latest hg revision...")" if [ -d ./src/$_hgrepo ] ; then -- 1.6.1
On Thu, Jan 1, 2009 at 10:37 PM, Allan McRae <allan@archlinux.org> wrote:
The use if "! -z" to check if a string is not null is not good practice so replace with the "-n" option. Also use the AND comparison within one test rather than on two separate tests.
Signed-off-by: Allan McRae <allan@archlinux.org>
Looks good to me, maint- worthy? I really need to jump on making this darnded release, don't I... -Dan
Dan McGee wrote:
On Thu, Jan 1, 2009 at 10:37 PM, Allan McRae <allan@archlinux.org> wrote:
The use if "! -z" to check if a string is not null is not good practice so replace with the "-n" option. Also use the AND comparison within one test rather than on two separate tests.
Signed-off-by: Allan McRae <allan@archlinux.org>
Looks good to me, maint- worthy?
I'm not worried on this one really. It is not an actual problem, just a potential one so up to you.
I really need to jump on making this darnded release, don't I..
We really need to get a fix for that whole umask issue first (now we have figured out the cause). Allan
On Thu, Jan 1, 2009 at 10:44 PM, Allan McRae <allan@archlinux.org> wrote:
Dan McGee wrote:
On Thu, Jan 1, 2009 at 10:37 PM, Allan McRae <allan@archlinux.org> wrote:
The use if "! -z" to check if a string is not null is not good practice so replace with the "-n" option. Also use the AND comparison within one test rather than on two separate tests.
Signed-off-by: Allan McRae <allan@archlinux.org>
Looks good to me, maint- worthy?
I'm not worried on this one really. It is not an actual problem, just a potential one so up to you.
I really need to jump on making this darnded release, don't I..
We really need to get a fix for that whole umask issue first (now we have figured out the cause).
OK we'll blame the late release on you then! :) As long as we aren't going to have more message updates, I can at least try to round up the translations sometime this week and then hopefully solidify what will go in the package. -Dan
participants (2)
-
Allan McRae
-
Dan McGee