On Sun, May 08, 2011 at 09:19:37PM +0000, Stuart Henderson wrote:
> On 2011-05-08, Julia Lawall <[email protected]> wrote:
> > Thanks for the update.  I'm not completely sure to understand the=20
> > solution, though.  Could we just use the linux pattern as is, and then=20
> > call gegrep instead of egrep?
> 
> That's possible, though coccinelle would be more portable to
> other OS if it only used POSIX extended regular expressions
> (these should work ok with GNU grep too).

[[:<:]] and [[:>:]], which work with our (OpenBSD's) regexps doesn't
work with ggrep. (And I didn't find any mention of them in the
standard).

So we have to patch coccinelle for OpenBSD in either way (use ggrep
or use [[:<:]] and [[:>:]]). Below is the ggrep version (for the
OpenBSD port).

A *clean* fix would be to drop using grep (or ggrep) at all and use
some regexp-library for ocaml instead of calling system tools. But
I'm not very used to ocaml, so I don't know wether there's a good
regexp-library available.

Ciao,
        Kili

diff -rup ../coccinelle.orig/Makefile ./Makefile
--- ../coccinelle.orig/Makefile Sun May  8 12:07:35 2011
+++ ./Makefile  Sun May  8 12:07:53 2011
@@ -28,7 +28,8 @@ MODULES =             lang/ocaml \
 BUILD_DEPENDS =                ${RUN_DEPENDS} \
                        sysutils/findlib
 REGRESS_DEPENDS =      ${FULLPKGPATH}
-RUN_DEPENDS =          textproc/gdiff
+RUN_DEPENDS =          sysutils/ggrep \
+                       textproc/gdiff
 
 USE_GMAKE =            Yes
 CONFIGURE_STYLE =      simple
diff -rup ../coccinelle.orig/patches/patch-cocci_ml ./patches/patch-cocci_ml
--- ../coccinelle.orig/patches/patch-cocci_ml   Thu May  5 21:06:44 2011
+++ ./patches/patch-cocci_ml    Sun May  8 12:08:37 2011
@@ -1,6 +1,6 @@
 $OpenBSD$
---- cocci.ml.orig      Thu May  5 20:04:22 2011
-+++ cocci.ml   Thu May  5 20:04:39 2011
+--- cocci.ml.orig      Wed Apr 13 07:25:58 2011
++++ cocci.ml   Sun May  8 12:08:20 2011
 @@ -263,8 +263,8 @@ let show_or_not_diff2 cfile outfile =
  
        let line =
@@ -12,3 +12,12 @@ $OpenBSD$
        let xs =
          let res = Common.cmd_to_list line in
          match (!Flag.patch,res) with
+@@ -495,7 +495,7 @@ let worth_trying cfiles tokens =
+       | _ -> s
+ 
+       ) in
+-      let com = sprintf "egrep -q '(%s)' %s" (join "|" tokens) (join " " 
cfiles)
++      let com = sprintf "gegrep -q '(%s)' %s" (join "|" tokens) (join " " 
cfiles)
+       in
+       (match Sys.command com with
+       | 0 (* success *) -> true
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to