Skip to contentSkip to conversation

core: rename FOO_BASE_NAME to FOO_BASENAME to avoid clashes

PATCH New Thomas De Schampheleire 4 participants 5 messages Feb 6, 2018 – Apr 8, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 core: rename FOO_BASE_NAME to FOO_BASENAME to avoid clashes

In current Buildroot, clashes occur between the variables _NAME and _BASE_NAME for two packages called foo and foo-base, i.e.

Package foo:
FOO_NAME = foo
FOO_BASE_NAME = foo-1.2.3

Package foo-base:
FOO_BASE_NAME = foo-base
FOO_BASE_BASE_NAME = foo-base-4.5.6

where variable FOO_BASE_NAME is clashing between these two packages. Specific cases where this clash is already existing are:
- alljoyn-base
- alljoyn-tcl-base
- perl-xml-sax-base

The problem is generic and can occur for a number of variables in Buildroot. A non-exhaustive list:
<pkg>_BASE and <pkg>_BASE_NAME
<pkg>_BASE_NAME and <pkg>_RAW_BASE_NAME
<pkg>_DIR and <pkg>_DL_DIR
<pkg>_VERSION and <pkg>_DL_VERSION
<pkg>_SOURCE and <pkg>_TARGET_SOURCE
<pkg>_INSTALL_IMAGES and <pkg>_TARGET_INSTALL_IMAGES (same for _STAGING and _TARGET) <pkg>_LICENSE_FILES and <pkg>_MANIFEST_LICENSE_FILES
<pkg>_DEPENDENCIES and <pkg>_FINAL_DEPENDENCIES

One solution is to use another separator than '_' to separate the package name from the rest of the variable name. For example, a double underscore:
FOO__NAME
FOO__BASE_NAME
FOO_BASE__NAME
FOO_BASE__BASE_NAME

However, making that change for only this case means that the variable naming is no longer consistent. And making the change for all variables has a large impact, also on certain user scripts.

For now, keep it simple, and rename FOO_BASE_NAME into FOO_BASENAME, so that the variables become:
FOO_NAME
FOO_BASENAME
FOO_BASE_NAME
FOO_BASE_BASENAME

For consistency, also adapt FOO_RAW_BASE_NAME. Since FOO_RAW_BASENAME would still pose a conflict with a package called 'foo-raw', take the opportunity to rename it into FOO_BASENAME_RAW instead, which does not pose a conflict as we have no variable called FOO_RAW.

---
 package/pkg-download.mk | 10 +++++-----
 package/pkg-generic.mk  | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)
package/pkg-download.mk +5 -5
index 3712b9ccc6..6f15deba28 100644
@@ -79,7 +79,7 @@ define DOWNLOAD_GIT
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -90,7 +90,7 @@ define DOWNLOAD_BZR
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -102,7 +102,7 @@ define DOWNLOAD_CVS
 		$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_RAWNAME) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -113,7 +113,7 @@ define DOWNLOAD_SVN
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -137,7 +137,7 @@ define DOWNLOAD_HG
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
package/pkg-generic.mk +7 -7
index a2a12e7b56..97c580541d 100644
@@ -452,10 +452,10 @@ ifdef $(3)_OVERRIDE_SRCDIR
   $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
 endif
 
-$(2)_BASE_NAME	= $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
-$(2)_RAW_BASE_NAME = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
+$(2)_BASENAME	= $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
+$(2)_BASENAME_RAW = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
 $(2)_DL_DIR	=  $$(DL_DIR)
-$(2)_DIR	=  $$(BUILD_DIR)/$$($(2)_BASE_NAME)
+$(2)_DIR	=  $$(BUILD_DIR)/$$($(2)_BASENAME)
 
 ifndef $(2)_SUBDIR
  ifdef $(3)_SUBDIR
@@ -484,7 +484,7 @@ ifndef $(2)_SOURCE
  ifdef $(3)_SOURCE
   $(2)_SOURCE = $$($(3)_SOURCE)
  else ifdef $(2)_VERSION
-  $(2)_SOURCE			?= $$($(2)_RAW_BASE_NAME).tar.gz
+  $(2)_SOURCE			?= $$($(2)_BASENAME_RAW).tar.gz
  endif
 endif
 
@@ -558,7 +558,7 @@ endif
 
 $(2)_REDISTRIBUTE		?= YES
 
-$(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_RAW_BASE_NAME)
+$(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_BASENAME_RAW)
 
 # When a target package is a toolchain dependency set this variable to
 # 'NO' so the 'toolchain' dependency is not added to prevent a circular
@@ -864,9 +864,9 @@ ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
 # is that the license still applies to the files distributed as part
 # of the rootfs, even if the sources are not themselves redistributed.
 ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
-	$(Q)$$(call legal-warning-pkg,$$($(2)_RAW_BASE_NAME),cannot save license ($(2)_LICENSE_FILES not defined))
+	$(Q)$$(call legal-warning-pkg,$$($(2)_BASENAME_RAW),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-	$(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_RAW_BASE_NAME),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
+	$(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
 endif # license files
 
 ifeq ($$($(2)_SITE_METHOD),local)
Signature · 1 line
2.13.6
#1 lore raw

PATCH v2 1/1 core: rename FOO_BASE_NAME to FOO_BASENAME to avoid clashes

Thomas, All,

On 2018-02-06 13:59 +0100, Thomas De Schampheleire spake thusly:

Quoted 7 lines

In current Buildroot, clashes occur between the variables _NAME and _BASE_NAME for two packages called foo and foo-base, i.e.

Package foo:
FOO_NAME = foo
FOO_BASE_NAME = foo-1.2.3

Quoted 5 lines

Package foo-base:
FOO_BASE_NAME = foo-base
FOO_BASE_BASE_NAME = foo-base-4.5.6

where variable FOO_BASE_NAME is clashing between these two packages.

[--SNIP--]

Quoted 1 line

Regards,
Yann E. MORIN.

Quoted 109 lines
---
 package/pkg-download.mk | 10 +++++-----
 package/pkg-generic.mk  | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)
package/pkg-download.mk +5 -5
index 3712b9ccc6..6f15deba28 100644
@@ -79,7 +79,7 @@ define DOWNLOAD_GIT
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -90,7 +90,7 @@ define DOWNLOAD_BZR
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -102,7 +102,7 @@ define DOWNLOAD_CVS
 		$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_RAWNAME) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -113,7 +113,7 @@ define DOWNLOAD_SVN
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
@@ -137,7 +137,7 @@ define DOWNLOAD_HG
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_RAW_BASE_NAME) \
+		$($(PKG)_BASENAME_RAW) \
 		$($(PKG)_DL_OPTS)
 endef
 
package/pkg-generic.mk +7 -7
index a2a12e7b56..97c580541d 100644
@@ -452,10 +452,10 @@ ifdef $(3)_OVERRIDE_SRCDIR
   $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
 endif
 
-$(2)_BASE_NAME	= $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
-$(2)_RAW_BASE_NAME = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
+$(2)_BASENAME	= $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
+$(2)_BASENAME_RAW = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
 $(2)_DL_DIR	=  $$(DL_DIR)
-$(2)_DIR	=  $$(BUILD_DIR)/$$($(2)_BASE_NAME)
+$(2)_DIR	=  $$(BUILD_DIR)/$$($(2)_BASENAME)
 
 ifndef $(2)_SUBDIR
  ifdef $(3)_SUBDIR
@@ -484,7 +484,7 @@ ifndef $(2)_SOURCE
  ifdef $(3)_SOURCE
   $(2)_SOURCE = $$($(3)_SOURCE)
  else ifdef $(2)_VERSION
-  $(2)_SOURCE			?= $$($(2)_RAW_BASE_NAME).tar.gz
+  $(2)_SOURCE			?= $$($(2)_BASENAME_RAW).tar.gz
  endif
 endif
 
@@ -558,7 +558,7 @@ endif
 
 $(2)_REDISTRIBUTE		?= YES
 
-$(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_RAW_BASE_NAME)
+$(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_BASENAME_RAW)
 
 # When a target package is a toolchain dependency set this variable to
 # 'NO' so the 'toolchain' dependency is not added to prevent a circular
@@ -864,9 +864,9 @@ ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
 # is that the license still applies to the files distributed as part
 # of the rootfs, even if the sources are not themselves redistributed.
 ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
-	$(Q)$$(call legal-warning-pkg,$$($(2)_RAW_BASE_NAME),cannot save license ($(2)_LICENSE_FILES not defined))
+	$(Q)$$(call legal-warning-pkg,$$($(2)_BASENAME_RAW),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-	$(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_RAW_BASE_NAME),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
+	$(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
 endif # license files
 
 ifeq ($$($(2)_SITE_METHOD),local)
Signature · 6 lines
2.13.6

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 core: rename FOO_BASE_NAME to FOO_BASENAME to avoid clashes

All,

Quoted 14 lines · Yann E. MORIN

Thomas, All,

On 2018-02-06 13:59 +0100, Thomas De Schampheleire spake thusly:

Quoted 11 lines

In current Buildroot, clashes occur between the variables _NAME and _BASE_NAME for two packages called foo and foo-base, i.e.

Package foo:
FOO_NAME = foo
FOO_BASE_NAME = foo-1.2.3

Package foo-base:
FOO_BASE_NAME = foo-base
FOO_BASE_BASE_NAME = foo-base-4.5.6

Quoted 5 lines
Quoted 1 line

where variable FOO_BASE_NAME is clashing between these two packages.

[--SNIP--]

Quoted 1 line
#3 lore raw

PATCH v2 1/1 core: rename FOO_BASE_NAME to FOO_BASENAME to avoid clashes

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

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

In current Buildroot, clashes occur between the variables _NAME and _BASE_NAME for two packages called foo and foo-base, i.e.

Package foo:
FOO_NAME = foo
FOO_BASE_NAME = foo-1.2.3

Package foo-base:
FOO_BASE_NAME = foo-base
FOO_BASE_BASE_NAME = foo-base-4.5.6

where variable FOO_BASE_NAME is clashing between these two packages. Specific cases where this clash is already existing are:
- alljoyn-base
- alljoyn-tcl-base
- perl-xml-sax-base

The problem is generic and can occur for a number of variables in Buildroot. A non-exhaustive list:
<pkg>_BASE and <pkg>_BASE_NAME
<pkg>_BASE_NAME and <pkg>_RAW_BASE_NAME
<pkg>_DIR and <pkg>_DL_DIR
<pkg>_VERSION and <pkg>_DL_VERSION
<pkg>_SOURCE and <pkg>_TARGET_SOURCE
<pkg>_INSTALL_IMAGES and <pkg>_TARGET_INSTALL_IMAGES (same for _STAGING and _TARGET) <pkg>_LICENSE_FILES and <pkg>_MANIFEST_LICENSE_FILES
<pkg>_DEPENDENCIES and <pkg>_FINAL_DEPENDENCIES

One solution is to use another separator than '_' to separate the package name from the rest of the variable name. For example, a double underscore:
FOO__NAME
FOO__BASE_NAME
FOO_BASE__NAME
FOO_BASE__BASE_NAME

However, making that change for only this case means that the variable naming is no longer consistent. And making the change for all variables has a large impact, also on certain user scripts.

For now, keep it simple, and rename FOO_BASE_NAME into FOO_BASENAME, so that the variables become:
FOO_NAME
FOO_BASENAME
FOO_BASE_NAME
FOO_BASE_BASENAME

Quoted 6 lines

For consistency, also adapt FOO_RAW_BASE_NAME. Since FOO_RAW_BASENAME would still pose a conflict with a package called 'foo-raw', take the opportunity to rename it into FOO_BASENAME_RAW instead, which does not pose a conflict as we have no variable called FOO_RAW.

Committed, thanks.

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

PATCH v2 1/1 core: rename FOO_BASE_NAME to FOO_BASENAME to avoid clashes

Quoted 49 lines
Quoted 48 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

In current Buildroot, clashes occur between the variables _NAME and _BASE_NAME for two packages called foo and foo-base, i.e.

Package foo:
FOO_NAME = foo
FOO_BASE_NAME = foo-1.2.3

Package foo-base:
FOO_BASE_NAME = foo-base
FOO_BASE_BASE_NAME = foo-base-4.5.6

where variable FOO_BASE_NAME is clashing between these two packages. Specific cases where this clash is already existing are:
- alljoyn-base
- alljoyn-tcl-base
- perl-xml-sax-base

The problem is generic and can occur for a number of variables in Buildroot. A non-exhaustive list:
<pkg>_BASE and <pkg>_BASE_NAME
<pkg>_BASE_NAME and <pkg>_RAW_BASE_NAME
<pkg>_DIR and <pkg>_DL_DIR
<pkg>_VERSION and <pkg>_DL_VERSION
<pkg>_SOURCE and <pkg>_TARGET_SOURCE
<pkg>_INSTALL_IMAGES and <pkg>_TARGET_INSTALL_IMAGES (same for _STAGING and _TARGET) <pkg>_LICENSE_FILES and <pkg>_MANIFEST_LICENSE_FILES
<pkg>_DEPENDENCIES and <pkg>_FINAL_DEPENDENCIES

One solution is to use another separator than '_' to separate the package name from the rest of the variable name. For example, a double underscore:
FOO__NAME
FOO__BASE_NAME
FOO_BASE__NAME
FOO_BASE__BASE_NAME

However, making that change for only this case means that the variable naming is no longer consistent. And making the change for all variables has a large impact, also on certain user scripts.

For now, keep it simple, and rename FOO_BASE_NAME into FOO_BASENAME, so that the variables become:
FOO_NAME
FOO_BASENAME
FOO_BASE_NAME
FOO_BASE_BASENAME

Quoted 6 lines
Quoted 6 lines

For consistency, also adapt FOO_RAW_BASE_NAME. Since FOO_RAW_BASENAME would still pose a conflict with a package called 'foo-raw', take the opportunity to rename it into FOO_BASENAME_RAW instead, which does not pose a conflict as we have no variable called FOO_RAW.

Committed to 2018.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard