aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Bo Ørsted Andresen <bo.andresen@zlin.dk> 2016-01-15 00:37:38 +0100
committerAvatar Bo Ørsted Andresen <zlin@exherbo.org> 2016-02-19 19:33:10 +0100
commit46bab1c193a83ba35e3e1163812dcc75267a461a (patch)
tree4a0f3c93cf6b7ec290411401237cbac7cd85fbd0
parent054f41f3d4cb3167fb4f6dfb694d5111e36dcb44 (diff)
downloadpaludis-46bab1c193a83ba35e3e1163812dcc75267a461a.tar.gz
paludis-46bab1c193a83ba35e3e1163812dcc75267a461a.tar.xz
Support emptying a default set exparam array.
Add test to verify an exarray with a non-empty default value can be emptied with an empty require parameter. Change-Id: I633f4baa6eaf297308e08ac3899c8821e88f3591 Reviewed-on: https://galileo.mailstation.de/gerrit/4944 Reviewed-by: Bo Ørsted Andresen <zlin@exherbo.org>
-rw-r--r--paludis/repositories/e/e_repository_TEST_exlibs.cc1
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_exlibs_setup.sh23
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash2
3 files changed, 25 insertions, 1 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs.cc b/paludis/repositories/e/e_repository_TEST_exlibs.cc
index e902059..3053936 100644
--- a/paludis/repositories/e/e_repository_TEST_exlibs.cc
+++ b/paludis/repositories/e/e_repository_TEST_exlibs.cc
@@ -186,6 +186,7 @@ INSTANTIATE_TEST_CASE_P(Works, ExlibsTest, testing::Values(
TestInfo{"exarray-spaces", success},
TestInfo{"exarray-default", success},
TestInfo{"exarray-default-spaces", success},
+ TestInfo{"exarray-default-emptied", success},
TestInfo{"exarray-empty", success},
TestInfo{"noarray", success},
TestInfo{"noarray-bad", unsupported},
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh b/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh
index c716db8..c9db490 100755
--- a/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh
@@ -340,6 +340,29 @@ pkg_setup() {
[[ ${FOO[@]} == "1 1 2 2 3 3" ]] || die "FOO[@] != 1 1 2 2 3 3"
}
END
+mkdir -p "packages/cat/exarray-default-emptied"
+cat <<'END' > packages/cat/exarray-default-emptied/foo.exlib || exit 1
+myexparam bar=[ 1 2 3 ]
+
+check_foo() {
+ exparam bar[#] | grep -q ^0$ || die "Bad bar[#]"
+ exparam bar[0] | grep -q ^$ || die "Bad bar[0]"
+ exparam bar[*] | grep -q ^$ || die "Bad bar[*]"
+ exparam -v FOO bar[@]
+}
+END
+cat <<'END' > packages/cat/exarray-default-emptied/exarray-default-emptied-1.ebuild || exit 1
+require foo [ bar=[ ] ]
+WORK="${WORKBASE}"
+PLATFORMS="test"
+
+pkg_setup() {
+ check_foo || die "check_foo returned errror"
+ [[ ${#FOO[@]} -eq 0 ]] || die "Wrong number of elements, ${#FOO[@]} in FOO[@]"
+ [[ -z ${FOO[0]} ]] || die "Bad FOO[0]"
+ [[ -z ${FOO[@]} ]] || die "FOO[@] non-empty"
+}
+END
mkdir -p "packages/cat/exarray-empty"
cat <<'END' > packages/cat/exarray-empty/foo.exlib || exit 1
myexparam bar=[ ]
diff --git a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
index 0ee74ed..3808272 100644
--- a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
@@ -116,7 +116,7 @@ myexparam()
fi
v=$(exparam_var_name ${CURRENT_EXLIB})_${v%\[\]}
- if [[ -z ${!v+set} && ${1} == *=* ]]; then
+ if ! declare -p ${v} &>/dev/null && [[ ${1} == *=* ]]; then
if [[ ${1} == *=\[ && ${#} -gt 1 ]]; then
shift
local i a=()