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 <eschwa...@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

Reply via email to