diff mbox series

core/show-info: report build_dir relative to CONFIG_DIR

Message ID 20211109165435.1937116-1-yann.morin.1998@free.fr
State Handled Elsewhere
Headers show
Series core/show-info: report build_dir relative to CONFIG_DIR | expand

Commit Message

Yann E. MORIN Nov. 9, 2021, 4:54 p.m. UTC
Currently, the build_dir field is reported relative to $(BASE_DIR), to
avoid leaking local paths.

However, BASE_DIR is not a directory that is very convenient: for
in-tree builds, it is $(CONFIG_DIR)/output/, while for out-of-tree
builds, it is $(CONFIG_DIR). This difference is purely an idiosyncracy
of how out-of-tree builds have been implemented in Buildroot, and is
not under the control of the user.

What the user is in control of, however, is where the .config file is
located. This, really, is the directory we should base relative paths
on.

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/pkg-utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Korsgaard Dec. 12, 2021, 10:08 p.m. UTC | #1
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Currently, the build_dir field is reported relative to $(BASE_DIR), to
 > avoid leaking local paths.

 > However, BASE_DIR is not a directory that is very convenient: for
 > in-tree builds, it is $(CONFIG_DIR)/output/, while for out-of-tree
 > builds, it is $(CONFIG_DIR). This difference is purely an idiosyncracy
 > of how out-of-tree builds have been implemented in Buildroot, and is
 > not under the control of the user.

 > What the user is in control of, however, is where the .config file is
 > located. This, really, is the directory we should base relative paths
 > on.

 > Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Committed to 2021.02.x and 2021.08.x, thanks.
diff mbox series

Patch

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index ae3c7f9da9..b2f0b8cebf 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -113,7 +113,7 @@  define _json-info-pkg
 		"virtual": false$(comma)
 		$(call _json-info-pkg-details,$(1)) \
 	)
-	"build_dir": "$(patsubst $(BASE_DIR)/%,%,$($(1)_BUILDDIR))",
+	"build_dir": "$(patsubst $(CONFIG_DIR)/%,%,$($(1)_BUILDDIR))",
 	$(if $(filter target,$($(1)_TYPE)), \
 		"install_target": $(call yesno-to-bool,$($(1)_INSTALL_TARGET))$(comma) \
 		"install_staging": $(call yesno-to-bool,$($(1)_INSTALL_STAGING))$(comma) \