From patchwork Fri May 16 15:22:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Sojka X-Patchwork-Id: 349637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 61B63140077 for ; Sat, 17 May 2014 01:23:55 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0033F8ACDA; Fri, 16 May 2014 15:23:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OK6Z9l6oqg2x; Fri, 16 May 2014 15:23:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 384628AD51; Fri, 16 May 2014 15:23:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id B1C121C20A0 for ; Fri, 16 May 2014 15:23:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AE5D78BB02 for ; Fri, 16 May 2014 15:23:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M2pVvGHVtG33 for ; Fri, 16 May 2014 15:23:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by whitealder.osuosl.org (Postfix) with ESMTP id EF3338BC16 for ; Fri, 16 May 2014 15:23:47 +0000 (UTC) Received: from localhost (unknown [192.168.200.7]) by max.feld.cvut.cz (Postfix) with ESMTP id 31C9019F33B4; Fri, 16 May 2014 17:23:47 +0200 (CEST) X-Virus-Scanned: IMAP STYX AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044) with ESMTP id lDl3fWFo-Ke6; Fri, 16 May 2014 17:23:43 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id E61BF19F341B; Fri, 16 May 2014 17:23:42 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.82) (envelope-from ) id 1WlJz4-0005fa-QO; Fri, 16 May 2014 17:23:42 +0200 From: Michal Sojka To: buildroot@busybox.net Date: Fri, 16 May 2014 17:22:56 +0200 Message-Id: <1400253776-21759-2-git-send-email-sojka@merica.cz> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1400253776-21759-1-git-send-email-sojka@merica.cz> References: <1400253776-21759-1-git-send-email-sojka@merica.cz> Cc: "Yann E. MORIN" , Michal Sojka Subject: [Buildroot] [PATCH v2 1/1] Rebuild packages when their external config is updated X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Packages like busybox, Linux kernel or uclibc can "import" their configuration files from external location specified either in buildroot's .config or in an environment variable. Currently, this import happens only when the package is built for the first time. When the external config changes later, the package is not rebuilt with the updated configuration until the corresponding .stamp_configured file is manually deleted. This patch changes this to automatically rebuild the package, when its external configuration files is newer than .stamp_configured. The change is implemented in pkg-generic.mk so it automatically applies to all packages that use external config. This patch also changes $(pkg)-update-config targets, which export the internally used config files to external locations, to not change the modification time of the external config. This ensures that the package is not rebuilt just because its config file was exported. Finally, linux.mk used variable KERNEL_SOURCE_CONFIG to hold the file name of the external config. This was renamed to LINUX_SOURCE_CONFIG, in order to be compatible with the change in pkg-generic.mk. Signed-off-by: Michal Sojka --- boot/barebox/barebox.mk | 4 ++-- linux/linux.mk | 10 +++++----- package/busybox/busybox.mk | 2 +- package/pkg-generic.mk | 17 +++++++++++++++++ package/uclibc/uclibc.mk | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk index f57d297..a49f8dc 100644 --- a/boot/barebox/barebox.mk +++ b/boot/barebox/barebox.mk @@ -127,10 +127,10 @@ barebox-savedefconfig: barebox-configure ifeq ($(BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG),y) barebox-update-config: barebox-configure $(BAREBOX_DIR)/.config - cp -f $(BAREBOX_DIR)/.config $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) + cp -fa $(BAREBOX_DIR)/.config $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) barebox-update-defconfig: barebox-savedefconfig - cp -f $(BAREBOX_DIR)/defconfig $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) + cp -fa $(BAREBOX_DIR)/defconfig $(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE) else barebox-update-config: ; barebox-update-defconfig: ; diff --git a/linux/linux.mk b/linux/linux.mk index bd3f2ac..18254ca 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -161,13 +161,13 @@ LINUX_POST_PATCH_HOOKS += LINUX_APPLY_PATCHES ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) -KERNEL_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig +LINUX_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y) -KERNEL_SOURCE_CONFIG = $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) +LINUX_SOURCE_CONFIG = $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) endif define LINUX_CONFIGURE_CMDS - $(INSTALL) -m 0644 $(KERNEL_SOURCE_CONFIG) $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig + $(INSTALL) -m 0644 $(LINUX_SOURCE_CONFIG) $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) buildroot_defconfig rm $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig $(if $(BR2_arm)$(BR2_armeb), @@ -317,10 +317,10 @@ linux-savedefconfig linux26-savedefconfig: linux-configure ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y) linux-update-config linux26-update-config: linux-configure $(LINUX_DIR)/.config - cp -f $(LINUX_DIR)/.config $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) + cp -fa $(LINUX_DIR)/.config $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) linux-update-defconfig linux26-update-defconfig: linux-savedefconfig - cp -f $(LINUX_DIR)/defconfig $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) + cp -fa $(LINUX_DIR)/defconfig $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) else linux-update-config linux26-update-config: ; linux-update-defconfig linux26-update-defconfig: ; diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 150100b..a5405db 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -231,4 +231,4 @@ busybox-menuconfig busybox-xconfig busybox-gconfig: busybox-patch rm -f $(BUSYBOX_DIR)/.stamp_target_installed busybox-update-config: busybox-configure - cp -f $(BUSYBOX_BUILD_CONFIG) $(BUSYBOX_CONFIG_FILE) + cp -fa $(BUSYBOX_BUILD_CONFIG) $(BUSYBOX_CONFIG_FILE) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 6eca6d4..7440d2d 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -466,6 +466,23 @@ $$($(2)_TARGET_BUILD): $$($(2)_TARGET_CONFIGURE) $(1)-configure: $$($(2)_TARGET_CONFIGURE) $$($(2)_TARGET_CONFIGURE): | $$($(2)_DEPENDENCIES) +# We want a package to be reconfigured whenever an "external" config +# (if any) is updated. The name of the variable holding the external +# config file name is not unified in the recipes so we add +# dependencies to both commonly used variables. +# +# Additionally, we want the commands like +# make BUSYBOX_CONFIG_FILE=xxx busybox-update-config +# to succeed even if file 'xxx' does not exist before. Therefore, we +# condition the dependency by the existence of the config file. + +ifneq ($$(wildcard $$(call qstrip,$$($(2)_CONFIG_FILE))),) +$$($(2)_TARGET_CONFIGURE): $$(call qstrip,$$($(2)_CONFIG_FILE)) +endif +ifneq ($$(wildcard $$(call qstrip,$$($(2)_SOURCE_CONFIG))),) +$$($(2)_TARGET_CONFIGURE): $$(call qstrip,$$($(2)_SOURCE_CONFIG)) +endif + $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dirs prepare ifeq ($(filter $(1),$(DEPENDENCIES_HOST_PREREQ)),) $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dependencies diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk index 717cf53..6401f3d 100644 --- a/package/uclibc/uclibc.mk +++ b/package/uclibc/uclibc.mk @@ -554,7 +554,7 @@ uclibc-menuconfig: uclibc-patch $(eval $(generic-package)) uclibc-update-config: $(UCLIBC_DIR)/.stamp_configured - cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE) + cp -fa $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE) # Before uClibc is built, we must have the second stage cross-compiler $(UCLIBC_TARGET_BUILD): | host-gcc-intermediate