diff --git a/abuild.in b/abuild.in index 7aa782566e2414dc9e8cf109b6cab6399c61ad62..6d776a4b49cc0c9b13113eec2a0c379f17cbb200 100755 --- a/abuild.in +++ b/abuild.in @@ -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 diff --git a/tests/abuild_test b/tests/abuild_test index 278ff782f5a324f71f9aee4431f8ed482ad9b1ac..ee25f969f6f51a243570d6e39aa2eb8fa1e54ec1 100755 --- a/tests/abuild_test +++ b/tests/abuild_test @@ -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 +}