Message ID | 1468857995-130392-1-git-send-email-sergio.gonzalez.monroy@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 90A249E7; Mon, 18 Jul 2016 18:06:40 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 70503968 for <dev@dpdk.org>; Mon, 18 Jul 2016 18:06:38 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 18 Jul 2016 09:06:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,384,1464678000"; d="scan'208";a="997611082" Received: from sie-lab-212-209.ir.intel.com (HELO silpixa00377983.ir.intel.com) ([10.237.212.209]) by orsmga001.jf.intel.com with ESMTP; 18 Jul 2016 09:06:36 -0700 From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, christian.ehrhardt@canonical.com, ferruh.yigit@intel.com Date: Mon, 18 Jul 2016 17:06:35 +0100 Message-Id: <1468857995-130392-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [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 <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Sergio Gonzalez Monroy
July 18, 2016, 4:06 p.m. UTC
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 <sergio.gonzalez.monroy@intel.com>
---
v2:
- Use temp var instead of temp file
mk/rte.sdkconfig.mk | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Comments
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 <sergio.gonzalez.monroy@intel.com> > --- > > 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 ; \ >
Hi, I haven't tested the new suggested way, just went into explaining what formerly were the reasons. But I'd strongly vote against reordering and dropping comments. Sergio - v3 had still awk for some parts. It doesn't have the "0,..." you mentioned. Could you check if that is already using GNU-sed only syntax - http://dpdk.org/dev/patchwork/patch/14592/ ? If this would be ok - AND - if it creates the same .config as the current code I'd think that is the way to go. Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd On Tue, Jul 19, 2016 at 12:32 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote: > 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 <sergio.gonzalez.monroy@intel.com> > > --- > > > > 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 ; \ > > > >
Sorry Christian, I did miss your previous patches. On 19/07/2016 12:01, Christian Ehrhardt wrote: > Hi, > I haven't tested the new suggested way, just went into explaining what > formerly were the reasons. > But I'd strongly vote against reordering and dropping comments. > Fair enough. We would still have some not-order options if they are duplicated as we would just keep the last one but nevertheless most of them would be properly grouped and ordered. I'll rework something based on your v3 patch. Sergio > Sergio - v3 had still awk for some parts. > It doesn't have the "0,..." you mentioned. > Could you check if that is already using GNU-sed only syntax - > http://dpdk.org/dev/patchwork/patch/14592/ ? > > If this would be ok - AND - if it creates the same .config as the > current code I'd think that is the way to go. > > > Christian Ehrhardt > Software Engineer, Ubuntu Server > Canonical Ltd > > On Tue, Jul 19, 2016 at 12:32 PM, Ferruh Yigit <ferruh.yigit@intel.com > <mailto:ferruh.yigit@intel.com>> wrote: > > 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 > <sergio.gonzalez.monroy@intel.com > <mailto:sergio.gonzalez.monroy@intel.com>> > > --- > > > > v2: > > - Use temp var instead of temp file > > > > mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> | 7 ++----- > > 1 file changed, 2 insertions(+), 5 deletions(-) > > > > diff --git a/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> > b/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> > > index e93237f..c2b6e13 100644 > > --- a/mk/rte.sdkconfig.mk <http://rte.sdkconfig.mk> > > +++ b/mk/rte.sdkconfig.mk <http://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 ; \ > > > >
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 ; \ 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 ; \