common/hooks/pre-pkg/04-generate-provides: reorganise

use only one mapfile to make things neater
This commit is contained in:
classabbyamp 2024-12-14 12:22:25 -05:00 committed by classabbyamp
parent c97314f9da
commit c1122b219a

View File

@ -3,9 +3,17 @@
# This hook executes the following tasks: # This hook executes the following tasks:
# - Generates provides file with provides entries for xbps-create(1) # - 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() { generate_python_provides() {
local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3" 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 if [ -z "$nopyprovides" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then
PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \ PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \
"${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \ "${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \
@ -14,11 +22,12 @@ generate_python_provides() {
} }
hook() { hook() {
# include explicit values from the template local -a _provides
local -a _provides=($provides)
# get the canonical python package names for each python module mapfile -t _provides < <(
mapfile -t -O "${#_provides[@]}" _provides < <( generate_python_provides ) get_explicit_provides
generate_python_provides
)
if [ "${#_provides[@]}" -gt 0 ]; then if [ "${#_provides[@]}" -gt 0 ]; then
echo " ${_provides[*]}" echo " ${_provides[*]}"