abuild: add support for -devhelp subpackges

fixes https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/87
This commit is contained in:
Natanael Copa 2022-08-29 13:47:38 +02:00
parent 7dc9c33c88
commit 396e6e2737
2 changed files with 70 additions and 0 deletions

View File

@ -806,6 +806,11 @@ postcheck() {
&& ! is_doc_pkg "$name"; then
warning "Found /usr/share/doc but package name doesn't end with -doc"
fi
# look for /usr/share/devhelp
if [ -e "$dir"/usr/share/devhelp ] \
&& ! is_devhelp_pkg "$name"; then
warning "Found /usr/share/devhelp but package name doesn't end with -devhelp"
fi
# look for /usr/share/man
if [ -e "$dir"/usr/share/man ]; then
if ! is_doc_pkg "$name"; then
@ -1315,6 +1320,11 @@ is_doc_pkg() {
test "${1%-doc}" != "$1"
}
# returns true if this is the -doc package
is_devhelp_pkg() {
test "${1%-devhelp}" != "$1"
}
# returns true if this is the -openrc package
is_openrc_pkg() {
test "${1%-openrc}" != "$1"
@ -2057,6 +2067,16 @@ openrc() {
default_openrc
}
default_devhelp() {
pkgdesc="$pkgname - devhelp files"
install_if="$pkgname=$pkgver-$pkgrel devhelp"
amove usr/share/devhelp
}
devhelp() {
default_devhelp
}
default_bashcomp() {
depends=""
pkgdesc="Bash completions for $pkgname"

View File

@ -29,6 +29,8 @@ init_tests \
abuild_amove \
abuild_doc \
abuild_dev \
abuild_devhelp_warn \
abuild_devhelp \
abuild_check_maintainer \
abuild_cleanoldpkg \
abuild_path_with_spaces
@ -690,6 +692,54 @@ abuild_dev_body() {
test -L pkg/foo-dev/usr/lib/libfoo.so || atf_fail "libfoo.so failed"
}
abuild_devhelp_warn_body() {
init_keys
mkdir -p foo
cd foo
cat > APKBUILD <<-EOF
# Maintainer: Test User 123 <123@example.com>
pkgname="foo"
pkgver="1.0"
pkgrel=0
pkgdesc='Dummy test package that has devhelp'
url='https://gitlab.alpinelinux.org/alpine/aports'
arch='noarch'
license='MIT'
package() {
mkdir -p "\$pkgdir"/usr/share/devhelp/book
}
EOF
atf_check -e match:"WARNING:" \
abuild rootpkg
}
abuild_devhelp_body() {
init_keys
mkdir -p foo
cd foo
cat > APKBUILD <<-EOF
# Maintainer: Test User 123 <123@example.com>
pkgname="foo"
pkgver="1.0"
pkgrel=0
pkgdesc='Dummy test package that has devhelp'
url='https://gitlab.alpinelinux.org/alpine/aports'
arch='noarch'
license='MIT'
subpackages="\$pkgname-devhelp"
package() {
mkdir -p "\$pkgdir"/usr/share/devhelp/book
}
EOF
atf_check -e not-match:"WARNING:" \
-o match:'->' \
abuild rootpkg
}
abuild_check_maintainer_body() {
mkdir -p foo && cd foo
for m in "Test User 123 <123example.com>" \