mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
makepkg: inline creation of checksum indenting
With some simple math and printf formatting tokens, we can create the whitespace necessary for this without the need for a loop and string concatentation. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
cfbc4fe809
commit
2091f7ab16
@ -1146,14 +1146,8 @@ generate_checksums() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local ct=0
|
local ct=0
|
||||||
local numsrc=${#source[@]}
|
local indentsz numsrc=${#source[@]}
|
||||||
printf "%s" "${integ}sums=("
|
printf "%s%n" "${integ}sums=(" indentsz
|
||||||
|
|
||||||
local i
|
|
||||||
local indent=''
|
|
||||||
for (( i = 0; i < ${#integ} + 6; i++ )); do
|
|
||||||
indent="$indent "
|
|
||||||
done
|
|
||||||
|
|
||||||
local netfile
|
local netfile
|
||||||
for netfile in "${source[@]}"; do
|
for netfile in "${source[@]}"; do
|
||||||
@ -1176,10 +1170,11 @@ generate_checksums() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
(( ct )) && printf "%s" "$indent"
|
# indent checksum on lines after the first
|
||||||
printf "%s" "'$sum'"
|
printf "%*s%s" $(( ct ? indentsz : 0 )) '' "'$sum'"
|
||||||
ct=$(($ct+1))
|
|
||||||
(( $ct < $numsrc )) && echo
|
# print a newline on lines before the last
|
||||||
|
(( ++ct < numsrc )) && echo
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ")"
|
echo ")"
|
||||||
|
Loading…
Reference in New Issue
Block a user