From 33ce0536efbf3eeda7ee51e8265e0423f1b795e1 Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Sat, 19 Mar 2022 10:15:06 +0100 Subject: [PATCH] abuild: set GIT_CEILING_DIRECTORIES before running prepare/build/check/package --- abuild.in | 2 ++ tests/abuild_test | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/abuild.in b/abuild.in index 7aa7825..6d776a4 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 278ff78..ee25f96 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 + 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 +}