From patchwork Sun Oct 2 09:09:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 677485 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3smzv04r7Wz9ryv for ; Sun, 2 Oct 2016 20:11:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=BR2noZE0; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D685A92194; Sun, 2 Oct 2016 09:11:22 +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 NpNY-k0NpRYc; Sun, 2 Oct 2016 09:11:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id A9FC69216A; Sun, 2 Oct 2016 09:10:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BC2931C1E7D for ; Sun, 2 Oct 2016 09:10:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B810494C09 for ; Sun, 2 Oct 2016 09:10:16 +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 K9Gxmlf-UN3C for ; Sun, 2 Oct 2016 09:10:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by hemlock.osuosl.org (Postfix) with ESMTPS id E35E094BFD for ; Sun, 2 Oct 2016 09:10:15 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id b184so9895781wma.3 for ; Sun, 02 Oct 2016 02:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=nwaH4wDttY4ZvldMClQZXpy+Zv5owh2ioBHUgTyU+Us=; b=BR2noZE0GSIL9Wb8Z5ypnzXlwkXRv3Soa9f8imuQTM7lJx7MJu9vo5kJ32NlrVeyKA Vkwby3mc0RM9FIfonBTUW8E1pBuD7BMjokxM2vaygofMb3mas/20TuTON4C4Ttr+Emqk WVF2WzRkrBEos7xmXseB5jW5uoweGlhgsp8m367WUzu2bIoi8SnblmdB4hUGkq4yPUFV ufYDQ0iA7SyaBw+O6QSnON4BAJvRUW7kUAGpLZ5DSlq6+2uyhBtPVSV1Vahp/1itdPyD xMcn0b1N2AVIV0EUiYEFSBYobWjgrUQRJ9fMaON52RR9ptRJPL3Ee6A9kNMBFZZEsWHM bw4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=nwaH4wDttY4ZvldMClQZXpy+Zv5owh2ioBHUgTyU+Us=; b=fCoMWPUunke+KupySGuQ02xHtFylhEhd7M7ziUoo6Rk2VaDXug/X5kd6fKp03jW5Mf qwyL31AFgDR61EgKdgy+sn8kHIEF4cfFzFt1a6xDArBQzPwN8rk26em5BsO1A3+pr5Sg n8GxOigNkrhs/cNk024JhWfMv42EnZwhlClSnW1g43Y4KtXyxO2tCJPHEgJ+qgj0pylj uRKZAvk6lef1V4z/+9XlThBuaSs+Vvuz0FHPJCQkRlpL8m822IPAawXSZcOpXKcoG6VQ Hn8pPZ7ozLXUVvauM0rgbYc3JOFzbmTu7ERf23PnOBqpBHcOLsWvlNTSCEt4Zb65bqV+ L/yw== X-Gm-Message-State: AA6/9RlV7aZk/leIpEtCoGCRo+ikifwPU5/GFyNE7HGBSsaTMVsLkjMvSIbZpgEHaeIrDw== X-Received: by 10.28.167.22 with SMTP id q22mr3382203wme.11.1475399414311; Sun, 02 Oct 2016 02:10:14 -0700 (PDT) Received: from gourin.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id l206sm13020518wmf.15.2016.10.02.02.10.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Oct 2016 02:10:13 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 2 Oct 2016 11:09:59 +0200 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Cc: Thomas Petazzoni , Romain Naour , "Yann E. MORIN" Subject: [Buildroot] [PATCH 10/10] core: allow a br2-external tree to override a defconfig X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 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" Currently, it is not possible for a br2-external tree to override a defconfig bundled in Buildroot, nor is it possible to override one from a previous br2-external tree in the stack. However, it is interesting that a latter br2-external tree be able to override a defconfig: - the ones bundled in Buildroot are minimalist, and almost always build a toolchain, so a br2-external tree may want to provide a "better" defconfig (better, in the sense "suited for the project"); - similarly for a defconfig from a previous br2-external tree. But we can't do that, as the rules for the defconfigs are generated in the order the br2-external trees are specified, all after the bundled defconfigs. Those rule are patten-matching rules, which means that the first one to match is used, and the following ones are ignored. Add a new utility macro, 'reverse', inspired from GMSL, that does what it says: reverse a list of words. Use that macro to reverse the list of br2-external trees, so that the latters win over the formers, and even over bundled ones. Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni Cc: Arnout Vandecappelle Cc: Samuel Martin Cc: Romain Naour Cc: Julien CORJON --- Makefile | 2 +- docs/manual/customize-outside-br.txt | 5 +++-- support/misc/utils.mk | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 40e6b74..67a0b5c 100644 --- a/Makefile +++ b/Makefile @@ -854,7 +854,7 @@ define percent_defconfig @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \ $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN) endef -$(eval $(foreach d,$(TOPDIR) $(BR2_EXTERNAL_DIRS),$(call percent_defconfig,$(d))$(sep))) +$(eval $(foreach d,$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(call percent_defconfig,$(d))$(sep))) savedefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig @$(COMMON_CONFIG_ENV) $< \ diff --git a/docs/manual/customize-outside-br.txt b/docs/manual/customize-outside-br.txt index 09977e0..4c0f568 100644 --- a/docs/manual/customize-outside-br.txt +++ b/docs/manual/customize-outside-br.txt @@ -169,5 +169,6 @@ And then in +$(BR2_EXTERNAL_FOO_42_PATH)/package/package1+ and + .Note: If a defconfig file is present in more than one br2-external tree, then - the first one is used. It is not possible to override a defconfig - bundled in Buildroot. + the one from the last br2-external tree is used. It is thus possible + to override a defconfig bundled in Buildroot or another br2-external + tree. diff --git a/support/misc/utils.mk b/support/misc/utils.mk index 990a3d1..c443193 100644 --- a/support/misc/utils.mk +++ b/support/misc/utils.mk @@ -46,6 +46,10 @@ endef $(eval $(call caseconvert-helper,UPPERCASE,$(join $(addsuffix :,$([FROM])),$([TO])))) $(eval $(call caseconvert-helper,LOWERCASE,$(join $(addsuffix :,$([TO])),$([FROM])))) +# Reverse the orders of words in a list. Again, inspired by the gmsl +# 'reverse' macro. +reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1))) + # Sanitize macro cleans up generic strings so it can be used as a filename # and in rules. Particularly useful for VCS version strings, that can contain # slashes, colons (OK in filenames but not in rules), and spaces.