Skip to content

Commit

Permalink
build: export GIT_CEILING_DIRECTORIES for package builds
Browse files Browse the repository at this point in the history
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]: python-poetry/poetry#5547

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit f597f34)
  • Loading branch information
jefferyto authored and Ansuel committed Nov 8, 2023
1 parent f71ab69 commit bb2b55f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/host-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit bb2b55f

Please sign in to comment.