summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-13 04:13:11 +0200
committerDan McGee <dan@archlinux.org>2012-05-21 00:39:21 +0200
commit9d3e59e311a863e140699dd2eaec7c0b0bf632f4 (patch)
treefef07f447f86e39d08bbc6e175be6d14151223c9 /scripts
parentc2fdc38b78d9b83e783ff2ec3f8c4d53e7f45634 (diff)
downloadpacman-9d3e59e311a863e140699dd2eaec7c0b0bf632f4.tar.gz
pacman-9d3e59e311a863e140699dd2eaec7c0b0bf632f4.tar.xz
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in11
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d36dbd63..44b1c2cb 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1075,9 +1075,8 @@ tidy_install() {
# find hard links and remove them
# the '|| true' part keeps the script from bailing on the EOF returned
# by read at the end of the find output
- IFS=$'\n' read -rd '' -a hardlinks < \
- <(find ${MAN_DIRS[@]} \! -name "$file" -samefile "$manpage" \
- 2>/dev/null || true) || true
+ mapfile -t hardlinks < \
+ <(find ${MAN_DIRS[@]} ! -name "$file" -samefile "$manpage" 2>/dev/null)
rm -f "${hardlinks[@]}"
# compress the original
gzip -9 "$manpage"
@@ -1162,7 +1161,7 @@ find_libprovides() {
missing=0
case "$p" in
*.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
# packages may provide multiple versions of the same library
for fn in "${filename[@]}"; do
@@ -1253,14 +1252,14 @@ write_pkginfo() {
[[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]//+([[:space:]])/ }"
[[ $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[@]}"
[[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
local it
- IFS=$'\n' read -rd '' -a libdepends < <(find_libdepends)
+ mapfile -t libdepends < <(find_libdepends)
depends+=("${libdepends[@]}")
for it in "${depends[@]}"; do