srcinfo.sh: remove trailing newline

When a .SRCINFO file is generated via `makepkg --printsrcinfo`, each
section is concluded with an empty line. This means that at the end of
the file, an empty line remains. This is considered a trailing
whitespace error. In fact, `git diff --check` will warn about this,
saying "new blank line at EOF."

Instead of closing each section off with an empty line, use the empty
line to separate sections, omitting the empty line at the end of the
file.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Denton Liu 2020-06-25 19:29:40 -04:00 committed by Allan McRae
parent 84723cab5d
commit 6b9c1b4d54

View file

@ -30,7 +30,7 @@ srcinfo_open_section() {
printf '%s = %s\n' "$1" "$2" printf '%s = %s\n' "$1" "$2"
} }
srcinfo_close_section() { srcinfo_separate_section() {
echo echo
} }
@ -94,7 +94,6 @@ srcinfo_write_global() {
srcinfo_open_section 'pkgbase' "${pkgbase:-$pkgname}" srcinfo_open_section 'pkgbase' "${pkgbase:-$pkgname}"
srcinfo_write_section_details '' srcinfo_write_section_details ''
srcinfo_close_section
} }
srcinfo_write_package() { srcinfo_write_package() {
@ -104,7 +103,6 @@ srcinfo_write_package() {
srcinfo_open_section 'pkgname' "$1" srcinfo_open_section 'pkgname' "$1"
srcinfo_write_section_details "$1" srcinfo_write_section_details "$1"
srcinfo_close_section
} }
write_srcinfo_header() { write_srcinfo_header() {
@ -118,6 +116,7 @@ write_srcinfo_content() {
srcinfo_write_global srcinfo_write_global
for pkg in "${pkgname[@]}"; do for pkg in "${pkgname[@]}"; do
srcinfo_separate_section
srcinfo_write_package "$pkg" srcinfo_write_package "$pkg"
done done
} }