mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
makepkg: use mapfile where plausible
With bash4 as a requirement, we can use mapfile when reading command output into an array. mapfile has the advantage of using block buffered I/O rather than line buffered I/O, making it slightly faster for most jobs. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This commit is contained in:
parent
c2fdc38b78
commit
9d3e59e311
@ -1075,9 +1075,8 @@ tidy_install() {
|
|||||||
# find hard links and remove them
|
# find hard links and remove them
|
||||||
# the '|| true' part keeps the script from bailing on the EOF returned
|
# the '|| true' part keeps the script from bailing on the EOF returned
|
||||||
# by read at the end of the find output
|
# by read at the end of the find output
|
||||||
IFS=$'\n' read -rd '' -a hardlinks < \
|
mapfile -t hardlinks < \
|
||||||
<(find ${MAN_DIRS[@]} \! -name "$file" -samefile "$manpage" \
|
<(find ${MAN_DIRS[@]} ! -name "$file" -samefile "$manpage" 2>/dev/null)
|
||||||
2>/dev/null || true) || true
|
|
||||||
rm -f "${hardlinks[@]}"
|
rm -f "${hardlinks[@]}"
|
||||||
# compress the original
|
# compress the original
|
||||||
gzip -9 "$manpage"
|
gzip -9 "$manpage"
|
||||||
@ -1162,7 +1161,7 @@ find_libprovides() {
|
|||||||
missing=0
|
missing=0
|
||||||
case "$p" in
|
case "$p" in
|
||||||
*.so)
|
*.so)
|
||||||
IFS=$'\n' read -rd '' -a filename < <(find "$pkgdir" -type f -name $p\*)
|
mapfile -t filename < <(find "$pkgdir" -type f -name $p\*)
|
||||||
if [[ $filename ]]; then
|
if [[ $filename ]]; then
|
||||||
# packages may provide multiple versions of the same library
|
# packages may provide multiple versions of the same library
|
||||||
for fn in "${filename[@]}"; do
|
for fn in "${filename[@]}"; do
|
||||||
@ -1253,14 +1252,14 @@ write_pkginfo() {
|
|||||||
[[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]//+([[:space:]])/ }"
|
[[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]//+([[:space:]])/ }"
|
||||||
[[ $conflicts ]] && printf "conflict = %s\n" "${conflicts[@]}"
|
[[ $conflicts ]] && printf "conflict = %s\n" "${conflicts[@]}"
|
||||||
|
|
||||||
IFS=$'\n' read -rd '' -a provides < <(find_libprovides)
|
mapfile -t provides < <(find_libprovides)
|
||||||
[[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
|
[[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
|
||||||
|
|
||||||
[[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
|
[[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
|
||||||
|
|
||||||
|
|
||||||
local it
|
local it
|
||||||
IFS=$'\n' read -rd '' -a libdepends < <(find_libdepends)
|
mapfile -t libdepends < <(find_libdepends)
|
||||||
depends+=("${libdepends[@]}")
|
depends+=("${libdepends[@]}")
|
||||||
|
|
||||||
for it in "${depends[@]}"; do
|
for it in "${depends[@]}"; do
|
||||||
|
Loading…
Reference in New Issue
Block a user