[pacman-dev] Patch makepkg to use more [[ and (( bash syntax

Cedric Staniewski cedric at gmx.ca
Mon Oct 26 07:46:04 EDT 2009


Isaac Good wrote:
> See http://bugs.archlinux.org/task/16623 too
> 
>> >From d71c1f120351c0ab7396f5aabbe9cf0497621782 Mon Sep 17 00:00:00 2001
> From: Isaac Good <arch at isaac.otherinbox.com>
> Date: Sun, 25 Oct 2009 19:19:18 -0400
> Subject: [PATCH] Signed-off-by: Isaac Good <arch at isaac.otherinbox.com>
> 
> Modified makepkg to use more of [[ ]] and (( )) bash constructs
> Added quotes to variables in a few places that were missing them or
> had {} instead
> ---
>  scripts/makepkg.sh.in |  594 ++++++++++++++++++++++++-------------------------
>  1 files changed, 296 insertions(+), 298 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 9cd7f2e..16a4f76 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -82,22 +82,25 @@ PACMAN_OPTS=
>  ### SUBROUTINES ###
> 
>  plain() {
> -	local mesg=$1; shift
> +	local mesg="$1"; shift
>  	printf "${BOLD}    ${mesg}${ALL_OFF}\n" "$@" >&2
>  }
> 
>  msg() {
> -	local mesg=$1; shift
> +}
> +
> +msg() {
> +	local mesg="$1"; shift
>  	printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
>  }
> 
>  msg2() {
> -	local mesg=$1; shift
> +	local mesg="$1"; shift
>  	printf "${BLUE}  ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
>  }
> 
>  warning() {
> -	local mesg=$1; shift
> +	local mesg="$1"; shift
>  	printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD}
> ${mesg}${ALL_OFF}\n" "$@" >&2
>  }
>  <snip>

Before you split this patch, just a small note. You do not have to use quotes for assignment like

mesg=$1

and given that you remove quotes everywhere else, I do not think we want to add new ones here.

> $ a="asdf gfd gfd "
> $ b="jggd dsf ds"
> $ c=$a
> $ echo $c
> asdf gfd gfd
> $ c=$a$b
> $ echo $c
> asdf gfd gfd jggd dsf ds
> $ c=$a/$b
> $ echo $c
> asdf gfd gfd /jggd dsf ds



More information about the pacman-dev mailing list