diff options
author | Yann E. MORIN <yann.morin.1998@free.fr> | 2015-10-22 22:33:56 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2015-11-03 23:41:11 +0100 |
commit | 0ea851c0c0f9783894e9469806d0e25c2bf5d55b (patch) | |
tree | 6b1e76a586b11d08b1dd6da79ea575bb80971099 /package/pkg-generic.mk | |
parent | d0185582d0e24281640579cb3ea1d67e519febae (diff) |
core: do not accept multiple definitions of a package
One of the selling points for br2-external is to provide a mean to add
new packages. However, it is not supported that a package be defined by
Buildroot and then redefined in a br2-external tree.
This situation may occur without the user noticing or even willing to
redefine the package, for example:
- br2-external is first created against a version of Buildroot
- a package (missing in Buildroot) is added to that br2-external tree
- upstream Buildroot adds this package
- user updates to the new Buildroot
In this case, the result in undefined, and we can't make any guarantee
on the result (working or not).
Add a sanity check so that a package redefinition gets caught.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/pkg-generic.mk')
-rw-r--r-- | package/pkg-generic.mk | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 8b189fed2..1ae0315b9 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -341,6 +341,14 @@ endef define inner-generic-package +# Ensure the package is only declared once, i.e. do not accept that a +# package be re-defined by a br2-external tree +ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),) +$$(error Package '$(1)' defined a second time in '$(pkgdir)'; \ + previous definition was in '$$($(2)_PKGDIR)') +endif +PACKAGES_ALL += $(1) + # Define default values for various package-related variables, if not # already defined. For some variables (version, source, site and # subdir), if they are undefined, we try to see if a variable without @@ -351,6 +359,7 @@ define inner-generic-package $(2)_TYPE = $(4) $(2)_NAME = $(1) $(2)_RAWNAME = $$(patsubst host-%,%,$(1)) +$(2)_PKGDIR = $(pkgdir) # Keep the package version that may contain forward slashes in the _DL_VERSION # variable, then replace all forward slashes ('/') by underscores ('_') to |