abuild: fix cmd: provides to not provide directory names

/usr/bin/somedirectory/ was providing cmd:somedirectory, because dirs
have +x.
This commit is contained in:
psykose 2023-06-15 12:37:24 +00:00
parent 5d4e763459
commit 8f41a924e3
3 changed files with 48 additions and 2 deletions

View File

@ -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##*/}

View File

@ -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
}

View File

@ -0,0 +1,33 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# 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" <<EOF
#!/bin/sh
EOF
chmod +x "$pkgdir/usr/bin/foo"
mkdir -p "$pkgdir/usr/bin/dir/"
}