From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 44A72F72 for ; Tue, 19 Jul 2016 12:32:23 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 19 Jul 2016 03:32:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,389,1464678000"; d="scan'208";a="1019682528" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.221.81]) ([10.237.221.81]) by orsmga002.jf.intel.com with ESMTP; 19 Jul 2016 03:32:05 -0700 To: Sergio Gonzalez Monroy , dev@dpdk.org References: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1468857995-130392-1-git-send-email-sergio.gonzalez.monroy@intel.com> Cc: thomas.monjalon@6wind.com, christian.ehrhardt@canonical.com From: Ferruh Yigit Message-ID: <578E01A5.6020601@intel.com> Date: Tue, 19 Jul 2016 11:32:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1468857995-130392-1-git-send-email-sergio.gonzalez.monroy@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] mk: fix FreeBSD build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 10:32:23 -0000 On 7/18/2016 5:06 PM, Sergio Gonzalez Monroy wrote: > The sed syntax of '0,/regexp/' is GNU specific and fails with > non GNU sed in FreeBSD. > > To solve the issue we can use awk instead to remove duplicates. > > Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") > > Signed-off-by: Sergio Gonzalez Monroy > --- > > v2: > - Use temp var instead of temp file > > mk/rte.sdkconfig.mk | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk > index e93237f..c2b6e13 100644 > --- a/mk/rte.sdkconfig.mk > +++ b/mk/rte.sdkconfig.mk > @@ -88,11 +88,8 @@ $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT) > $(CPP) -undef -P -x assembler-with-cpp \ > -ffreestanding \ > -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \ > - for config in $$(grep -v "^#" $(RTE_OUTPUT)/.config_tmp | cut -d"=" -f1 | sort | uniq -d); do \ > - while [ $$(grep "^$${config}=" $(RTE_OUTPUT)/.config_tmp -c ) -gt 1 ]; do \ > - sed -i "0,/^$${config}=/{//d}" $(RTE_OUTPUT)/.config_tmp; \ > - done; \ > - done; \ > + config=$$(grep -v "^#" $(RTE_OUTPUT)/.config_tmp) ; \ > + echo "$$config" | awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp ; \ This is another nice awk command. A few comments about new command: - Removes all comments from final config - Spreads config option all over the file, logical grouping of options removed. When both happens at the same time, I have a concern that this may lead missing some config options when somebody wants to update local config file, but I am OK if everybody is OK. > if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \ > cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \ > cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \ >