[PATCH 0/4] gnu: Add coccinelle.

  • Done
  • quality assurance status badge
Details
3 participants
  • Jean-Pierre De Jesus DIAZ
  • Ludovic Courtès
  • Simon Tournier
Owner
unassigned
Submitted by
Jean-Pierre De Jesus DIAZ
Severity
normal
J
J
Jean-Pierre De Jesus DIAZ wrote on 20 May 2023 14:48
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230520124838.35588-1-jean@foundationdevices.com
Package definition for coccinelle semantic patch tool.

* ocaml-pyml is using a git commit as there's no recent version released yet
that wokrs with Python ^3.10.

* I thought of disabling the ocaml-parmap tests as these take a while
and possibly could take a bit of CPU time on CI, so in reality it's not
that long. Could send a revised patch to disable it though, however,
feel free to disable the tests if necessary.

Jean-Pierre De Jesus DIAZ (4):
gnu: Add ocaml-parmap.
gnu: Add ocaml-stdcompat.
gnu: Add ocaml-pyml.
gnu: Add coccinelle.

gnu/packages/ocaml.scm | 117 ++++++++++++++++++++++++++++++++++++
gnu/packages/patchutils.scm | 56 +++++++++++++++++
2 files changed, 173 insertions(+)


base-commit: 5b700945fb0b33eec410de8979cae2fbf0d4f118
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 21 May 2023 13:34
[PATCH 1/4] gnu: Add ocaml-parmap.
(address . 63609@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230521113417.76939-1-jean@foundationdevices.com
* gnu/packages/ocaml.scm (ocaml-parmap): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/ocaml.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

Toggle diff (57 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index f0b8f9e912..08036ba401 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -28,6 +28,7 @@
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org>
;;; Copyright © 2023 Csepp <raingloom@riseup.net>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -2698,6 +2699,42 @@ (define-public ocaml-ppx-tools
syntactic tools.")
(license license:expat)))
+(define-public ocaml-parmap
+ (package
+ (name "ocaml-parmap")
+ (version "1.2.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rdicosmo/parmap")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0x5gnfap9f7kmgh8j725vxlbkvlplwzbpn8jdx2ywfa3dd6bn6xl"))))
+ (build-system dune-build-system)
+ (propagated-inputs
+ (list ocaml-odoc))
+ (home-page "https://github.com/rdicosmo/parmap")
+ (synopsis "Parallel map and fold primtives for OCaml")
+ (description
+ "Library to perform parallel fold or map taking advantage of multiple
+core architectures for OCaml programs. Drop-in replacement for these
+@code{List} operations are provided:
+
+@itemize
+@item @code{List.map} -> @code{parmap}
+@item @code{List.map} -> @code{parfold}
+@item @code{List.mapfold} -> @code{parmapfold}
+@end itemize
+
+Also it allows specifying the number of cores to use with the optional
+parameter @code{ncores}.")
+ (license (list license:lgpl2.0
+ (license:fsdg-compatible "file://LICENSE"
+ "See LICENSE file for details")))))
+
(define-public ocaml-react
(package
(name "ocaml-react")
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 21 May 2023 13:34
[PATCH 2/4] gnu: Add ocaml-stdcompat.
(address . 63609@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230521113417.76939-2-jean@foundationdevices.com
* gnu/packages/ocaml.scm (ocaml-stdcompat): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/ocaml.scm | 46 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

Toggle diff (59 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 08036ba401..0656abb610 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -4606,6 +4606,52 @@ (define-public ocaml-expect
or a timeout.")
(license license:lgpl2.1+))) ; with the OCaml static compilation exception
+(define-public ocaml-stdcompat
+ (package
+ (name "ocaml-stdcompat")
+ (version "19")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/thierry-martinez/stdcompat")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (modules '((guix build utils)))
+ (snippet
+ #~(for-each delete-file '("Makefile.in" "configure")))
+ (sha256
+ (base32
+ "0r9qcfjkn8634lzxp5bkagzwsi3vmg0hb6vq4g1p1515rys00h1b"))))
+ (build-system dune-build-system)
+ (arguments
+ (list #:imported-modules `((guix build gnu-build-system)
+ ,@%dune-build-system-modules)
+ #:modules '((guix build dune-build-system)
+ ((guix build gnu-build-system) #:prefix gnu:)
+ (guix build utils))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'bootstrap
+ (assoc-ref gnu:%standard-phases 'bootstrap))
+ (add-before 'build 'prepare-build
+ (lambda _
+ (let ((bash (which "bash")))
+ (setenv "CONFIG_SHELL" bash)
+ (setenv "SHELL" bash)))))))
+ (native-inputs
+ (list autoconf
+ automake
+ ocaml
+ ocaml-findlib))
+ (home-page "https://github.com/thierry-martinez/stdcompat")
+ (synopsis "Compatibility module for OCaml standard library")
+ (description
+ "Compatibility module for OCaml standard library allowing programs to use
+some recent additions to the standard library while preserving the ability to
+be compiled on former versions of OCaml.")
+ (license license:bsd-2)))
+
(define-public ocaml-stdlib-shims
(package
(name "ocaml-stdlib-shims")
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 21 May 2023 13:34
[PATCH 3/4] gnu: Add ocaml-pyml.
(address . 63609@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230521113417.76939-3-jean@foundationdevices.com
* gnu/packages/ocaml.ml (ocaml-pyml): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/ocaml.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (47 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 0656abb610..ab0aa0574a 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -2735,6 +2735,40 @@ (define-public ocaml-parmap
(license:fsdg-compatible "file://LICENSE"
"See LICENSE file for details")))))
+(define-public ocaml-pyml
+ ;; NOTE: Using commit from master branch as 20220905 does not support
+ ;; Python 3.10.
+ (let ((revision "0")
+ (commit "e33f4c49cc97e7bc6f8e5faaa64cce994470642e"))
+ (package
+ (name "ocaml-pyml")
+ (version (git-version "20220905" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/thierry-martinez/pyml")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1v421i5cvj8mbgrg5cs78bz1yzdprm9r5r41niiy20d3j7j8jx9k"))))
+ (build-system dune-build-system)
+ (propagated-inputs
+ (list ocaml-stdcompat
+ python
+ python-numpy))
+ (home-page "https://github.com/thierry-martinez/pyml")
+ (synopsis "Python bindings for OCaml")
+ (description "Library that allows OCaml programs to interact with Python
+modules and objects. The library also provides low-level bindings to the
+Python C API.
+
+This library is an alternative to @code{pycaml} which is no longer
+maintained. The @code{Pycaml} module provides a signature close to
+@code{pycaml}, to ease migration of code to this library.")
+ (license license:bsd-2))))
+
(define-public ocaml-react
(package
(name "ocaml-react")
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 21 May 2023 13:34
[PATCH 4/4] gnu: Add coccinelle.
(address . 63609@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230521113417.76939-4-jean@foundationdevices.com
* gnu/packages/patchutils.scm (coccinelle): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/patchutils.scm | 56 +++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

Toggle diff (92 lines)
diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm
index 1527590af5..2b30ee1b9d 100644
--- a/gnu/packages/patchutils.scm
+++ b/gnu/packages/patchutils.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;; Copyright © 2023 Andy Tai <atai@atai.org>
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -33,8 +34,10 @@ (define-module (gnu packages patchutils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system glib-or-gtk)
#:use-module (guix build-system meson)
+ #:use-module (guix build-system ocaml)
#:use-module (guix build-system python)
#:use-module (gnu packages)
+ #:use-module (gnu packages autotools)
#:use-module (gnu packages ed)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
@@ -53,6 +56,7 @@ (define-module (gnu packages patchutils)
#:use-module (gnu packages less)
#:use-module (gnu packages mail)
#:use-module (gnu packages ncurses)
+ #:use-module (gnu packages ocaml)
#:use-module (gnu packages package-management)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
@@ -62,6 +66,58 @@ (define-module (gnu packages patchutils)
#:use-module (gnu packages version-control)
#:use-module (gnu packages xml))
+(define-public coccinelle
+ (let ((revision "0")
+ (commit "6608e45f85a10c57a3c910154cf049a5df4d98e4"))
+ (package
+ (name "coccinelle")
+ (version (git-version "1.1.1" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/coccinelle/coccinelle")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (modules '((guix build utils)))
+ (snippet
+ #~(delete-file-recursively "bundles"))
+ (sha256
+ (base32
+ "08nycmjyckqmqjpi78dcqdbmjq1xp18qdc6023dl90gdi6hmxz9l"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'bootstrap 'prepare-version.sh
+ (lambda _
+ (setenv "MAKE_COCCI_RELEASE" "y")
+ (patch-shebang "version.sh")))
+ (add-before 'check 'set-batch-mode
+ (lambda _
+ (substitute* "Makefile"
+ (("--testall")
+ "--batch_mode --testall")))))))
+ (propagated-inputs
+ (list ocaml-menhir
+ ocaml-num
+ ocaml-parmap
+ ocaml-pcre
+ ocaml-pyml
+ ocaml-stdcompat))
+ (native-inputs
+ (list autoconf
+ automake
+ ocaml
+ ocaml-findlib
+ pkg-config))
+ (home-page "https://coccinelle.lip6.fr")
+ (synopsis "Transformation of C code using semantic patches")
+ (description "Coccinelle is a tool that allows modification of C code
+using semantic patches in the @acronym{SmPL, Semantic Patch Language} for
+specifying desired matches and transformations in the C code.")
+ (license gpl2))))
+
(define-public patchutils
(package
(name "patchutils")
--
2.34.1
S
S
Simon Tournier wrote on 22 May 2023 19:00
Re: [bug#63609] [PATCH 1/4] gnu: Add ocaml-parmap.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
87a5xwxpvs.fsf@gmail.com
Hi,

Thanks for your patch.

On dim., 21 mai 2023 at 13:34, Jean-Pierre De Jesus DIAZ via Guix-patches via <guix-patches@gnu.org> wrote:

Toggle quote (2 lines)
> +;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>

Just to be sure, the copyright is hold by that company named Foundation
Devices, Inc. and not by one person. Right?


Cheers,
simon
J
J
Jean-Pierre De Jesus Diaz wrote on 23 May 2023 16:07
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
CAG1gdUq=E9Dghs8xRNbPh6AjhRwmHbr0eVSjrWV_A9pLMHBToQ@mail.gmail.com
Hi,

Yes Simon, that is correct. Sending again as I didn't reply to all.

Cheers,


On Mon, May 22, 2023 at 7:02?PM Simon Tournier <zimon.toutoune@gmail.com> wrote:
Toggle quote (18 lines)
>
> Hi,
>
> Thanks for your patch.
>
> On dim., 21 mai 2023 at 13:34, Jean-Pierre De Jesus DIAZ via Guix-patches via <guix-patches@gnu.org> wrote:
>
> > +;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
>
> Just to be sure, the copyright is hold by that company named Foundation
> Devices, Inc. and not by one person. Right?
>
>
> Cheers,
> simon



--
Jean-Pierre De Jesus DIAZ
Senior Software Engineer
Foundation Devices
L
L
Ludovic Courtès wrote on 2 Jun 2023 16:49
Re: bug#63609: [PATCH 0/4] gnu: Add coccinelle.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)(address . 63609-done@debbugs.gnu.org)
87mt1h537a.fsf@gnu.org
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> skribis:

Toggle quote (5 lines)
> gnu: Add ocaml-parmap.
> gnu: Add ocaml-stdcompat.
> gnu: Add ocaml-pyml.
> gnu: Add coccinelle.

Great work. Applied, thanks!

Ludo’.
Closed
?