From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergio Gonzalez Monroy Subject: Re: [PATCH] mk: fix FreeBSD build Date: Mon, 18 Jul 2016 15:06:03 +0100 Message-ID: <94150855-1fb6-84e6-45a6-ca27748ca02b@intel.com> References: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> <2323240.uRAlvIC4g0@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Thomas Monjalon , dev , Ferruh Yigit To: Christian Ehrhardt Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 5F469377C for ; Mon, 18 Jul 2016 16:06:09 +0200 (CEST) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > > 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 > > > > [...] > > - 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 > >