From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753470AbcFOPzm (ORCPT ); Wed, 15 Jun 2016 11:55:42 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:2489 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbcFOPzk (ORCPT ); Wed, 15 Jun 2016 11:55:40 -0400 X-IronPort-AV: E=Sophos;i="5.26,476,1459807200"; d="scan'208";a="222577231" Date: Wed, 15 Jun 2016 17:55:34 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: "Luis R. Rodriguez" cc: Gilles Muller , nicolas.palix@imag.fr, mmarek@suse.com, linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr Subject: Re: [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci In-Reply-To: <20160615154918.GN11948@wotan.suse.de> Message-ID: References: <1465942217-14452-1-git-send-email-mcgrof@kernel.org> <1465942217-14452-5-git-send-email-mcgrof@kernel.org> <20160615154918.GN11948@wotan.suse.de> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: julia.lawall@lip6.fr (Julia Lawall) Date: Wed, 15 Jun 2016 17:55:34 +0200 (CEST) Subject: [Cocci] [PATCH 4/4] scripts/coccinelle: require coccinelle >= 1.0.4 on device_node_continue.cocci In-Reply-To: <20160615154918.GN11948@wotan.suse.de> References: <1465942217-14452-1-git-send-email-mcgrof@kernel.org> <1465942217-14452-5-git-send-email-mcgrof@kernel.org> <20160615154918.GN11948@wotan.suse.de> Message-ID: To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr 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