[pacman-dev] [PATCH 09/11] makepkg: merge in-line splitpkg handling logic

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


On Thu, Jun 17, 2010 at 7:44 AM, Andres P <aepd87 at gmail.com> wrote:
> Ease maintainace; the two parts that have been combined into a function were
> identical.
>
> Signed-off-by: Andres P <aepd87 at gmail.com>
> ---

Seems reasonable.

Signed-off-by: Dan McGee <dan at archlinux.org>

>  scripts/makepkg.sh.in |   38 ++++++++++++++++----------------------
>  1 files changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index cf23fdb..6de6100 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1371,6 +1371,20 @@ restore_package_variables() {
>        done
>  }
>
> +handle_splitpkg() {
> +       for pkg in ${pkgname[@]}; do
> +               pkgdir="$pkgdir/$pkg"
> +               mkdir -p "$pkgdir"
> +               chmod a-s "$pkgdir"
> +               backup_package_variables
> +               run_package $pkg
> +               tidy_install
> +               create_package $pkg
> +               restore_package_variables
> +               pkgdir="${pkgdir%/*}"
> +       done
> +}
> +
>  # getopt like parser
>  parse_options() {
>        local short_options=$1; shift;
> @@ -1838,17 +1852,7 @@ if (( INFAKEROOT )); then
>                fi
>                create_package
>        else
> -               for pkg in ${pkgname[@]}; do
> -                       pkgdir="$pkgdir/$pkg"
> -                       mkdir -p "$pkgdir"
> -                       chmod a-s "$pkgdir"
> -                       backup_package_variables
> -                       run_package $pkg
> -                       tidy_install
> -                       create_package $pkg
> -                       restore_package_variables
> -                       pkgdir="${pkgdir%/*}"
> -               done
> +               handle_splitpkg
>        fi
>
>        msg "$(gettext "Leaving fakeroot environment.")"
> @@ -1966,17 +1970,7 @@ else
>                        fi
>                        create_package
>                else
> -                       for pkg in ${pkgname[@]}; do
> -                               pkgdir="$pkgdir/$pkg"
> -                               mkdir -p "$pkgdir"
> -                               chmod a-s "$pkgdir"
> -                               backup_package_variables
> -                               run_package $pkg
> -                               tidy_install
> -                               create_package $pkg
> -                               restore_package_variables
> -                               pkgdir="${pkgdir%/*}"
> -                       done
> +                       handle_splitpkg
>                fi
>        else
>                if (( ! REPKG && ( PKGFUNC || SPLITPKG ) )); then
> --
> 1.7.1
>
>
>


More information about the pacman-dev mailing list