[OpenWrt-Devel] [PATCH 1/2] target/sdk: Do not allow SDK to reconfigure already built packages
Daniel Dickinson
openwrt at daniel.thecshore.com
Mon Jan 11 22:08:20 EST 2016
On correction on the comments in the patch: The install target is
actually not applicable because it only applies to packages selected as
y vs. m and refers to install into an actual image. Packages which are
m can only be recorded as built from a compile section, and marking
packages from the compile section is non-trivial due to number of way in
which compile sections come into being (i.e. there is no single
convenient place to alter the compile target).
Regards,
Daniel
On 11/01/16 05:21 AM, openwrt at lists.openwrt.org wrote:
> From: Daniel Dickinson <openwrt at daniel.thecshore.com>
>
> 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 | 4 ++--
> include/toplevel.mk | 2 +-
> package/Makefile | 8 ++++++++
> target/sdk/Makefile | 2 ++
> 6 files changed, 27 insertions(+), 6 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index a12e3ea..91c4779 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -41,8 +41,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 1dfbd68..0fd3455 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
> @@ -66,6 +66,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)"; \
> @@ -214,6 +219,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
> @@ -298,6 +307,7 @@ dumpinfo:
> download:
> prepare:
> configure:
> +markforsdk:
> compile: prepare-package-install
> install: compile
>
> diff --git a/include/subdir.mk b/include/subdir.mk
> index 8dc9a78..380e602 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 ., \
> @@ -43,7 +43,7 @@ define subdir
> $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
> $(if $(BUILD_LOG), at mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd))
> $(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default))),
> - $(if $(call debug,$(1)/$(bd),v),,@)+$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -r -C $(1)/$(bd) $(target) BUILD_VARIANT="$(filter-out __default,$(variant))" $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).))
> + $(if $(call debug,$(1)/$(bd),v),,@)+$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -r -C $(1)/$(bd) $(target) BUILD_VARIANT="$(filter-out __default,$(variant))" SRC_PKG_NAME=$(notdir /$(bd)) $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).))
> )
> $(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),,
> # aliases
> diff --git a/include/toplevel.mk b/include/toplevel.mk
> index d13a370..2eff39e 100644
> --- a/include/toplevel.mk
> +++ b/include/toplevel.mk
> @@ -70,7 +70,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 aa5d522..0b0c8d0 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
> @@ -183,9 +184,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 4fec516..e2010a4 100644
> --- a/target/sdk/Makefile
> +++ b/target/sdk/Makefile
> @@ -104,6 +104,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 \
>
_______________________________________________
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