[OpenWrt-Devel] [PATCH 1/2] [RESEND] target/sdk: Do not allow SDK to reconfigure already built packages
openwrt at daniel.thecshore.com
openwrt at daniel.thecshore.com
Tue Feb 16 02:40:16 EST 2016
From: Daniel Dickinson <openwrt at daniel.thecshore.com>
No comment on previous send of this verison. Tested and working, hence resend.
If packages have already been built by the base system we don't want
a different version in another repo (e.g. built by SDK) because this
could cause conflicts with packaes that depend on it. Therefore for
packages built by the base system, prevent the SDK from reconfiguring
the build options.
The approach taken is the one which least perturbs the build system
while still being reliable, of the ones considered. Other approachs
involved modifying package-ipkg.mk and packages.mk in order to
override the compile or install targets, however there are rather a
lot of 'moving parts' to the compile target, and the number of fragile
changes required is quite high. In addition, simply looking for .built
stamps is unreliable because packages which were once built due to a
previous configuration, but which are out-of-date and/or no longer
desired, would get recorded as built unless you remove the .built
stamp when doing package/compile, however that would result in every
package attempting to do a rebuild, even with no changes.
In any event the change to subdir.mk is required because of the
fact that the package name we need is the 'source' package name,
which corresponds to the last part of the subdirectory path in
which the package resides.
Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
---
Makefile | 5 +++--
include/package.mk | 12 +++++++++++-
include/subdir.mk | 3 ++-
include/toplevel.mk | 2 +-
package/Makefile | 8 ++++++++
target/sdk/Makefile | 2 ++
6 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 8ba2bfc..7df77ba 100644
--- a/Makefile
+++ b/Makefile
@@ -42,8 +42,9 @@ else
$(toolchain/stamp-install): $(tools/stamp-install)
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
-$(package/stamp-install): $(package/stamp-compile)
-$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
+$(package/stamp-markforsdk): $(package/stamp-compile)
+$(package/stamp-install): $(package/stamp-compile) $(package/stamp-markforsdk)
+$(target/stamp-install): $(package/stamp-compile) $(package/stamp-markforsdk) $(package/stamp-install)
printdb:
@true
diff --git a/include/package.mk b/include/package.mk
index ca315b5..9667e39 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -7,7 +7,7 @@
__package_mk:=1
-all: $(if $(DUMP),dumpinfo,compile)
+all: $(if $(DUMP),dumpinfo,compile markforsdk)
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
@@ -71,6 +71,11 @@ STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(B
STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list
define CleanStaging
+ $(if $(PKG_NAME), \
+ rm -f $(STAGING_DIR)/pkgstamp-current/$(PKG_NAME)
+ ,\
+ rm -rf $(STAGING_DIR)/pkgstamp-current \
+ )
rm -f $(STAMP_INSTALLED)
@-(\
cd "$(STAGING_DIR)"; \
@@ -219,6 +224,10 @@ define Build/DefaultTargets
rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME)
touch $$@
+ markforsdk:
+ mkdir -p $(STAGING_DIR)/pkgstamp-current
+ touch $(STAGING_DIR)/pkgstamp-current/$(SRC_PKG_NAME)
+
ifdef Build/InstallDev
compile: $(STAMP_INSTALLED)
endif
@@ -303,6 +312,7 @@ dumpinfo:
download:
prepare:
configure:
+markforsdk:
compile: prepare-package-install
install: compile
diff --git a/include/subdir.mk b/include/subdir.mk
index f4085f9..beb3017 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -9,7 +9,7 @@ ifeq ($(MAKECMDGOALS),prereq)
SUBTARGETS:=prereq
PREREQ_ONLY:=1
else
- SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure
+ SUBTARGETS:=clean download prepare compile markforsdk install update refresh prereq dist distcheck configure
endif
subtarget-default = $(filter-out ., \
@@ -41,6 +41,7 @@ log_make = \
$$(SUBMAKE) -r -C $(1) $(if $(3),$(3)-)$(2) \
BUILD_SUBDIR="$(1)" \
BUILD_VARIANT="$(4)" \
+ SRC_PKG_NAME="$(notdir $(1))" \
$(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2).txt)
# Parameters: <subdir>
diff --git a/include/toplevel.mk b/include/toplevel.mk
index 9709302..7a97b51 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -71,7 +71,7 @@ ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024
prepare-mk: FORCE ;
ifdef SDK
- IGNORE_PACKAGES = linux
+ include $(TOPDIR)/ignore-packages.mk
endif
_ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
diff --git a/package/Makefile b/package/Makefile
index 1a78fde..c0d2fc1 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -22,6 +22,7 @@ ifneq ($(IGNORE_ERRORS),)
package-ignore-errors := $(if $(package-ignore-errors),$(package-ignore-errors),n m)
$(curdir)/builddirs-ignore-download := $(foreach m,$(package-ignore-errors),$(package-$(m)-filter))
$(curdir)/builddirs-ignore-compile := $(foreach m,$(package-ignore-errors),$(package-$(m)-filter))
+ $(curdir)/builddirs-ignore-markforsdk := $(foreach m,$(package-ignore-errors),$(package-$(m)-filter))
endif
ifdef CONFIG_USE_MKLIBS
@@ -184,9 +185,16 @@ $(curdir)/preconfig:
$(curdir)/flags-install:= -j1
+# If rebuilding all packages, clean out the record (for sdk) of built packages so
+# that it is guaranteed to not include packages which were built at some point, but
+# which are no longer part of the build.
+package/compile:
+ rm -f $(STAGING_DIR)/pkgstamp-current/*
+
$(eval $(call stampfile,$(curdir),package,prereq,.config))
$(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
$(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
+$(eval $(call stampfile,$(curdir),package,markforsdk,$(TMP_DIR)/.build))
$(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
$(eval $(call subdir,$(curdir)))
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index 857a6b7..339b434 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -106,6 +106,8 @@ $(BIN_DIR)/$(SDK_NAME).tar.bz2: clean
$(TOPDIR)/package/Makefile \
$(SDK_BUILD_DIR)/package/
+ # Used to prevent altering compile options for already build packages
+ (echo -n "IGNORE_PACKAGES = "; cd $(STAGING_DIR)/pkgstamp-current && ls -A |tr $$'\n' ' ') >>$(SDK_BUILD_DIR)/ignore-packages.mk
-rm -f $(SDK_BUILD_DIR)/feeds.conf.default
$(if $(BASE_FEED),echo "$(BASE_FEED)" > $(SDK_BUILD_DIR)/feeds.conf.default)
if [ -f $(TOPDIR)/feeds.conf ]; then \
--
2.4.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list