[pacman-dev] [PATCH] makepkg: fix regression which broke split pkgbase-debug package metadata

Eli Schwartz eschwartz at archlinux.org
Fri Jun 1 00:31:24 UTC 2018


In commit 9e52a36794552b77ecf26f7f34b226d096978f1e the split package
metadata backup/restore was refactored to use declare, which actually
declares variables in a local scope when in a function. This did not
play nicely with debug packages, which unset most metadata variables,
thereby reverting to the global scope rather than resulting in unset
metadata.

Fix by explicitly marking the variables as global.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---
 scripts/makepkg.sh.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 21737af8..fe3891ce 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1124,7 +1124,12 @@ check_build_status() {
 backup_package_variables() {
 	local var
 	for var in ${splitpkg_overrides[@]}; do
-		declare -p $var 2>/dev/null || printf '%s\n'  "unset $var"
+		if [[ ${!var} ]]; then
+			printf '%s\n' "declare -g $var"
+			declare -p $var
+		else
+			printf '%s\n'  "unset $var"
+		fi
 	done
 }
 
-- 
2.17.1


More information about the pacman-dev mailing list