Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1422388 > unrolled thread
| Started by | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| First post | 2016-06-15 00:20 +0200 |
| Last post | 2016-06-15 18:10 +0200 |
| Articles | 12 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-15 00:20 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci Julia Lawall <julia.lawall@lip6.fr> - 2016-06-15 08:10 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-15 18:00 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci Julia Lawall <julia.lawall@lip6.fr> - 2016-06-15 10:50 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-15 17:50 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci Julia Lawall <julia.lawall@lip6.fr> - 2016-06-15 18:00 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-15 18:10 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci Julia Lawall <julia.lawall@lip6.fr> - 2016-06-15 18:20 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-15 18:50 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci Julia Lawall <julia.lawall@lip6.fr> - 2016-06-15 19:00 +0200
Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-15 21:10 +0200
Re: scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci SF Markus Elfring <elfring@users.sourceforge.net> - 2016-06-15 18:10 +0200
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2016-06-15 00:20 +0200 |
| Subject | [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rK4QG-2oZ-27@gated-at.bofh.it> |
Make use of the new kernel python requirements library to be able to
specify coccinelle binary version requirements. The cocci file
device_node_continue.cocci requires at least coccinelle 1.0.4.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
scripts/coccinelle/iterators/device_node_continue.cocci | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/scripts/coccinelle/iterators/device_node_continue.cocci b/scripts/coccinelle/iterators/device_node_continue.cocci
index 38ab744a4037..b590de9418d1 100644
--- a/scripts/coccinelle/iterators/device_node_continue.cocci
+++ b/scripts/coccinelle/iterators/device_node_continue.cocci
@@ -12,6 +12,19 @@ virtual context
virtual org
virtual report
+// This uses a conjunction, which requires at least coccinelle >= 1.0.4
+@script:python@
+@@
+
+import sys
+from lib import reqs
+
+req = reqs.Req()
+req.coccinelle('1.0.4')
+if not req.reqs_match():
+ cocci.exit()
+ sys.exit(1)
+
@r exists@
expression e1,e2;
local idexpression n;
--
2.8.2
[toc] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-06-15 08:10 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKcbw-7f2-37@gated-at.bofh.it> |
| In reply to | #1422388 |
On Tue, 14 Jun 2016, Luis R. Rodriguez wrote:
> Make use of the new kernel python requirements library to be able to
> specify coccinelle binary version requirements. The cocci file
> device_node_continue.cocci requires at least coccinelle 1.0.4.
>
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
> scripts/coccinelle/iterators/device_node_continue.cocci | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/scripts/coccinelle/iterators/device_node_continue.cocci b/scripts/coccinelle/iterators/device_node_continue.cocci
> index 38ab744a4037..b590de9418d1 100644
> --- a/scripts/coccinelle/iterators/device_node_continue.cocci
> +++ b/scripts/coccinelle/iterators/device_node_continue.cocci
> @@ -12,6 +12,19 @@ virtual context
> virtual org
> virtual report
>
> +// This uses a conjunction, which requires at least coccinelle >= 1.0.4
> +@script:python@
> +@@
> +
> +import sys
> +from lib import reqs
> +
> +req = reqs.Req()
> +req.coccinelle('1.0.4')
> +if not req.reqs_match():
> + cocci.exit()
> + sys.exit(1)
This doesn't look very appealing to me. Shouldn't Coccinelle handle this
itself?
julia
> +
> @r exists@
> expression e1,e2;
> local idexpression n;
> --
> 2.8.2
>
>
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2016-06-15 18:00 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKlou-4sY-29@gated-at.bofh.it> |
| In reply to | #1422626 |
On Wed, Jun 15, 2016 at 08:08:41AM +0200, Julia Lawall wrote:
>
>
> On Tue, 14 Jun 2016, Luis R. Rodriguez wrote:
>
> > Make use of the new kernel python requirements library to be able to
> > specify coccinelle binary version requirements. The cocci file
> > device_node_continue.cocci requires at least coccinelle 1.0.4.
> >
> > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > ---
> > scripts/coccinelle/iterators/device_node_continue.cocci | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/scripts/coccinelle/iterators/device_node_continue.cocci b/scripts/coccinelle/iterators/device_node_continue.cocci
> > index 38ab744a4037..b590de9418d1 100644
> > --- a/scripts/coccinelle/iterators/device_node_continue.cocci
> > +++ b/scripts/coccinelle/iterators/device_node_continue.cocci
> > @@ -12,6 +12,19 @@ virtual context
> > virtual org
> > virtual report
> >
> > +// This uses a conjunction, which requires at least coccinelle >= 1.0.4
> > +@script:python@
> > +@@
> > +
> > +import sys
> > +from lib import reqs
> > +
> > +req = reqs.Req()
> > +req.coccinelle('1.0.4')
> > +if not req.reqs_match():
> > + cocci.exit()
> > + sys.exit(1)
>
> This doesn't look very appealing to me. Shouldn't Coccinelle handle this
> itself?
Oh I agree, however what options do we have at the moment instead of an odd
parse error complaint ? This lets one annotate version requirements and is
backward compatible.
Luis
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-06-15 10:50 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKeGm-ez-15@gated-at.bofh.it> |
| In reply to | #1422388 |
How about the following, since Coccinelle knows what its version is? This could of course be implemented in python as well. julia diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci index 0e4fbb8..ca5b061 100644 --- a/docs/Coccilib.3cocci +++ b/docs/Coccilib.3cocci @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, in an initialize or finalize rule). .sp +.I val cocci_version +: +.B unit -> string +.sp +Returns the a string indicating the current version. Note that if +Coccinelle has been modified since a release, the version number will be +postfixed with "-dirty". +.sp + .I val print_main : .B ?color:string -> string -> pos list -> unit diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml index f60c6b2..2f352d8 100644 --- a/ocaml/coccilib.ml +++ b/ocaml/coccilib.ml @@ -168,6 +168,8 @@ let dir () = !Flag.dir let files () = !Flag.currentfiles +let cocci_version () = Config.version + (* ---------------------------------------------------------------------- *) (* org mode *)
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2016-06-15 17:50 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKleP-4pE-45@gated-at.bofh.it> |
| In reply to | #1422792 |
On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > How about the following, since Coccinelle knows what its version is? > This could of course be implemented in python as well. > > julia > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > index 0e4fbb8..ca5b061 100644 > --- a/docs/Coccilib.3cocci > +++ b/docs/Coccilib.3cocci > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > in an initialize or finalize rule). > .sp > > +.I val cocci_version > +: > +.B unit -> string > +.sp > +Returns the a string indicating the current version. Note that if > +Coccinelle has been modified since a release, the version number will be > +postfixed with "-dirty". > +.sp > + > .I val print_main > : > .B ?color:string -> string -> pos list -> unit > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > index f60c6b2..2f352d8 100644 > --- a/ocaml/coccilib.ml > +++ b/ocaml/coccilib.ml > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > let files () = !Flag.currentfiles > > +let cocci_version () = Config.version > + > (* ---------------------------------------------------------------------- *) > (* org mode *) > > Anything to *only* get the version instead of a long list is nice, right now spatch --version spits out: spatch version 1.0.5 compiled with OCaml version 4.02.3 Flags passed to the configure script: [none] Python scripting support: yes Syntax of regular expresssions: PCRE The Python library just parses the 3rd item at the top so it can extract the version. But surely if spatch --version-only was available we'd use that instead a well. Other than this though how can we require coccinelle version checks per SmPL file cleanly and also what should we do to make it backward compatible with older versions of coccinelle? Luis
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-06-15 18:00 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKlou-4sY-33@gated-at.bofh.it> |
| In reply to | #1423168 |
On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > > How about the following, since Coccinelle knows what its version is? > > This could of course be implemented in python as well. > > > > julia > > > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > > index 0e4fbb8..ca5b061 100644 > > --- a/docs/Coccilib.3cocci > > +++ b/docs/Coccilib.3cocci > > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > > in an initialize or finalize rule). > > .sp > > > > +.I val cocci_version > > +: > > +.B unit -> string > > +.sp > > +Returns the a string indicating the current version. Note that if > > +Coccinelle has been modified since a release, the version number will be > > +postfixed with "-dirty". > > +.sp > > + > > .I val print_main > > : > > .B ?color:string -> string -> pos list -> unit > > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > > index f60c6b2..2f352d8 100644 > > --- a/ocaml/coccilib.ml > > +++ b/ocaml/coccilib.ml > > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > > > let files () = !Flag.currentfiles > > > > +let cocci_version () = Config.version > > + > > (* ---------------------------------------------------------------------- *) > > (* org mode *) > > > > > > Anything to *only* get the version instead of a long list is nice, right now > spatch --version spits out: > > spatch version 1.0.5 compiled with OCaml version 4.02.3 > Flags passed to the configure script: [none] > Python scripting support: yes > Syntax of regular expresssions: PCRE > > The Python library just parses the 3rd item at the top so it can extract > the version. But surely if spatch --version-only was available we'd use > that instead a well. > > Other than this though how can we require coccinelle version checks per > SmPL file cleanly and also what should we do to make it backward compatible > with older versions of coccinelle? I'm not sure that being backward compatible with older versions of Coccinelle is worth adding new libraries to the Linux kernel, and adding unpleasant python code to semantic patches. The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop the -dirty at the coccilib level, if that seems desirable. julia
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2016-06-15 18:10 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKly9-4Mc-5@gated-at.bofh.it> |
| In reply to | #1423183 |
On Wed, Jun 15, 2016 at 05:55:34PM +0200, Julia Lawall wrote: > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > > > How about the following, since Coccinelle knows what its version is? > > > This could of course be implemented in python as well. > > > > > > julia > > > > > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > > > index 0e4fbb8..ca5b061 100644 > > > --- a/docs/Coccilib.3cocci > > > +++ b/docs/Coccilib.3cocci > > > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > > > in an initialize or finalize rule). > > > .sp > > > > > > +.I val cocci_version > > > +: > > > +.B unit -> string > > > +.sp > > > +Returns the a string indicating the current version. Note that if > > > +Coccinelle has been modified since a release, the version number will be > > > +postfixed with "-dirty". > > > +.sp > > > + > > > .I val print_main > > > : > > > .B ?color:string -> string -> pos list -> unit > > > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > > > index f60c6b2..2f352d8 100644 > > > --- a/ocaml/coccilib.ml > > > +++ b/ocaml/coccilib.ml > > > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > > > > > let files () = !Flag.currentfiles > > > > > > +let cocci_version () = Config.version > > > + > > > (* ---------------------------------------------------------------------- *) > > > (* org mode *) > > > > > > > > > > Anything to *only* get the version instead of a long list is nice, right now > > spatch --version spits out: > > > > spatch version 1.0.5 compiled with OCaml version 4.02.3 > > Flags passed to the configure script: [none] > > Python scripting support: yes > > Syntax of regular expresssions: PCRE > > > > The Python library just parses the 3rd item at the top so it can extract > > the version. But surely if spatch --version-only was available we'd use > > that instead a well. > > > > Other than this though how can we require coccinelle version checks per > > SmPL file cleanly and also what should we do to make it backward compatible > > with older versions of coccinelle? > > I'm not sure that being backward compatible with older versions of > Coccinelle is worth adding new libraries to the Linux kernel, and adding > unpleasant python code to semantic patches. True. I'm more than happy to not have to add this crap. > The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop > the -dirty at the coccilib level, if that seems desirable. This is when spatch --cocci_version is passed ? Its still unclear how we can require in a clean way coccinelle version requirements in SmPL patches with this. Can you clarify? If we embrace this or assume we'll get this in the next release we'll have to just bump the kernel's coccinelle requirement recommendation, which I think is far due anyway. Luis
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-06-15 18:20 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKlHP-4PC-3@gated-at.bofh.it> |
| In reply to | #1423187 |
On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > On Wed, Jun 15, 2016 at 05:55:34PM +0200, Julia Lawall wrote: > > > > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > > > On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > > > > How about the following, since Coccinelle knows what its version is? > > > > This could of course be implemented in python as well. > > > > > > > > julia > > > > > > > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > > > > index 0e4fbb8..ca5b061 100644 > > > > --- a/docs/Coccilib.3cocci > > > > +++ b/docs/Coccilib.3cocci > > > > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > > > > in an initialize or finalize rule). > > > > .sp > > > > > > > > +.I val cocci_version > > > > +: > > > > +.B unit -> string > > > > +.sp > > > > +Returns the a string indicating the current version. Note that if > > > > +Coccinelle has been modified since a release, the version number will be > > > > +postfixed with "-dirty". > > > > +.sp > > > > + > > > > .I val print_main > > > > : > > > > .B ?color:string -> string -> pos list -> unit > > > > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > > > > index f60c6b2..2f352d8 100644 > > > > --- a/ocaml/coccilib.ml > > > > +++ b/ocaml/coccilib.ml > > > > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > > > > > > > let files () = !Flag.currentfiles > > > > > > > > +let cocci_version () = Config.version > > > > + > > > > (* ---------------------------------------------------------------------- *) > > > > (* org mode *) > > > > > > > > > > > > > > Anything to *only* get the version instead of a long list is nice, right now > > > spatch --version spits out: > > > > > > spatch version 1.0.5 compiled with OCaml version 4.02.3 > > > Flags passed to the configure script: [none] > > > Python scripting support: yes > > > Syntax of regular expresssions: PCRE > > > > > > The Python library just parses the 3rd item at the top so it can extract > > > the version. But surely if spatch --version-only was available we'd use > > > that instead a well. > > > > > > Other than this though how can we require coccinelle version checks per > > > SmPL file cleanly and also what should we do to make it backward compatible > > > with older versions of coccinelle? > > > > I'm not sure that being backward compatible with older versions of > > Coccinelle is worth adding new libraries to the Linux kernel, and adding > > unpleasant python code to semantic patches. > > True. I'm more than happy to not have to add this crap. > > > The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop > > the -dirty at the coccilib level, if that seems desirable. > > This is when spatch --cocci_version is passed ? Perhaps it wasn't clear enough from the above nroff and ocaml code. I added a function Coccilib.version() that returns eg either 1.0.5 or 1.0.5-dirty. Such a function could be implemented for python as well. > > Its still unclear how we can require in a clean way coccinelle version > requirements in SmPL patches with this. Can you clarify? Test the string that it returns and exit. Like you are doing, but no need for adding new libraries to the kernel. > If we embrace this or assume we'll get this in the next release we'll have > to just bump the kernel's coccinelle requirement recommendation, which I think > is far due anyway. Yes. julia
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2016-06-15 18:50 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKmaS-4Zj-31@gated-at.bofh.it> |
| In reply to | #1423197 |
On Wed, Jun 15, 2016 at 06:11:57PM +0200, Julia Lawall wrote: > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > On Wed, Jun 15, 2016 at 05:55:34PM +0200, Julia Lawall wrote: > > > > > > > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > > > > > On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > > > > > How about the following, since Coccinelle knows what its version is? > > > > > This could of course be implemented in python as well. > > > > > > > > > > julia > > > > > > > > > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > > > > > index 0e4fbb8..ca5b061 100644 > > > > > --- a/docs/Coccilib.3cocci > > > > > +++ b/docs/Coccilib.3cocci > > > > > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > > > > > in an initialize or finalize rule). > > > > > .sp > > > > > > > > > > +.I val cocci_version > > > > > +: > > > > > +.B unit -> string > > > > > +.sp > > > > > +Returns the a string indicating the current version. Note that if > > > > > +Coccinelle has been modified since a release, the version number will be > > > > > +postfixed with "-dirty". > > > > > +.sp > > > > > + > > > > > .I val print_main > > > > > : > > > > > .B ?color:string -> string -> pos list -> unit > > > > > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > > > > > index f60c6b2..2f352d8 100644 > > > > > --- a/ocaml/coccilib.ml > > > > > +++ b/ocaml/coccilib.ml > > > > > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > > > > > > > > > let files () = !Flag.currentfiles > > > > > > > > > > +let cocci_version () = Config.version > > > > > + > > > > > (* ---------------------------------------------------------------------- *) > > > > > (* org mode *) > > > > > > > > > > > > > > > > > > Anything to *only* get the version instead of a long list is nice, right now > > > > spatch --version spits out: > > > > > > > > spatch version 1.0.5 compiled with OCaml version 4.02.3 > > > > Flags passed to the configure script: [none] > > > > Python scripting support: yes > > > > Syntax of regular expresssions: PCRE > > > > > > > > The Python library just parses the 3rd item at the top so it can extract > > > > the version. But surely if spatch --version-only was available we'd use > > > > that instead a well. > > > > > > > > Other than this though how can we require coccinelle version checks per > > > > SmPL file cleanly and also what should we do to make it backward compatible > > > > with older versions of coccinelle? > > > > > > I'm not sure that being backward compatible with older versions of > > > Coccinelle is worth adding new libraries to the Linux kernel, and adding > > > unpleasant python code to semantic patches. > > > > True. I'm more than happy to not have to add this crap. > > > > > The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop > > > the -dirty at the coccilib level, if that seems desirable. > > > > This is when spatch --cocci_version is passed ? > > Perhaps it wasn't clear enough from the above nroff and ocaml code. I > added a function Coccilib.version() that returns eg either 1.0.5 or > 1.0.5-dirty. Such a function could be implemented for python as well. > > > > > Its still unclear how we can require in a clean way coccinelle version > > requirements in SmPL patches with this. Can you clarify? > > Test the string that it returns and exit. Like you are doing, but no need > for adding new libraries to the kernel. Ah then that's indeed welcome, however another function would be best too: Coccilib.version_reqs() which lets us say what the requirement is and it would return true or false, false when the req is not met. > > If we embrace this or assume we'll get this in the next release we'll have > > to just bump the kernel's coccinelle requirement recommendation, which I think > > is far due anyway. > > Yes. Great. Then I'm all for dropping this python jüjü crap. Luis
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-06-15 19:00 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKmkx-52w-21@gated-at.bofh.it> |
| In reply to | #1423224 |
On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > On Wed, Jun 15, 2016 at 06:11:57PM +0200, Julia Lawall wrote: > > > > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > > > On Wed, Jun 15, 2016 at 05:55:34PM +0200, Julia Lawall wrote: > > > > > > > > > > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > > > > > > > On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > > > > > > How about the following, since Coccinelle knows what its version is? > > > > > > This could of course be implemented in python as well. > > > > > > > > > > > > julia > > > > > > > > > > > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > > > > > > index 0e4fbb8..ca5b061 100644 > > > > > > --- a/docs/Coccilib.3cocci > > > > > > +++ b/docs/Coccilib.3cocci > > > > > > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > > > > > > in an initialize or finalize rule). > > > > > > .sp > > > > > > > > > > > > +.I val cocci_version > > > > > > +: > > > > > > +.B unit -> string > > > > > > +.sp > > > > > > +Returns the a string indicating the current version. Note that if > > > > > > +Coccinelle has been modified since a release, the version number will be > > > > > > +postfixed with "-dirty". > > > > > > +.sp > > > > > > + > > > > > > .I val print_main > > > > > > : > > > > > > .B ?color:string -> string -> pos list -> unit > > > > > > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > > > > > > index f60c6b2..2f352d8 100644 > > > > > > --- a/ocaml/coccilib.ml > > > > > > +++ b/ocaml/coccilib.ml > > > > > > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > > > > > > > > > > > let files () = !Flag.currentfiles > > > > > > > > > > > > +let cocci_version () = Config.version > > > > > > + > > > > > > (* ---------------------------------------------------------------------- *) > > > > > > (* org mode *) > > > > > > > > > > > > > > > > > > > > > > Anything to *only* get the version instead of a long list is nice, right now > > > > > spatch --version spits out: > > > > > > > > > > spatch version 1.0.5 compiled with OCaml version 4.02.3 > > > > > Flags passed to the configure script: [none] > > > > > Python scripting support: yes > > > > > Syntax of regular expresssions: PCRE > > > > > > > > > > The Python library just parses the 3rd item at the top so it can extract > > > > > the version. But surely if spatch --version-only was available we'd use > > > > > that instead a well. > > > > > > > > > > Other than this though how can we require coccinelle version checks per > > > > > SmPL file cleanly and also what should we do to make it backward compatible > > > > > with older versions of coccinelle? > > > > > > > > I'm not sure that being backward compatible with older versions of > > > > Coccinelle is worth adding new libraries to the Linux kernel, and adding > > > > unpleasant python code to semantic patches. > > > > > > True. I'm more than happy to not have to add this crap. > > > > > > > The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop > > > > the -dirty at the coccilib level, if that seems desirable. > > > > > > This is when spatch --cocci_version is passed ? > > > > Perhaps it wasn't clear enough from the above nroff and ocaml code. I > > added a function Coccilib.version() that returns eg either 1.0.5 or > > 1.0.5-dirty. Such a function could be implemented for python as well. > > > > > > > > Its still unclear how we can require in a clean way coccinelle version > > > requirements in SmPL patches with this. Can you clarify? > > > > Test the string that it returns and exit. Like you are doing, but no need > > for adding new libraries to the kernel. > > Ah then that's indeed welcome, however another function would be best too: > > Coccilib.version_reqs() which lets us say what the requirement is and it > would return true or false, false when the req is not met. I'm not so fond of this. It seems like a very specific use case. I really think this should be managed by coccicheck, in the same way as the options. julia
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2016-06-15 21:10 +0200 |
| Subject | Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKomm-6vo-11@gated-at.bofh.it> |
| In reply to | #1423239 |
On Wed, Jun 15, 2016 at 06:52:27PM +0200, Julia Lawall wrote: > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > On Wed, Jun 15, 2016 at 06:11:57PM +0200, Julia Lawall wrote: > > > > > > > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > > > > > On Wed, Jun 15, 2016 at 05:55:34PM +0200, Julia Lawall wrote: > > > > > > > > > > > > > > > On Wed, 15 Jun 2016, Luis R. Rodriguez wrote: > > > > > > > > > > > On Wed, Jun 15, 2016 at 10:43:30AM +0200, Julia Lawall wrote: > > > > > > > How about the following, since Coccinelle knows what its version is? > > > > > > > This could of course be implemented in python as well. > > > > > > > > > > > > > > julia > > > > > > > > > > > > > > diff --git a/docs/Coccilib.3cocci b/docs/Coccilib.3cocci > > > > > > > index 0e4fbb8..ca5b061 100644 > > > > > > > --- a/docs/Coccilib.3cocci > > > > > > > +++ b/docs/Coccilib.3cocci > > > > > > > @@ -232,6 +232,15 @@ is the empty list if spatch is not currently working on any file (eg, > > > > > > > in an initialize or finalize rule). > > > > > > > .sp > > > > > > > > > > > > > > +.I val cocci_version > > > > > > > +: > > > > > > > +.B unit -> string > > > > > > > +.sp > > > > > > > +Returns the a string indicating the current version. Note that if > > > > > > > +Coccinelle has been modified since a release, the version number will be > > > > > > > +postfixed with "-dirty". > > > > > > > +.sp > > > > > > > + > > > > > > > .I val print_main > > > > > > > : > > > > > > > .B ?color:string -> string -> pos list -> unit > > > > > > > diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml > > > > > > > index f60c6b2..2f352d8 100644 > > > > > > > --- a/ocaml/coccilib.ml > > > > > > > +++ b/ocaml/coccilib.ml > > > > > > > @@ -168,6 +168,8 @@ let dir () = !Flag.dir > > > > > > > > > > > > > > let files () = !Flag.currentfiles > > > > > > > > > > > > > > +let cocci_version () = Config.version > > > > > > > + > > > > > > > (* ---------------------------------------------------------------------- *) > > > > > > > (* org mode *) > > > > > > > > > > > > > > > > > > > > > > > > > > Anything to *only* get the version instead of a long list is nice, right now > > > > > > spatch --version spits out: > > > > > > > > > > > > spatch version 1.0.5 compiled with OCaml version 4.02.3 > > > > > > Flags passed to the configure script: [none] > > > > > > Python scripting support: yes > > > > > > Syntax of regular expresssions: PCRE > > > > > > > > > > > > The Python library just parses the 3rd item at the top so it can extract > > > > > > the version. But surely if spatch --version-only was available we'd use > > > > > > that instead a well. > > > > > > > > > > > > Other than this though how can we require coccinelle version checks per > > > > > > SmPL file cleanly and also what should we do to make it backward compatible > > > > > > with older versions of coccinelle? > > > > > > > > > > I'm not sure that being backward compatible with older versions of > > > > > Coccinelle is worth adding new libraries to the Linux kernel, and adding > > > > > unpleasant python code to semantic patches. > > > > > > > > True. I'm more than happy to not have to add this crap. > > > > > > > > > The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop > > > > > the -dirty at the coccilib level, if that seems desirable. > > > > > > > > This is when spatch --cocci_version is passed ? > > > > > > Perhaps it wasn't clear enough from the above nroff and ocaml code. I > > > added a function Coccilib.version() that returns eg either 1.0.5 or > > > 1.0.5-dirty. Such a function could be implemented for python as well. > > > > > > > > > > > Its still unclear how we can require in a clean way coccinelle version > > > > requirements in SmPL patches with this. Can you clarify? > > > > > > Test the string that it returns and exit. Like you are doing, but no need > > > for adding new libraries to the kernel. > > > > Ah then that's indeed welcome, however another function would be best too: > > > > Coccilib.version_reqs() which lets us say what the requirement is and it > > would return true or false, false when the req is not met. > > I'm not so fond of this. It seems like a very specific use case. Perhaps. > I really think this should be managed by coccicheck, in the same way as > the options. OK if its up to coccicheck -- we'll need a solution there. I'd prefer to use a generic library like reqs there and just have the check for the maximum requirement there. Michal do you have any preference ? FWIW I had originally written the reqs library for for rel-html [0] which enables arbitrary projects to make a shiny HTLM5 release project based on a naked release page provided, the inferring of release needs some generic heuristics on release matching (in the future the simpler approach is to have a git tree have two PGP signatures, one for signed releases, and another for deprecating release, then an alternative smarter heuristic would be to only look for signed tags of currently supported releases), the Linux kernel's strategy on versioning computation seemed the way to go. I was surprised no standard library supported it properly. This library is also used on backports not only for coccinell requirements but for other generic binary requirements. We can bash it out.. however this seems like it could be generally useful for other tools we have in the kernel. [0] https://git.kernel.org/cgit/linux/kernel/git/mcgrof/rel-html.git/ Luis
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-06-15 18:10 +0200 |
| Subject | Re: scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci |
| Message-ID | <rKlya-4Mc-23@gated-at.bofh.it> |
| In reply to | #1423183 |
> The above ocaml code just produces eg 1.0.5 or 1.0.5-dirty. I could drop > the -dirty at the coccilib level, if that seems desirable. Are there risks that any more fine-grained checks will be needed for special functionality? Regards, Markus
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web