Skip to contentSkip to conversation

infra: misc. changes related to pkgparentdir

PATCH New Thomas De Schampheleire 3 participants 9 messages Nov 7, 2013 – Nov 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infra: misc. changes related to pkgparentdir

This series was driven by the observation that the 'Patching' message contained a double slash which annoyed me:

Quoted 1 line
Quoted 1 line
Quoted 1 line

host-lzop 1.03 Patching package//lzop

While fixing this (pkgparentdir change), I bumped into FOO_DIR_PREFIX which had an incorrect default, and the realization that the Patching message didn't really need that directory anyway.

---
 package/pkg-generic.mk |  6 +++---
 package/pkg-utils.mk   |  2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
#1 lore raw

PATCH 1/1 infra: remove trailing slash from pkgparentdir function

For a package located in package/foo/foo.mk, the pkgparentdir function returns "package/". For a package located in boot/barebox/barebox.mk, it returns "boot/". For linux/linux.mk, it returns the empty string.

There is actually no reason for the trailing slash in this function. In the package 'Patching' message, it causes a double slash:

Quoted 1 line
Quoted 1 line
Quoted 1 line

host-lzop 1.03 Patching package//lzop

due to:
@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") (FOO_DIR_PREFIX is populated from pkgparentdir)

While the printing of 'package//lzop' in the message above is not useful, and will be removed in a subsequent following patch, this patch removes the unnecessary trailing slash in pkgparentdir anyhow

---
 package/pkg-generic.mk |  2 +-
 package/pkg-utils.mk   |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +1 -1
@@ -473,7 +473,7 @@ endif
 # kernel case, the bootloaders case, and the normal packages case.
 ifeq ($(1),linux)
 $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
-else ifeq ($(4),boot/)
+else ifeq ($(4),boot)
 $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
 else
 $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
package/pkg-utils.mk +1 -1
@@ -52,7 +52,7 @@ endef
 # package, for which the package directory is an empty string.
 pkgdir       = $(dir $(lastword $(MAKEFILE_LIST)))
 pkgname      = $(lastword $(subst /, ,$(call pkgdir)))
-pkgparentdir = $(patsubst %$(call pkgname)/,%,$(call pkgdir))
+pkgparentdir = $(patsubst %/,%,$(patsubst %$(call pkgname)/,%,$(call pkgdir)))
 
 # Define extractors for different archive suffixes
 INFLATE.bz2  = $(BZCAT)
#2 lore raw

PATCH 1/1 infra: remove trailing slash from pkgparentdir function

Quoted 38 lines · Thomas De Schampheleire

For a package located in package/foo/foo.mk, the pkgparentdir function returns "package/". For a package located in boot/barebox/barebox.mk, it returns "boot/". For linux/linux.mk, it returns the empty string.

There is actually no reason for the trailing slash in this function. In the package 'Patching' message, it causes a double slash:

Quoted 1 line
Quoted 1 line
Quoted 1 line

host-lzop 1.03 Patching package//lzop

due to:
@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") (FOO_DIR_PREFIX is populated from pkgparentdir)

While the printing of 'package//lzop' in the message above is not useful, and will be removed in a subsequent following patch, this patch removes the unnecessary trailing slash in pkgparentdir anyhow

---
  package/pkg-generic.mk |  2 +-
  package/pkg-utils.mk   |  2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +1 -1
@@ -473,7 +473,7 @@ endif
  # kernel case, the bootloaders case, and the normal packages case.
  ifeq ($(1),linux)
  $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
-else ifeq ($(4),boot/)
+else ifeq ($(4),boot)
  $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
  else
  $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)

package/pkg-utils.mk endef · line 55

Quoted 5 lines
package/pkg-utils.mk +1 -1
@@ -52,7 +52,7 @@ endef
  # package, for which the package directory is an empty string.
  pkgdir       = $(dir $(lastword $(MAKEFILE_LIST)))
  pkgname      = $(lastword $(subst /, ,$(call pkgdir)))
-pkgparentdir = $(patsubst %$(call pkgname)/,%,$(call pkgdir))
+pkgparentdir = $(patsubst %/,%,$(patsubst %$(call pkgname)/,%,$(call pkgdir)))

I wonder if pkgparentdir is even needed anymore. For most cases, we
actually need $(pkgdir). Only for the check against boot/* the parent directory is needed, but that one can be replaced with

else ifneq ($(filter boot/%,$(4)),)

(assuming $(4) is $(pkgdir) instead of $(pkgparentdir)).

Regards,
Arnout

Quoted 8 lines
package/pkg-utils.mk +0 -0
  # Define extractors for different archive suffixes
  INFLATE.bz2  = $(BZCAT)

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 infra: remove trailing slash from pkgparentdir function

Quoted 49 lines · Arnout Vandecappelle
Quoted 38 lines · Thomas De Schampheleire

For a package located in package/foo/foo.mk, the pkgparentdir function returns "package/". For a package located in boot/barebox/barebox.mk, it returns "boot/". For linux/linux.mk, it returns the empty string.

There is actually no reason for the trailing slash in this function. In the package 'Patching' message, it causes a double slash:

Quoted 1 line
Quoted 1 line
Quoted 1 line

host-lzop 1.03 Patching package//lzop

due to:
@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") (FOO_DIR_PREFIX is populated from pkgparentdir)

While the printing of 'package//lzop' in the message above is not useful, and will be removed in a subsequent following patch, this patch removes the unnecessary trailing slash in pkgparentdir anyhow

---
  package/pkg-generic.mk |  2 +-
  package/pkg-utils.mk   |  2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +1 -1
@@ -473,7 +473,7 @@ endif
  # kernel case, the bootloaders case, and the normal packages case.
  ifeq ($(1),linux)
  $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
-else ifeq ($(4),boot/)
+else ifeq ($(4),boot)
  $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
  else
  $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)

package/pkg-utils.mk endef · line 55

Quoted 5 lines
package/pkg-utils.mk +1 -1
@@ -52,7 +52,7 @@ endef
  # package, for which the package directory is an empty string.
  pkgdir       = $(dir $(lastword $(MAKEFILE_LIST)))
  pkgname      = $(lastword $(subst /, ,$(call pkgdir)))
-pkgparentdir = $(patsubst %$(call pkgname)/,%,$(call pkgdir))
+pkgparentdir = $(patsubst %/,%,$(patsubst %$(call pkgname)/,%,$(call pkgdir)))

I wonder if pkgparentdir is even needed anymore. For most cases, we
actually need $(pkgdir). Only for the check against boot/* the parent directory is needed, but that one can be replaced with

Quoted 3 lines

else ifneq ($(filter boot/%,$(4)),)

(assuming $(4) is $(pkgdir) instead of $(pkgparentdir)).

I'm on it...

Best regards,
Thomas

#4 lore raw

PATCH 1/1 infra: remove incorrect default for FOO_DIR_PREFIX

In reply to Thomas De Schampheleire

Variable FOO_DIR_PREFIX is populated from pkgparentdir by the various package infrastructures. However, if that would be empty (which in fact is the case for the linux package), FOO_DIR_PREFIX would be set to '$(TOP_SRCDIR)/package'.
Not only does this make no sense (LINUX_DIR_PREFIX becomes /package/linux, and for all other packages pkgparentdir is not-empty anyway), but it is also using a non-existing variable TOP_SRCDIR.
This patch therefore removes the incorrect default.

---
 package/pkg-generic.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
package/pkg-generic.mk +1 -1
@@ -313,7 +313,7 @@ endif
 $(2)_INSTALL_STAGING		?= NO
 $(2)_INSTALL_IMAGES		?= NO
 $(2)_INSTALL_TARGET		?= YES
-$(2)_DIR_PREFIX			= $(if $(4),$(4),$(TOP_SRCDIR)/package)
+$(2)_DIR_PREFIX			= $(4)
 
 # define sub-target stamps
 $(2)_TARGET_INSTALL_TARGET =	$$($(2)_DIR)/.stamp_target_installed
#5 lore raw

PATCH 1/1 infra: remove incorrect default for FOO_DIR_PREFIX

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Variable FOO_DIR_PREFIX is populated from pkgparentdir by the various package infrastructures. However, if that would be empty (which in fact is the case for the linux package), FOO_DIR_PREFIX would be set to '$(TOP_SRCDIR)/package'.
Not only does this make no sense (LINUX_DIR_PREFIX becomes /package/linux, and for all other packages pkgparentdir is not-empty anyway), but it is also using a non-existing variable TOP_SRCDIR.
This patch therefore removes the incorrect default.

Quoted 1 line

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 1/1 infra: clean up 'Patching' message

In reply to Thomas De Schampheleire

The 'Patching' message in the generic infrastructure prints not only the package name, but also a reference to the assumed package directory, based on FOO_DIR_PREFIX/FOO_RAWNAME. This doesn't really add value, as the name of the package is already apparent from the message and its location should be obvious. Hence, this patch simply reduces the print to "Patching".

---
 package/pkg-generic.mk |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
package/pkg-generic.mk +1 -1
@@ -90,7 +90,7 @@ endif
 $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(call qstrip,$(BR2_GLOBAL_PATCH_DIR))/$(RAWNAME)
 $(BUILD_DIR)/%/.stamp_patched:
-	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
+	@$(call MESSAGE,"Patching")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
 	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
#7 lore raw

PATCH 1/1 infra: clean up 'Patching' message

Quoted 7 lines · Thomas De Schampheleire

The 'Patching' message in the generic infrastructure prints not only the package name, but also a reference to the assumed package directory, based on FOO_DIR_PREFIX/FOO_RAWNAME. This doesn't really add value, as the name of the package is already apparent from the message and its location should be obvious. Hence, this patch simply reduces the print to "Patching".

Quoted 22 lines
---
  package/pkg-generic.mk |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
package/pkg-generic.mk +1 -1
@@ -90,7 +90,7 @@ endif
  $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
  $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(call qstrip,$(BR2_GLOBAL_PATCH_DIR))/$(RAWNAME)
  $(BUILD_DIR)/%/.stamp_patched:
-	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
+	@$(call MESSAGE,"Patching")
  	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
  	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
  	$(Q)( \

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#8 lore raw

PATCH 1/1 infra: clean up 'Patching' message

In reply to Thomas De Schampheleire
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

The 'Patching' message in the generic infrastructure prints not only the package name, but also a reference to the assumed package directory, based on FOO_DIR_PREFIX/FOO_RAWNAME. This doesn't really add value, as the name of the package is already apparent from the message and its location should be obvious. Hence, this patch simply reduces the print to "Patching".

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard