Message ID | 1468847463-107132-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 0798C2C0C; Mon, 18 Jul 2016 15:11:08 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 58D1E2C07 for <dev@dpdk.org>; Mon, 18 Jul 2016 15:11:06 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 18 Jul 2016 06:11:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,384,1464678000"; d="scan'208";a="997443009" 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 06:11:04 -0700 From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> To: dev@dpdk.org Date: Mon, 18 Jul 2016 14:11:03 +0100 Message-Id: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 2.4.11 Subject: [dpdk-dev] [PATCH] 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, 1:11 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>
---
mk/rte.sdkconfig.mk | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
Comments
2016-07-18 14:11, Sergio Gonzalez Monroy: > 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. Christian, an opinion please? > Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> [...] > - 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; \ > + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp2 ; \ > + mv $(RTE_OUTPUT)/.config_tmp2 $(RTE_OUTPUT)/.config_tmp ; \ > + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ You can avoid creating/deleting the file .config_tmp2 by using a variable: config=$(grep -v '^#' $(RTE_OUTPUT)/.config_tmp) echo "$config" | awk ... > $(RTE_OUTPUT)/.config_tmp
On 18/07/2016 14:25, Thomas Monjalon wrote: > 2016-07-18 14:11, Sergio Gonzalez Monroy: >> 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. > Christian, an opinion please? Sorry, forgot to CC him. >> Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") >> >> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> > [...] >> - 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; \ >> + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp2 ; \ >> + mv $(RTE_OUTPUT)/.config_tmp2 $(RTE_OUTPUT)/.config_tmp ; \ >> + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ > You can avoid creating/deleting the file .config_tmp2 by using a variable: > config=$(grep -v '^#' $(RTE_OUTPUT)/.config_tmp) > echo "$config" | awk ... > $(RTE_OUTPUT)/.config_tmp Sure. Sergio
Hi Sergio, you might have seen that I had a similar version with awk in v2 IIRC. I also had the secondary tmp file just like you now. So, since it is so close to my old submission I wont object :-) Back then the discussion went for reduced build time dependencies and avoiding a second temp file, which was ok for me - so sed was chosen. I see that breaking on BSD causes us to rework it again, sorry that I was unable to test there. If you could come up with a Solution "sed + no-temp2 + noGNUspecifics" that would be great and solve everybodies needs. If not, it is a call up to the participants of the old discussion if not working on BSD outweighs their old feedback (I guess so). Most active in the discussion back then was Ferruh IIRC - setting to CC. Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd On Mon, Jul 18, 2016 at 3:39 PM, Sergio Gonzalez Monroy < sergio.gonzalez.monroy@intel.com> wrote: > On 18/07/2016 14:25, Thomas Monjalon wrote: > >> 2016-07-18 14:11, Sergio Gonzalez Monroy: >> >>> 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. >>> >> Christian, an opinion please? >> > > Sorry, forgot to CC him. > > Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") >>> >>> Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> >>> >> [...] >> >>> - 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; \ >>> + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | awk -F'=' >>> '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp2 ; >>> \ >>> + mv $(RTE_OUTPUT)/.config_tmp2 $(RTE_OUTPUT)/.config_tmp >>> ; \ >>> + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ >>> >> You can avoid creating/deleting the file .config_tmp2 by using a variable: >> config=$(grep -v '^#' $(RTE_OUTPUT)/.config_tmp) >> echo "$config" | awk ... > $(RTE_OUTPUT)/.config_tmp >> > > Sure. > > Sergio >
On 18/07/2016 14:54, Christian Ehrhardt wrote: > Hi Sergio, > you might have seen that I had a similar version with awk in v2 IIRC. > I also had the secondary tmp file just like you now. > So, since it is so close to my old submission I wont object :-) > > Back then the discussion went for reduced build time dependencies and > avoiding a second temp file, which was ok for me - so sed was chosen. > I haven't seen a noticeable performance impact by using second temp file. Thomas has suggested using a temp var instead of second temp file, what do you think about that? > I see that breaking on BSD causes us to rework it again, sorry that I > was unable to test there. > No worries. > If you could come up with a Solution "sed + no-temp2 + noGNUspecifics" > that would be great and solve everybodies needs. > If not, it is a call up to the participants of the old discussion if > not working on BSD outweighs their old feedback (I guess so). > Any reason of sed over awk? I reckon awk is simpler syntax for this job. From what I have seen most of the time is spent on resolving directory/library dependencies not on the .config itself. Sergio > Most active in the discussion back then was Ferruh IIRC - setting to CC. > > > > Christian Ehrhardt > Software Engineer, Ubuntu Server > Canonical Ltd > > On Mon, Jul 18, 2016 at 3:39 PM, Sergio Gonzalez Monroy > <sergio.gonzalez.monroy@intel.com > <mailto:sergio.gonzalez.monroy@intel.com>> wrote: > > On 18/07/2016 14:25, Thomas Monjalon wrote: > > 2016-07-18 14:11, Sergio Gonzalez Monroy: > > 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. > > Christian, an opinion please? > > > Sorry, forgot to CC him. > > Fixes: b2063f104db7 ("mk: filter duplicate configuration > entries") > > Signed-off-by: Sergio Gonzalez Monroy > <sergio.gonzalez.monroy@intel.com > <mailto:sergio.gonzalez.monroy@intel.com>> > > [...] > > - 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; \ > + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | > awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > > $(RTE_OUTPUT)/.config_tmp2 ; \ > + mv $(RTE_OUTPUT)/.config_tmp2 > $(RTE_OUTPUT)/.config_tmp ; \ > + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ > > You can avoid creating/deleting the file .config_tmp2 by using > a variable: > config=$(grep -v '^#' $(RTE_OUTPUT)/.config_tmp) > echo "$config" | awk ... > $(RTE_OUTPUT)/.config_tmp > > > Sure. > > Sergio > >
2016-07-18 15:54, Christian Ehrhardt: > Hi Sergio, > you might have seen that I had a similar version with awk in v2 IIRC. I > also had the secondary tmp file just like you now. > So, since it is so close to my old submission I wont object :-) > > Back then the discussion went for reduced build time dependencies and > avoiding a second temp file, which was ok for me - so sed was chosen. I don't see "awk" as a real dependency. I think it is as much common as "sed". Isn't it?
On 18/07/2016 15:07, Thomas Monjalon wrote: > 2016-07-18 15:54, Christian Ehrhardt: >> Hi Sergio, >> you might have seen that I had a similar version with awk in v2 IIRC. I >> also had the secondary tmp file just like you now. >> So, since it is so close to my old submission I wont object :-) >> >> Back then the discussion went for reduced build time dependencies and >> avoiding a second temp file, which was ok for me - so sed was chosen. > I don't see "awk" as a real dependency. I think it is as much common > as "sed". Isn't it? I would agree. So v2 using temp var instead? Sergio
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk index e93237f..5c28b7b 100644 --- a/mk/rte.sdkconfig.mk +++ b/mk/rte.sdkconfig.mk @@ -88,11 +88,9 @@ $(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; \ + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp2 ; \ + mv $(RTE_OUTPUT)/.config_tmp2 $(RTE_OUTPUT)/.config_tmp ; \ + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ 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 ; \