abuild: set GIT_CEILING_DIRECTORIES before running prepare/build/check/package

This commit is contained in:
ptrcnull 2022-03-19 10:15:06 +01:00
parent 4dbf8e3756
commit 33ce0536ef
No known key found for this signature in database
GPG Key ID: 411F7B30801DD9CA
2 changed files with 34 additions and 1 deletions

View File

@ -674,6 +674,8 @@ runpart() {
if [ -d "$builddir" ]; then
case "$part" in
prepare|build|package|check)
# exclude aports from git repo discovery
export GIT_CEILING_DIRECTORIES="$startdir"
cd "$builddir";;
esac
fi

View File

@ -21,7 +21,8 @@ init_tests \
abuild_invalid_pkgnames \
abuild_invalid_subpkgnames \
abuild_invalid_subpkg_version \
abuild_multiline_license
abuild_multiline_license \
abuild_git_ceiling
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
export ABUILD_CONF=/dev/null
@ -412,3 +413,33 @@ abuild_multiline_license_body() {
atf_check -o match:'^license = MIT AND GPL-3.0-only OR GPL-3.0-or-later AND BSD-Clause-4$' \
cat pkg/.control.test-licenses/.PKGINFO
}
abuild_git_ceiling_body() {
init_keys
git init
mkdir git-pkg
cd git-pkg
cat >APKBUILD<<-EOF
# Maintainer: Joe User <juser@example.com>
pkgname="git-pkg"
pkgver="1.0"
pkgrel=0
pkgdesc="Dummy test package"
url="https://gitlab.alpinelinux.org/alpine/aports"
arch="noarch"
license="MIT"
prepare() {
mkdir -p "\$builddir"
}
build() {
git status
}
package() {
mkdir -p "\$pkgdir"
}
EOF
atf_check -s exit:1 \
-e match:"not a git repository" \
-e match:"ERROR: git-pkg: build failed" \
abuild
}