diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-09-03 15:47:10 -0400 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-09-18 14:28:03 +1000 |
commit | 2091f7ab163926cdc6e6d5bfb1195ff36a6119a4 (patch) | |
tree | f3e6379e40cfdedfe78626244a20c0a4e76bc981 | |
parent | cfbc4fe8098dd992258648470b76d2dce081af01 (diff) |
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>
-rw-r--r-- | scripts/makepkg.sh.in | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5a74b3ed..0825600f 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1146,14 +1146,8 @@ generate_checksums() { fi local ct=0 - local numsrc=${#source[@]} - printf "%s" "${integ}sums=(" - - local i - local indent='' - for (( i = 0; i < ${#integ} + 6; i++ )); do - indent="$indent " - done + local indentsz numsrc=${#source[@]} + printf "%s%n" "${integ}sums=(" indentsz local netfile for netfile in "${source[@]}"; do @@ -1176,10 +1170,11 @@ generate_checksums() { ;; esac - (( ct )) && printf "%s" "$indent" - printf "%s" "'$sum'" - ct=$(($ct+1)) - (( $ct < $numsrc )) && echo + # indent checksum on lines after the first + printf "%*s%s" $(( ct ? indentsz : 0 )) '' "'$sum'" + + # print a newline on lines before the last + (( ++ct < numsrc )) && echo done echo ")" |