[openwrt/openwrt] build: export GIT_CEILING_DIRECTORIES for package builds

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 8 08:18:21 PST 2023


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/bb2b55f3767ad02d8de8c9255cdf2573689a7b26

commit bb2b55f3767ad02d8de8c9255cdf2573689a7b26
Author: Jeffery To <jeffery.to at gmail.com>
AuthorDate: Wed May 31 21:58:34 2023 +0800

    build: export GIT_CEILING_DIRECTORIES for package builds
    
    A package may run git as part of its build process, and if the package
    source code is not from a git checkout, then git may traverse up the
    directory tree to find buildroot's repository directory (.git).
    
    For instance, Poetry Core, a Python build backend, will read the
    contents of .gitignore for paths to exclude when creating a Python
    package. If it finds buildroot's .gitignore file, then Poetry Core will
    exclude all of the package's files[1].
    
    This exports GIT_CEILING_DIRECTORIES for both package and host builds so
    that git will not traverse beyond $(BUILD_DIR)/$(BUILD_DIR_HOST).
    
    [1]: https://github.com/python-poetry/poetry/issues/5547
    
    Signed-off-by: Jeffery To <jeffery.to at gmail.com>
    (cherry picked from commit f597f34f3afa7bba8a2606490617688f1cea5a44)
---
 include/host-build.mk | 1 +
 include/package.mk    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/host-build.mk b/include/host-build.mk
index 22fcc31f15..dbad2824cc 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -130,6 +130,7 @@ define Host/Exports/Default
   $(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
   $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
   $(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig
+  $(1) : export GIT_CEILING_DIRECTORIES=$$(BUILD_DIR_HOST)
   $(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE))
   $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG))
 endef
diff --git a/include/package.mk b/include/package.mk
index 368bf0d7ca..b0c5e8ec91 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -173,6 +173,7 @@ define Build/Exports/Default
   $(1) : export CONFIG_SITE:=$$(CONFIG_SITE)
   $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH)
   $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH)
+  $(1) : export GIT_CEILING_DIRECTORIES:=$$(BUILD_DIR)
 endef
 Build/Exports=$(Build/Exports/Default)
 




More information about the lede-commits mailing list