From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 23 14:49:58 2019 Received: (at submit) by debbugs.gnu.org; 23 Mar 2019 18:49:59 +0000 Received: from localhost ([127.0.0.1]:55781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7liQ-00037m-F3 for submit@debbugs.gnu.org; Sat, 23 Mar 2019 14:49:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7liN-00037X-Tr for submit@debbugs.gnu.org; Sat, 23 Mar 2019 14:49:56 -0400 Received: from lists.gnu.org ([209.51.188.17]:45721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7liI-0007RK-HD for submit@debbugs.gnu.org; Sat, 23 Mar 2019 14:49:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7liG-0008UV-TO for guix-patches@gnu.org; Sat, 23 Mar 2019 14:49:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7liF-0007LV-Cm for guix-patches@gnu.org; Sat, 23 Mar 2019 14:49:48 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:42752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7liE-0007Cm-O0 for guix-patches@gnu.org; Sat, 23 Mar 2019 14:49:47 -0400 Received: from localhost (89-92-10-229.hfc.dyn.abo.bbox.fr [89.92.10.229]) by lepiller.eu (OpenSMTPD) with ESMTPSA id cf35706e (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Sat, 23 Mar 2019 18:49:40 +0000 (UTC) Date: Sat, 23 Mar 2019 19:49:34 +0100 From: Julien Lepiller To: guix-patches@gnu.org Subject: Add a package argument to dune-build-system Message-ID: <20190323194934.07e3d48e@lepiller.eu> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/sBeR1mhbbxRyWqiw7peFddf" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:5884:8208::1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --MP_/sBeR1mhbbxRyWqiw7peFddf Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, these two patches add a new #:package argument to the dune-build-system. This is required to build a package that comes with more than one build file, such as packages in a repo with multiple packages. This is the case for ocaml-alcotest that is updated in the second patch. It used the ocaml-build-system, but the build system was changed upstream to dune, so the first patch is needed to build alcotest. I'd like some feedback especially on the first patch :) Thank you! --MP_/sBeR1mhbbxRyWqiw7peFddf Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-dune-build-system-Add-a-package-parameter.patch From 619eb1219ac34d4974da4a3794df0e5a6098e48f Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 23 Mar 2019 19:18:31 +0100 Subject: [PATCH 1/2] guix: dune-build-system: Add a package parameter. * guix/build-system/dune.scm: Add a package parameter. * guix/build/dune.scm (build, test, install): Use it. * doc/guix.texi: Document it. --- doc/guix.texi | 5 +++++ guix/build-system/dune.scm | 2 ++ guix/build/dune-build-system.scm | 17 ++++++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 8fa714ee54..be3ee1364e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5816,6 +5816,11 @@ list of flags passed to the @code{dune} command during the build. The @code{#:jbuild?} parameter can be passed to use the @code{jbuild} command instead of the more recent @code{dune} command while building a package. Its default value is @code{#f}. + +The @code{#:package} parameter can be passed to specify a packagename, which +is usefull when a package contains multiple packages and you want to build +only one of them. This is equivalent to passing the @code{-p} argument to +@code{dune}. @end defvr @defvr {Scheme Variable} go-build-system diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm index 8bd41c89f0..6a2f3d16de 100644 --- a/guix/build-system/dune.scm +++ b/guix/build-system/dune.scm @@ -87,6 +87,7 @@ (build-flags ''()) (out-of-source? #t) (jbuild? #f) + (package #f) (tests? #t) (test-flags ''()) (test-target "test") @@ -125,6 +126,7 @@ provides a 'setup.ml' file as its build system." #:build-flags ,build-flags #:out-of-source? ,out-of-source? #:jbuild? ,jbuild? + #:package ,package #:tests? ,tests? #:test-target ,test-target #:install-target ,install-target diff --git a/guix/build/dune-build-system.scm b/guix/build/dune-build-system.scm index 00b0c7c406..7e2ec1e3e1 100644 --- a/guix/build/dune-build-system.scm +++ b/guix/build/dune-build-system.scm @@ -31,27 +31,30 @@ ;; Code: (define* (build #:key (build-flags '()) (jbuild? #f) - (use-make? #f) #:allow-other-keys) + (use-make? #f) (package #f) #:allow-other-keys) "Build the given package." (let ((program (if jbuild? "jbuilder" "dune"))) - (apply invoke program "build" "@install" build-flags)) + (apply invoke program "build" "@install" + (append (if package (list "-p" package) '()) build-flags))) #t) (define* (check #:key (test-flags '()) (test-target "test") tests? - (jbuild? #f) #:allow-other-keys) + (jbuild? #f) (package #f) #:allow-other-keys) "Test the given package." (when tests? (let ((program (if jbuild? "jbuilder" "dune"))) - (apply invoke program "runtest" test-target test-flags))) + (apply invoke program "runtest" test-target + (append (if package (list "-p" package) '()) test-flags)))) #t) (define* (install #:key outputs (install-target "install") (jbuild? #f) - #:allow-other-keys) + (package #f) #:allow-other-keys) "Install the given package." (let ((out (assoc-ref outputs "out")) (program (if jbuild? "jbuilder" "dune"))) - (invoke program install-target "--prefix" out "--libdir" - (string-append out "/lib/ocaml/site-lib"))) + (apply invoke program install-target "--prefix" out "--libdir" + (string-append out "/lib/ocaml/site-lib") + (if package (list package) '()))) #t) (define %standard-phases -- 2.21.0 --MP_/sBeR1mhbbxRyWqiw7peFddf Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-gnu-ocaml-alcotest-Update-to-0.8.5.patch From 6ac1b059ef2c46ea6ac80070e6a49f79bdddbdc4 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 23 Mar 2019 19:22:37 +0100 Subject: [PATCH 2/2] gnu: ocaml-alcotest: Update to 0.8.5. * gnu/packages/ocaml.scm (ocaml-alcotest): Update to 0.8.5. --- gnu/packages/ocaml.scm | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index 801611beb1..a6889c642e 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -1724,28 +1724,26 @@ immutability.") (define-public ocaml-alcotest (package (name "ocaml-alcotest") - (version "0.7.2") + (version "0.8.5") (source (origin (method url-fetch) (uri (string-append "https://github.com/mirage/alcotest/releases/" "download/" version "/alcotest-" version ".tbz")) (sha256 (base32 - "0g5lzk0gpfx4q8hyhr460gr4lab5wakfxsmhfwvb3yinxwzs95gc")))) - (build-system ocaml-build-system) + "0szwjxvaahgynsx0apj81jxj3ki6yz4is9mh2wkcbx66qy7n6fvb")))) + (build-system dune-build-system) (arguments - `(#:tests? #f - #:build-flags (list "build") - #:phases - (modify-phases %standard-phases - (delete 'configure)))) + `(#:package "alcotest" + #:test-target ".")) (native-inputs - `(("ocamlbuild" ,ocamlbuild) - ("opam" ,opam) - ("topkg" ,ocaml-topkg))) + `(("ocamlbuild" ,ocamlbuild))) (propagated-inputs - `(("fmt" ,ocaml-fmt) - ("astring" ,ocaml-astring))) + `(("ocaml-astring" ,ocaml-astring) + ("ocaml-cmdliner" ,ocaml-cmdliner) + ("ocaml-fmt" ,ocaml-fmt) + ("ocaml-result" ,ocaml-result) + ("ocaml-uuidm" ,ocaml-uuidm))) (home-page "https://github.com/mirage/alcotest") (synopsis "Lightweight OCaml test framework") (description "Alcotest exposes simple interface to perform unit tests. It -- 2.21.0 --MP_/sBeR1mhbbxRyWqiw7peFddf--