diff --git a/abuild.in b/abuild.in index 2bc318d..81d5183 100755 --- a/abuild.in +++ b/abuild.in @@ -1004,7 +1004,7 @@ check_license() { } check_secfixes_comment() { - local c=$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' $APKBUILD | grep '^#') + local c=$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' "$APKBUILD" | grep '^#') local invalid=$(echo "$c" \ | grep -v -E '(^# secfixes:|^# +- [A-Z0-9-]+|^# [0-9]+.*:$|^#$)') if [ -z "$invalid" ]; then @@ -1706,7 +1706,7 @@ create_apks() { if ! options_has "!tracedeps"; then for file in "$pkgbasedir"/.control.*/.PKGINFO; do dir="${file%/.PKGINFO}" - name="$(pkginfo_val pkgname $file)" + name="$(pkginfo_val pkgname "$file")" datadir="$pkgbasedir"/$name subpkgname=$name scan_shared_objects "$name" "$dir" "$datadir" @@ -1719,13 +1719,13 @@ create_apks() { for file in "$pkgbasedir"/.control.*/.PKGINFO; do local dir="${file%/.PKGINFO}" - local name=$(pkginfo_val pkgname $file) - local ver=$(pkginfo_val pkgver $file) - local size=$(pkginfo_val size $file | human_size) + local name=$(pkginfo_val pkgname "$file") + local ver=$(pkginfo_val pkgver "$file") + local size=$(pkginfo_val size "$file" | human_size) local apk=$name-$ver.apk local datadir="$pkgbasedir"/$name local subpkgname=$name - local subpkgarch=$(pkginfo_val arch $file) + local subpkgarch=$(pkginfo_val arch "$file") trace_apk_deps "$name" "$dir" "$subpkgarch" || return 1 msg "Package size: ${size}" diff --git a/tests/abuild_test b/tests/abuild_test index 2378bca..b907251 100755 --- a/tests/abuild_test +++ b/tests/abuild_test @@ -30,7 +30,8 @@ init_tests \ abuild_doc \ abuild_dev \ abuild_check_maintainer \ - abuild_cleanoldpkg + abuild_cleanoldpkg \ + abuild_path_with_spaces export ABUILD_SHAREDIR=$(atf_get_srcdir)/.. export ABUILD_CONF=/dev/null @@ -763,3 +764,13 @@ abuild_cleanoldpkg_body() { fi done } + +abuild_path_with_spaces_body() { + init_keys + cp -ra "$testrepo" . + cd testrepo/pkg\ path\ with\ spaces + atf_check -s exit:0 \ + -o match:"hello world" \ + -e match:"Build complete" \ + abuild +} diff --git a/tests/testrepo/pkg path with spaces/APKBUILD b/tests/testrepo/pkg path with spaces/APKBUILD new file mode 100644 index 0000000..9a1687a --- /dev/null +++ b/tests/testrepo/pkg path with spaces/APKBUILD @@ -0,0 +1,35 @@ +# Maintainer: Natanael Copa + +# test package +pkgname="pkg-path-with-spaces" +pkgver="1.0" +pkgrel=0 +pkgdesc="Dummy test package to test building with spaces in path" +url="https://gitlab.alpinelinux.org/alpine/aports" +arch="all" +license="MIT" +source="hello.c" +builddir="$srcdir/$pkgname-1.0" + +prepare() { + mkdir -p "$builddir" + cp "$srcdir"/*.c "$builddir" +} + +build() { + ${CC:-gcc} -o hello hello.c +} + +check() { + ./hello +} + +package() { + install -D -m755 hello "$pkgdir"/usr/bin/hello + ln "$pkgdir"/usr/bin/hello "$pkgdir"/usr/bin/hello-hard + ln -s "$pkgdir"/usr/bin/hello "$pkgdir"/usr/bin/hello-sym +} + +sha512sums=" +e80c0d471f7ec07708795b86127f0f7c968c49031f1e57cae200b5fbf2606e55fc4d56efb05a85c6f54dfe33e87d6789154cf15aee72ba0d216f08fb57926503 hello.c +" diff --git a/tests/testrepo/pkg path with spaces/hello.c b/tests/testrepo/pkg path with spaces/hello.c new file mode 100644 index 0000000..6734752 --- /dev/null +++ b/tests/testrepo/pkg path with spaces/hello.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("hello world\n"); + return 0; +}