hooks/gen-provides: Correctly uses builtin provides and mapfile

- `read -r -a' somehow doesn't work with newline, but we don't need to
  invoke a builtin for that, we can just simply assign to the variable
- In `mapfile', `-t' is used for removing newline, not for target. The
  targeting array need to be specified last in the array.

Close #53532
This commit is contained in:
Đoàn Trần Công Danh 2024-12-19 21:24:05 +07:00
parent 11f8137f27
commit ee2368a0e5
1 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# vim: set ts=4 sw=4 et:
# vim: set ts=4 sw=4 ft=bash et:
#
# This hook executes the following tasks:
# - Generates provides file with provides entries for xbps-create(1)
@ -14,13 +14,11 @@ generate_python_provides() {
}
hook() {
local -a _provides=()
# include explicit values from the template
read -r -a _provides <<< "$provides"
local -a _provides=($provides)
# get the canonical python package names for each python module
mapfile -t _provides -O "${#_provides[@]}" < <( generate_python_provides )
mapfile -t -O "${#_provides[@]}" _provides < <( generate_python_provides )
if [ "${#_provides[@]}" -gt 0 ]; then
echo " ${_provides[*]}"