Skip to contentSkip to conversation

pkg-infra: introduce errors for legacy API

Buildroot Peter Korsgaard 2 participants 4 messages Nov 30, 2012 – Dec 2, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

commit: http://git.buildroot.net/buildroot/commit/?id=ebcfa987df4095a7805ff124ab648fb607c89215
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

As discussed in the BR developer days, we want to be more strict about API changes in buildroot. I.e., we want to make it less likely that a user's customizations break down after upgrading buildroot.

A first step is to make sure that the user is warned about API changes. This patch introduces Makefile.legacy and Config.in.legacy, which will issue clear error messages for such situations.

---
 Config.in        |    2 ++
 Config.in.legacy |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 Makefile         |    7 ++++++-
 Makefile.legacy  |   13 +++++++++++++
 4 files changed, 72 insertions(+), 1 deletions(-)
Config.in +2 -0
index eaafece..b319ac7 100644
@@ -434,3 +434,5 @@ source "fs/Config.in"
 source "boot/Config.in"
 
 source "linux/Config.in"
+
+source "Config.in.legacy"
Config.in.legacy new file +51 -0

51 lines not on this page · raw message

Makefile +6 -1
index 21aa054..1e257e9 100644
@@ -290,6 +290,12 @@ endif
 
 all: world
 
+# Include legacy before the other things, because package .mk files
+# may rely on it.
+ifneq ($(BR2_DEPRECATED),y)
+include Makefile.legacy
+endif
+
 include package/Makefile.in
 include support/dependencies/dependencies.mk
 
@@ -762,4 +768,3 @@ print-version:
 include docs/manual/manual.mk
 
 .PHONY: $(noconfig_targets)
-
Makefile.legacy new file +13 -0
new file mode 100644
index 0000000..2e015a1
@@ -0,0 +1,13 @@
+#
+# Makefile.legacy - support for backward compatibility
+#
+# This file contains placeholders to detect backward-compatibility problems.
+# When a buildroot "API" feature is being deprecated, a rule should be added
+# here that issues an error when the old feature is used.
+#
+# This file is not included if BR2_DEPRECATED is selected, so it is possible
+# to bypass the errors (although that's usually a bad idea).
+
+ifeq ($(BR2_LEGACY),y)
+$(error "You have legacy configuration in your .config! Please check your configuration.")
+endif
#1 lore raw

Dear Peter Korsgaard,

Quoted 7 lines · Peter Korsgaard

commit: http://git.buildroot.net/buildroot/commit/?id=ebcfa987df4095a7805ff124ab648fb607c89215
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

As discussed in the BR developer days, we want to be more strict about API changes in buildroot. I.e., we want to make it less likely that a user's customizations break down after upgrading buildroot.

Quoted 6 lines

A first step is to make sure that the user is warned about API changes. This patch introduces Makefile.legacy and Config.in.legacy, which will issue clear error messages for such situations.

This doesn't really work well with randpackageconfig, and therefore breaks the autobuilders badly.

For example, randpackageconfig can enable BR2_PACKAGE_GETTEXT_STATIC, because it matches BR2_PACKAGE_<foo>, this will select BR2_LEGACY, which will abort the build.

Should it be fixed just in the autobuilders scripts, or do we consider the fact that "make randpackageconfig" generates un-buildable configuration is a bug by itself?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 10 lines
Quoted 10 lines

As discussed in the BR developer days, we want to be more strict about API changes in buildroot. I.e., we want to make it less likely that a user's customizations break down after upgrading buildroot.

A first step is to make sure that the user is warned about API changes. This patch introduces Makefile.legacy and Config.in.legacy, which will issue clear error messages for such situations.

Thomas> This doesn't really work well with randpackageconfig, and therefore Thomas> breaks the autobuilders badly.

Thomas> For example, randpackageconfig can enable BR2_PACKAGE_GETTEXT_STATIC, Thomas> because it matches BR2_PACKAGE_<foo>, this will select BR2_LEGACY, Thomas> which will abort the build.

Thomas> Should it be fixed just in the autobuilders scripts, or do we consider Thomas> the fact that "make randpackageconfig" generates un-buildable Thomas> configuration is a bug by itself?

I would call it a bug. I've fixed it like this:

[PATCH] {rand,allyes}packageconfig: ensure legacy test options don't
get enabled

The legacy BR2_PACKAGE_* options in Config.in.legacy are not supposed to be user selectable, so {rand,allyes}packageconfig shouldn't enable them.

---
 Makefile |    6 ++++++
 1 file changed, 6 insertions(+)
Makefile +6 -0
index d3f9b40..b394fd5 100644
@@ -619,6 +619,9 @@ allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
+		while read config pkg; do \
+		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
 	@$(COMMON_CONFIG_ENV) \
 		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
 		$< --randconfig $(CONFIG_CONFIG_IN)
@@ -627,6 +630,9 @@ randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
 	@grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
+		while read config pkg; do \
+		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
 	@$(COMMON_CONFIG_ENV) \
 		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
 		$< --allyesconfig $(CONFIG_CONFIG_IN)
Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw
Quoted 9 lines · Peter Korsgaard

I would call it a bug. I've fixed it like this:

[PATCH] {rand,allyes}packageconfig: ensure legacy test options don't
get enabled

The legacy BR2_PACKAGE_* options in Config.in.legacy are not supposed to be user selectable, so {rand,allyes}packageconfig shouldn't enable them.

Looks good, thanks. At least, the autobuilders are a lot happier now :-)

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com