From patchwork Thu Nov 1 01:09:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nasser Afshin X-Patchwork-Id: 991781 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NlnjcVXW"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42lnFR3dSSz9s3Z for ; Thu, 1 Nov 2018 12:10:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A4A228624E; Thu, 1 Nov 2018 01:10:31 +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 yoNfNT5H7Dpp; Thu, 1 Nov 2018 01:10:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id F066F86952; Thu, 1 Nov 2018 01:10:30 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id AFA071BF27A for ; Thu, 1 Nov 2018 01:10:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id ACE4085699 for ; Thu, 1 Nov 2018 01:10:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Q6lzXLb5MST for ; Thu, 1 Nov 2018 01:10:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by fraxinus.osuosl.org (Postfix) with ESMTPS id BF9E985670 for ; Thu, 1 Nov 2018 01:10:28 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id w7-v6so29666wmc.1 for ; Wed, 31 Oct 2018 18:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ANLnjlG4z+mZ5gZYrwaX/2a+vKChVtxNb6ZUIIRrPfg=; b=NlnjcVXWLAhN6t8KUodR5m9P2vgjohP4GUogMddk+hbBsXOxYGETNpXgsw3P4DH5x8 miqS2+753TZD80ZcxojyZGjMoWNmpvoNBWz/97hZxdLHs00xafwsXsKBFFHcsJrYERYn 9VKGmmT4fRIHC16F60kiCjdlgVItsdLJtutKfFi9HBw4Ww2cDfDPpstt8kXtcFf8A7s7 TIhPO/od4dCSDLjjywsT6owLlYp/cl65oolfU3lWgwhymqbYokV9cPNFdF2HDl3UuJ/H qBtByiRCTvyVcIjCo9949dXGlhWOFtT9drZJFATvAKC9dZpN/yAD7fOet7nKllMkZ/bi IWgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ANLnjlG4z+mZ5gZYrwaX/2a+vKChVtxNb6ZUIIRrPfg=; b=Xzl1KeRFpWjuQRUA55RY99M6diZX7GX3w6YWQ6a3dO1kU5ZGnSL3K5PE7TeSxlTpxV urN7Li9qUE/guHEX9U7ZSUpcwrlaljT0qWWNKhqUSxebbS/zsTw7Q0enyO2UJyUULgrU 2ZsYROJa3cv1djKBwhcAJ9csHty6+DIW5O36FPZhrGxs9vEZ8VYLF142DdRSdXWoEP1E q9as+oL0stPzmENXUto2Xsz8fqTX+MRQY2Wa2CKXpwoa5+kPtbuV0W4PCw8j8Er2f7dM QDH9TzhSXijJEAGfASGUgWRN/q/85FYJS5vGa/voeA5EMd+JjbRsSdYPXzjEj5S6/WSI 9XRA== X-Gm-Message-State: AGRZ1gLhwYNQ83W649Qm374/i2FZ4qHi3eZHJzRXAvrhfUzlqGR5z93Y +KveAJLIsvFDE5DZs9uk4Hk= X-Google-Smtp-Source: AJdET5dDePNCAMkg7Fa8TaWJGswwzIOauxTT4gd/xo1dfBwC/balefdp1uUsF96BioDbKV4uj0jckQ== X-Received: by 2002:a1c:cb89:: with SMTP id b131-v6mr4085264wmg.115.1541034627103; Wed, 31 Oct 2018 18:10:27 -0700 (PDT) Received: from localhost.localdomain ([31.56.181.53]) by smtp.gmail.com with ESMTPSA id n2-v6sm8864973wrm.36.2018.10.31.18.10.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Oct 2018 18:10:26 -0700 (PDT) From: Nasser Afshin To: Petr Vorel Date: Thu, 1 Nov 2018 04:39:53 +0330 Message-Id: <20181101010953.20996-1-afshin.nasser@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20181031205608.GA4061@x230> References: <20181031205608.GA4061@x230> Subject: [Buildroot] [PATCH] merge_config.sh: Fix merging buildroot config files X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nasser Afshin , buildroot MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch allows us to define config prefix with CONFIG_ environment variable. Now we can define BR2_ prefix when we are going to merge buildroot fragment configs. By setting the proper config prefix, we will have proper 'redundant configuration warnings' when we use '-r -m' options. This is actually an upstream patch [1] from linux/kbuild project. [1] https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=for-next&id=f6fe19e9d84400e1c9544c1909952c2c7c6a90a2 Signed-off-by: Nasser Afshin --- support/kconfig/merge_config.sh | 8 ++++- ...e_config.sh-Allow-to-define-config-prefix.patch | 39 ++++++++++++++++++++++ support/kconfig/patches/series | 1 + utils/test-pkg | 2 +- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch diff --git a/support/kconfig/merge_config.sh b/support/kconfig/merge_config.sh index 50de5114dc..15441182cf 100755 --- a/support/kconfig/merge_config.sh +++ b/support/kconfig/merge_config.sh @@ -34,12 +34,16 @@ usage() { echo " -r list redundant entries when merging fragments" echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." echo " -e colon-separated list of br2-external trees to use (optional)" + echo + echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ + environment variable." } RUNMAKE=true ALLTARGET=alldefconfig WARNREDUN=false OUTPUT=. +CONFIG_PREFIX=${CONFIG_-CONFIG_} while true; do case $1 in @@ -105,7 +109,8 @@ if [ ! -r "$INITFILE" ]; then fi MERGE_LIST=$* -SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" +SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" + TMP_FILE=$(mktemp -t .tmp.config.XXXXXXXXXX) echo "Using $INITFILE as base" @@ -157,6 +162,7 @@ fi # Use the merged file as the starting point for: # alldefconfig: Fills in any missing symbols with Kconfig default # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set +unset CONFIG_ make KCONFIG_ALLCONFIG=$TMP_FILE $EXTERNAL_ARG $OUTPUT_ARG $ALLTARGET diff --git a/support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch b/support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch new file mode 100644 index 0000000000..7b05736b05 --- /dev/null +++ b/support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch @@ -0,0 +1,39 @@ +Index: kconfig/merge_config.sh +=================================================================== +--- kconfig.orig/merge_config.sh ++++ kconfig/merge_config.sh +@@ -34,12 +34,16 @@ usage() { + echo " -r list redundant entries when merging fragments" + echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." + echo " -e colon-separated list of br2-external trees to use (optional)" ++ echo ++ echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ ++ environment variable." + } + + RUNMAKE=true + ALLTARGET=alldefconfig + WARNREDUN=false + OUTPUT=. ++CONFIG_PREFIX=${CONFIG_-CONFIG_} + + while true; do + case $1 in +@@ -105,7 +109,8 @@ if [ ! -r "$INITFILE" ]; then + fi + + MERGE_LIST=$* +-SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" ++SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" ++ + TMP_FILE=$(mktemp -t .tmp.config.XXXXXXXXXX) + + echo "Using $INITFILE as base" +@@ -157,6 +162,7 @@ fi + # Use the merged file as the starting point for: + # alldefconfig: Fills in any missing symbols with Kconfig default + # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set ++unset CONFIG_ + make KCONFIG_ALLCONFIG=$TMP_FILE $EXTERNAL_ARG $OUTPUT_ARG $ALLTARGET + + diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series index e136de7937..be8627db13 100644 --- a/support/kconfig/patches/series +++ b/support/kconfig/patches/series @@ -8,3 +8,4 @@ 17-backport-kecho.patch 18-merge-config.sh-create-temporary-files-in-tmp.patch 19-merge_config.sh-add-br2-external-support.patch +20-merge_config.sh-Allow-to-define-config-prefix.patch diff --git a/utils/test-pkg b/utils/test-pkg index aa91ee02cf..f2d519b4f6 100755 --- a/utils/test-pkg +++ b/utils/test-pkg @@ -129,7 +129,7 @@ build_one() { mkdir -p "${dir}" - support/kconfig/merge_config.sh -O "${dir}" \ + CONFIG_=BR2_ support/kconfig/merge_config.sh -O "${dir}" \ "${toolchainconfig}" "support/config-fragments/minimal.config" "${cfg}" \ >> "${dir}/logfile" 2>&1 # We want all the options from the snippet to be present as-is (set