[pacman-dev] [PATCH 06/11] makepkg: less code repetition for emtpy variable checking

Dan McGee dpmcgee at gmail.com
Thu Jun 17 10:29:37 EDT 2010


On Thu, Jun 17, 2010 at 7:44 AM, Andres P <aepd87 at gmail.com> wrote:
> Signed-off-by: Andres P <aepd87 at gmail.com>
> ---

Looks good, outside of the spelling error in the title. emtpy -> empty

>  scripts/makepkg.sh.in |   19 +++++++------------
>  1 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 630d9c2..23e3b36 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1163,18 +1163,13 @@ install_package() {
>
>  check_sanity() {
>        # check for no-no's in the build script
> -       if [[ -z $pkgname ]]; then
> -               error "$(gettext "%s is not allowed to be empty.")" "pkgname"
> -               return 1
> -       fi
> -       if [[ -z $pkgver ]]; then
> -               error "$(gettext "%s is not allowed to be empty.")" "pkgver"
> -               return 1
> -       fi
> -       if [[ -z $pkgrel ]]; then
> -               error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
> -               return 1
> -       fi
> +       local i
> +       for i in 'pkgname' 'pkgrel' 'pkgver'; do
> +               if [[ -z ${!i} ]]; then
> +                       error "$(gettext "%s is not allowed to be empty.")" "$i"
> +                       return 1
> +               fi
> +       done
>
>        local name
>        for name in "${pkgname[@]}"; do
> --
> 1.7.1
>
>
>


More information about the pacman-dev mailing list