commit:     dd72b19880b7788843ae71a199f91043ce67c61d
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug  9 02:56:53 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun  5 11:22:09 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dd72b198

phase-helpers.sh: use test -v instead of ${param:+set}

Wherever there is a need to test whether a variable is set, employ the
[[ -v name ]] command to do so. This is supported as of bash-4.2.

Further, add a comment to the __eapi4_src_install() function, explaining
why declare -p continues to be used there.

Link: https://projects.gentoo.org/pms/4/pms.html#x1-10400010.1.9
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/phase-helpers.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index f006aa92e0..918aaab75c 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -681,7 +681,7 @@ einstall() {
                libdir="${!libdir_var}"
        fi
 
-       if [[ -n "${libdir}" && "${CONF_PREFIX:+set}" = set ]]; then
+       if [[ "${libdir}" && -v CONF_PREFIX ]]; then
                local destlibdir="${D%/}/${CONF_PREFIX}/${libdir}"
                destlibdir="$(__strip_duplicate_slashes "${destlibdir}")"
                LOCAL_EXTRA_EINSTALL="libdir=${destlibdir} 
${LOCAL_EXTRA_EINSTALL}"
@@ -788,6 +788,10 @@ __eapi4_src_install() {
                emake DESTDIR="${D}" install
        fi
 
+       # To use declare -p determines whether a variable was declared but not
+       # whether it was set. Unfortunately, the language of EAPI 4 requires
+       # that it be this way.
+       # https://projects.gentoo.org/pms/4/pms.html#x1-10400010.1.9
        if ! declare -p DOCS &>/dev/null ; then
                local d
                for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \

Reply via email to