From 8f41a924e3badfdeb50d16b63f51a946af497473 Mon Sep 17 00:00:00 2001 From: psykose Date: Thu, 15 Jun 2023 12:37:24 +0000 Subject: [PATCH] abuild: fix cmd: provides to not provide directory names /usr/bin/somedirectory/ was providing cmd:somedirectory, because dirs have +x. --- abuild.in | 2 +- tests/abuild_test | 15 ++++++++++++- tests/testrepo/bin-in-path/APKBUILD | 33 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tests/testrepo/bin-in-path/APKBUILD diff --git a/abuild.in b/abuild.in index 30f363d..e842220 100755 --- a/abuild.in +++ b/abuild.in @@ -1267,7 +1267,7 @@ prepare_command_provides() { options_has "!tracedeps" && return 0 cd "$dir" || return 1 for i in bin/* sbin/* usr/bin/* usr/sbin/*; do - if ! [ -x "$i" ]; then + if ! [ -x "$i" ] || ! [ -f "$i" ]; then continue fi local f=${i##*/} diff --git a/tests/abuild_test b/tests/abuild_test index 8b0df3d..5edea40 100755 --- a/tests/abuild_test +++ b/tests/abuild_test @@ -41,7 +41,8 @@ init_tests \ abuild_pyc_warn \ abuild_pyc \ abuild_setcap_binary \ - abuild_setcap_binary_with_option + abuild_setcap_binary_with_option \ + abuild_command_provides export ABUILD_SHAREDIR=$(atf_get_srcdir)/.. export ABUILD_CONF=/dev/null @@ -944,3 +945,15 @@ abuild_setcap_binary_with_option_body() { -e match:"Found setcap binary executable by others" \ abuild all } + +abuild_command_provides_body() { + init_keys + cp -ra "$testrepo"/bin-in-path . + cd bin-in-path + abuild rootpkg + + atf_check \ + -o match:"provides = cmd:foo=1.0-r0" \ + -o not-match:"provides = cmd:dir=1.0-r0" \ + grep '^provides = ' pkg/.control.bin-in-path/.PKGINFO +} diff --git a/tests/testrepo/bin-in-path/APKBUILD b/tests/testrepo/bin-in-path/APKBUILD new file mode 100644 index 0000000..d84a21a --- /dev/null +++ b/tests/testrepo/bin-in-path/APKBUILD @@ -0,0 +1,33 @@ +# Maintainer: Natanael Copa + +# test package +pkgname=bin-in-path +pkgver=1.0 +pkgrel=0 +pkgdesc="Dummy test package that installs a file and directory in path" +url="https://gitlab.alpinelinux.org/alpine/aports" +arch="noarch" +license="MIT" +source="" + +prepare() { + mkdir -p "$builddir" +} + +build() { + true +} + +check() { + true +} + +package() { + mkdir -p "$pkgdir/usr/bin" + cat >"$pkgdir/usr/bin/foo" <