diff options
author | Christian Marangi <ansuelsmth@gmail.com> | 2024-05-24 20:13:49 +0200 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2024-06-11 23:58:16 +0200 |
commit | 9a52ec4fa0921cacf4c909ed1f542aab8f7502e6 (patch) | |
tree | 8038ec3c4468b88b16ac698602637a96eafa82ab /include/toplevel.mk | |
parent | 98703bf45833b915a0b835ae7ab7d419244a8840 (diff) | |
download | openwrt-9a52ec4fa0921cacf4c909ed1f542aab8f7502e6.tar.gz openwrt-9a52ec4fa0921cacf4c909ed1f542aab8f7502e6.tar.bz2 openwrt-9a52ec4fa0921cacf4c909ed1f542aab8f7502e6.zip |
toplevel.mk: implement logic to invalidate targetinfo with some config
Implement some logic to invalidate targetinfo files in tmp with the
changing of some config.
Some config might affect DEFAULT_PACKAGES list but DEFAULT_PACKAGES is
only evaluated once. This cause the interesting scenario where someone
install feeds packages, targetinfo is evaluated in tmp and then add some
config like CONFIG_USE_APK. Using make defconfig will still select OPKG
as default package as DEFAULT_PACKAGES in targetinfo has been already
evaluated in the feeds install and is never updated.
To handle this add some logic in toplevel.mk to cache the current state
of these special config and wipe targetinfo when these change.
This cause the targetinfo to be reevaluated and handle this REALLY
corner case.
Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'include/toplevel.mk')
-rw-r--r-- | include/toplevel.mk | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/toplevel.mk b/include/toplevel.mk index 4ec99b30de..f711a30614 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -75,7 +75,22 @@ endif _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p)) -prepare-tmpinfo: FORCE +# Config that will invalidate the .targetinfo as they will affect +# DEFAULT_PACKAGES. +# Keep DYNAMIC_DEF_PKG_CONF in sync with target.mk to reflect the same configs +DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP +check-dynamic-def-pkg: FORCE + @+DEF_PKG_CONFS=""; \ + if [ -f $(TOPDIR)/.config ]; then \ + for config in $(DYNAMIC_DEF_PKG_CONF); do \ + DEF_PKG_CONFS="$$DEF_PKG_CONFS "$$(grep "$$config"=y $(TOPDIR)/.config); \ + done; \ + fi; \ + [ ! -f tmp/.packagedynamicdefault ] || OLD_DEF_PKG_CONFS=$$(cat tmp/.packagedynamicdefault); \ + [ "$$DEF_PKG_CONFS" = "$$OLD_DEF_PKG_CONFS" ] || rm -rf tmp/info/.targetinfo*; \ + echo "$$DEF_PKG_CONFS" > tmp/.packagedynamicdefault; + +prepare-tmpinfo: check-dynamic-def-pkg FORCE @+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK) mkdir -p tmp/info feeds [ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base |