Ease maintainace; the two parts that have been combined into a function were
identical.

Signed-off-by: Andres P <[email protected]>
---
 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 ${pkgna...@]}; 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 ${pkgna...@]}; 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 ${pkgna...@]}; 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


Reply via email to