From: Charles Steinkuehler <charles@steinkuehler.net>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: [Xenomai] [PATCH] Fix for awk vs. gawk
Date: Wed, 21 Aug 2013 17:15:01 -0500 [thread overview]
Message-ID: <52153BE5.8060409@steinkuehler.net> (raw)
In-Reply-To: <5213F7DA.1010200@xenomai.org>
On 8/20/2013 6:12 PM, Gilles Chanteperdrix wrote:
> On 08/21/2013 12:37 AM, Charles Steinkuehler wrote:
>> Problem #1 (solved): The genpatches.sh script calls awk, but seems
>> to be incompatible with the stock awk (mawk) on my Debian Wheezy
>> system. I was getting errors on all the match ($0, ...) lines
>> until I installed gawk:
>
> I knew that, sorry for not mentioning it. And by the way, if you know
> how to rewrite this in portable awk, patches are welcome.
Here you go. You have to do away with the character classes, but the
gawk code is only using [:blank:] which is space and tab, so not a whole
lot of horrible things to go wrong with multi-character international
locales. :)
On my system this produces the exact same output using mawk as the
existing code produces with gawk, but I only tested in the ipipe-3.8
branch. That said, I think I properly converted the intent of the regex
matching code into something most older awk implementations can
understand.
It might not be as pretty as the gawk code (I'm more used to hacking sed
than awk, and the gawk extensions _are_ nifty), but it should work with
most awks now.
--
Charles Steinkuehler
charles@steinkuehler.net
-------------- next part --------------
From 292bbfc65b5e2fb5cd13f9632c74eccdfb50b84f Mon Sep 17 00:00:00 2001
From: Charles Steinkuehler <charles@steinkuehler.net>
Date: Wed, 21 Aug 2013 17:00:29 -0500
Subject: [PATCH] Modify awk script to work with unenhanced match() function
as found in mawk and other awks
Signed-off-by: Charles Steinkuehler <charles@steinkuehler.net>
---
scripts/ipipe/genpatches.sh | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/scripts/ipipe/genpatches.sh b/scripts/ipipe/genpatches.sh
index 563d5c1..d29cb9e 100755
--- a/scripts/ipipe/genpatches.sh
+++ b/scripts/ipipe/genpatches.sh
@@ -84,16 +84,19 @@ BEGIN {
driver_arch["pci/htirq.c"]="x86"
}
-match($0, /^diff --git a\/arch\/([^[:blank:]\/]*)/, arch) {
- a=arch[1]
+match($0, /^diff --git a\/arch\/([^ \t\/]*)/) {
+ split(substr($0, RSTART, RLENGTH), arch, /\//)
+ a=arch[3]
set_current_arch(a)
print $0 >> current_file
next
}
-match($0, /^diff --git a\/drivers\/([^[:blank:]]*)/, file) {
- f=file[1]
+match($0, /^diff --git a\/drivers\/([^ \t]*)/) {
+ file=substr($0, RSTART, RLENGTH)
+ sub(/^diff --git a\/drivers\//, "", file)
+ f=file
if (!driver_arch[f]) {
print "Error unknown architecture for driver "f
@@ -120,8 +123,9 @@ match($0, /^diff --git a\/drivers\/([^[:blank:]]*)/, file) {
next
}
-match ($0, /#define [I]PIPE_CORE_RELEASE[[:blank:]]*([^[:blank:]]*)/, vers) {
- version[current_arch]=vers[1]
+match ($0, /#define [I]PIPE_CORE_RELEASE[ \t]*([^ \t]*)/) {
+ split(substr($0, RSTART, RLENGTH), vers, /[ \t]/)
+ version[current_arch]=vers[3]
}
{
--
1.7.10.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20130821/4faec57e/attachment.pgp>
next prev parent reply other threads:[~2013-08-21 22:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 14:58 [Xenomai] Building BeagleBone kernel from git Charles Steinkuehler
2013-08-20 18:39 ` Gilles Chanteperdrix
2013-08-20 18:45 ` Sagar Behere
2013-08-21 5:53 ` Michael Haberler
2013-08-21 8:45 ` Jan Kiszka
2013-08-20 19:49 ` Charles Steinkuehler
2013-08-20 19:55 ` Gilles Chanteperdrix
2013-08-20 20:25 ` Charles Steinkuehler
2013-08-20 22:37 ` Charles Steinkuehler
2013-08-20 23:12 ` Gilles Chanteperdrix
2013-08-21 22:15 ` Charles Steinkuehler [this message]
2013-08-25 23:54 ` [Xenomai] [PATCH] Fix for awk vs. gawk Gilles Chanteperdrix
2013-08-21 13:16 ` [Xenomai] Building BeagleBone kernel from git Charles Steinkuehler
2013-08-21 18:25 ` Gilles Chanteperdrix
2013-08-24 17:10 ` Ralf Roesch
2013-08-24 17:54 ` Michael Haberler
2013-08-25 0:59 ` Charles Steinkuehler
2013-08-25 7:24 ` Ralf Roesch
2013-08-27 19:59 ` [Xenomai] [PATCH] BeagleBone 3.8.13 pre/post patches Charles Steinkuehler
2013-08-27 21:12 ` Gilles Chanteperdrix
2013-08-27 21:13 ` Gilles Chanteperdrix
2013-08-27 21:57 ` Charles Steinkuehler
2013-09-10 18:48 ` Gilles Chanteperdrix
2013-09-10 21:20 ` Charles Steinkuehler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52153BE5.8060409@steinkuehler.net \
--to=charles@steinkuehler.net \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.