From c1122b219ac74f2e63c83531325c91f432f3b45f Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 14 Dec 2024 12:22:25 -0500 Subject: [PATCH] common/hooks/pre-pkg/04-generate-provides: reorganise use only one mapfile to make things neater --- common/hooks/pre-pkg/04-generate-provides.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/common/hooks/pre-pkg/04-generate-provides.sh b/common/hooks/pre-pkg/04-generate-provides.sh index 234c19ac8ee..18302434214 100644 --- a/common/hooks/pre-pkg/04-generate-provides.sh +++ b/common/hooks/pre-pkg/04-generate-provides.sh @@ -3,9 +3,17 @@ # This hook executes the following tasks: # - Generates provides file with provides entries for xbps-create(1) +get_explicit_provides() { + # include explicit values from the template + if [ -n "$provides" ]; then + printf '%s\n' $provides + fi +} + generate_python_provides() { local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3" + # get the canonical python package names for each python module if [ -z "$nopyprovides" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \ "${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \ @@ -14,11 +22,12 @@ generate_python_provides() { } hook() { - # include explicit values from the template - local -a _provides=($provides) + local -a _provides - # get the canonical python package names for each python module - mapfile -t -O "${#_provides[@]}" _provides < <( generate_python_provides ) + mapfile -t _provides < <( + get_explicit_provides + generate_python_provides + ) if [ "${#_provides[@]}" -gt 0 ]; then echo " ${_provides[*]}"