[pacman-dev] [PATCH] makepkg: allow pkgname usage in split package functions

Allan McRae allan at archlinux.org
Fri Dec 24 22:17:28 EST 2010


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 <allan at archlinux.org>
---
 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 ${pkgname[@]}; do
-		pkgdir="$pkgdir/$pkg"
+	local pkgname_backup=${pkgname[@]}
+	for pkgname in ${pkgname_backup[@]}; 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_backup[@]}
 }
 
 # Canonicalize a directory path if it exists
-- 
1.7.3.4



More information about the pacman-dev mailing list