Currently, using $pkgname in a split package package_*() function
always returns the first value in the pkgname array rather than the
name of tha package being packaged.  Fix this so $pkgname gives the
expected value.

Fixes FS#22174

Signed-off-by: Allan McRae <[email protected]>
---
 scripts/makepkg.sh.in |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7042e76..5ac71ed 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1414,17 +1414,19 @@ restore_package_variables() {
 }
 
 run_split_packaging() {
-       for pkg in ${pkgna...@]}; do
-               pkgdir="$pkgdir/$pkg"
+       local pkgname_backup=${pkgna...@]}
+       for pkgname in ${pkgname_back...@]}; do
+               pkgdir="$pkgdir/$pkgname"
                mkdir -p "$pkgdir"
                chmod a-s "$pkgdir"
                backup_package_variables
-               run_package $pkg
+               run_package $pkgname
                tidy_install
-               create_package $pkg
+               create_package $pkgname
                restore_package_variables
                pkgdir="${pkgdir%/*}"
        done
+       pkgname=${pkgname_back...@]}
 }
 
 # Canonicalize a directory path if it exists
-- 
1.7.3.4


Reply via email to