From 9b1ab3d76713d99a11d8da2204557856d59bd3a5 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 10 Feb 2012 08:20:13 +1000 Subject: makepkg: deal with mercurial exit codes From mercurial-2.1, "hg pull" returns 1 when there are no updates. Catch the return code and either pull the update or return an error as appropriate. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 6a1f3141..a10dc5d3 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1730,8 +1730,13 @@ devel_check() { msg "$(gettext "Determining latest %s revision...")" 'hg' if [[ -d ./src/$_hgrepo ]] ; then cd ./src/$_hgrepo - hg pull - hg update + 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 -- cgit v1.2.3-24-g4f1b From 31432edcbe484a5fca01abff77359061ae813fcc Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 11 Feb 2012 14:15:38 +1000 Subject: makepkg: disable extglob when sourcing BUILDSCRIPT PKGBUILDs are advertised as being pure bash so it would be expected that the default bash options are in effect when sourcing it. This inadvertantly "fixes" FS#27780 where enabling extglob causes the bash parser to error on non-valid bash function names like package_libxml++(). Note that these function names are unsupported in bash and could break again even with this "fix" in future bash releases. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index a10dc5d3..80bb1c94 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2106,7 +2106,9 @@ if [[ ! -f $BUILDFILE ]]; then else # PKGBUILD passed through a pipe BUILDFILE=/dev/stdin + shopt -u extglob source "$BUILDFILE" + shopt -s extglob fi else crlftest=$(file "$BUILDFILE" | grep -F 'CRLF' || true) @@ -2118,7 +2120,9 @@ else if [[ ${BUILDFILE:0:1} != "/" ]]; then BUILDFILE="$startdir/$BUILDFILE" fi + shopt -u extglob source "$BUILDFILE" + shopt -s extglob fi # set defaults if they weren't specified in buildfile -- cgit v1.2.3-24-g4f1b