FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 12-25-2010, 11:43 PM
Allan McRae
 
Default makepkg and (n)awk

On 26/12/10 09:59, Nezmer wrote:

Hi,

In commit ef977865, awk was added as an external tool needed by makepkg.

As you know, there is different awk implementations out there. nawk is
the implementation shipped by default in non-GNU systems As far as I
know.

Unfortunately, awk usage in makepkg is not nawk-compatible.

Command:

%gawk '/^[[:space:]]*provides=/,/)/' B | sed "s/provides=/provides_list+=/"

Output:

provides_list+=('p1' 'p2' '3') # comment

Command:

% awk '/^[[:space:]]*provides=/,/)/' B | sed "s/provides=/provides_list+=/"

Output:

awk: illegal primary in regular expression ) at
source line number 1
context is
>>> /^[[:space:]]*provides=/,/)/<<<


======================

Anyway, what is awk doing here? Is it the same as:
egrep '^s*provides=(.*)'



No its not... it handles depends/provides arrays going over multiple lines.

Perhaps there is a way that both gawk/nawk can do that using the same
regex. That would be the best solution. Otherwise we need to either
use gawk explicitly or do some autoconf stuff...


Allan
 
Old 12-26-2010, 10:23 PM
Dave Reisner
 
Default makepkg and (n)awk

On Sun, Dec 26, 2010 at 01:59:05AM +0200, Nezmer wrote:
> Hi,
>
> In commit ef977865, awk was added as an external tool needed by makepkg.
>
> As you know, there is different awk implementations out there. nawk is
> the implementation shipped by default in non-GNU systems As far as I
> know.
>
> Unfortunately, awk usage in makepkg is not nawk-compatible.
>
> Command:
>
> %gawk '/^[[:space:]]*provides=/,/)/' B | sed "s/provides=/provides_list+=/"
>
> Output:
>
> provides_list+=('p1' 'p2' '3') # comment
>
> Command:
>
> % awk '/^[[:space:]]*provides=/,/)/' B | sed "s/provides=/provides_list+=/"
>
> Output:
>
> awk: illegal primary in regular expression ) at
> source line number 1
> context is
> >>> /^[[:space:]]*provides=/,/)/ <<<
>
>
> ======================
>
> Anyway, what is awk doing here? Is it the same as:
> egrep '^s*provides=(.*)'
>

Installed nawk to play around with this. It looks like all that's needed is to
escape the closing parenthesis on the ending address:

$ nawk '/^[[:space:]]*md5sums=/,/)/' < PKGBUILD
md5sums=('f26f78f09cc675c9d2c0eacc54b223d6'
'c5e849fcb1101149977355c99d8ff78f'
'096a46ef386817988250d2d7bddd1b34')

This plays well with gawk and mawk as well.

Wasn't able to locate a multi-line provides, but any multi-line array attribute
should be sufficient, no?

dave
 
Old 12-26-2010, 10:34 PM
Allan McRae
 
Default makepkg and (n)awk

On 27/12/10 09:23, Dave Reisner wrote:

On Sun, Dec 26, 2010 at 01:59:05AM +0200, Nezmer wrote:

Hi,

In commit ef977865, awk was added as an external tool needed by makepkg.

As you know, there is different awk implementations out there. nawk is
the implementation shipped by default in non-GNU systems As far as I
know.

Unfortunately, awk usage in makepkg is not nawk-compatible.

Command:

%gawk '/^[[:space:]]*provides=/,/)/' B | sed "s/provides=/provides_list+=/"

Output:

provides_list+=('p1' 'p2' '3') # comment

Command:

% awk '/^[[:space:]]*provides=/,/)/' B | sed "s/provides=/provides_list+=/"

Output:

awk: illegal primary in regular expression ) at
source line number 1
context is
>>> /^[[:space:]]*provides=/,/)/<<<


======================

Anyway, what is awk doing here? Is it the same as:
egrep '^s*provides=(.*)'



Installed nawk to play around with this. It looks like all that's needed is to
escape the closing parenthesis on the ending address:

$ nawk '/^[[:space:]]*md5sums=/,/)/'< PKGBUILD
md5sums=('f26f78f09cc675c9d2c0eacc54b223d6'
'c5e849fcb1101149977355c99d8ff78f'
'096a46ef386817988250d2d7bddd1b34')

This plays well with gawk and mawk as well.


Awesome. Want to send a patch?


Wasn't able to locate a multi-line provides, but any multi-line array attribute
should be sufficient, no?


Yes, any multi-line array is fine.

Allan
 

Thread Tools




All times are GMT. The time now is 11:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org