unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
@ 2021-08-04  8:04 pukkamustard
  2021-08-04  8:08 ` [bug#49868] [PATCH 1/2] " pukkamustard
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: pukkamustard @ 2021-08-04  8:04 UTC (permalink / raw)
  To: 49868; +Cc: pukkamustard

Hi,

This adds a profile parameter to the dune-build-system and sets it to "release" by default.

The exact effects of the "release" profile are not clearly documented in dune [1]. But it seems to be the default when installing packages with OPAM [2]. I think it should also be the default in Guix.

Some OCaml packages had set the profile to "release" manually by specifiying it in the build flags. This has been removed.

This patch will probably require a rebuild of almost all OCaml packages.

A second patch is attached that removes unnecessary arguments from the ocaml4.07-base packages. This is a more intrusive change to the package, so I've kept it in a separate commit.

-pukkamustard

[1] https://github.com/ocaml/dune/issues/3359
[2] https://dune.readthedocs.io/en/stable/faq.html#how-to-make-warnings-non-fatal

pukkamustard (2):
  guix: dune-build-system: Add a profile parameter.
  gnu: ocaml4.07-base: Remove unnecessary arguments.

 doc/guix.texi                    |  7 +++++++
 gnu/packages/ocaml.scm           | 27 ++++++---------------------
 guix/build-system/dune.scm       |  3 +++
 guix/build/dune-build-system.scm |  8 ++++++--
 4 files changed, 22 insertions(+), 23 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 1/2] guix: dune-build-system: Add a profile parameter.
  2021-08-04  8:04 [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter pukkamustard
@ 2021-08-04  8:08 ` pukkamustard
  2021-08-04  8:08   ` [bug#49868] [PATCH 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments pukkamustard
  2021-08-09  2:17 ` [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-08-04  8:08 UTC (permalink / raw)
  To: 49868; +Cc: pukkamustard

* guix/build-system/dune.scm: Add a profile parameter.
* guix/build/dune-build-system.scm (build): Use it.
* doc/guix.texi: Document it.
* gnu/packages/ocaml.scm: Remove profile being set from build flags.
---
 doc/guix.texi                    |  7 +++++++
 gnu/packages/ocaml.scm           | 17 ++++++-----------
 guix/build-system/dune.scm       |  3 +++
 guix/build/dune-build-system.scm |  8 ++++++--
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9a9c85678c..2ba2edeb72 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -94,6 +94,7 @@ Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
 Copyright @copyright{} 2021 Domagoj Stolfa@*
 Copyright @copyright{} 2021 Hui Lu@*
+Copyright @copyright{} 2021 pukkamustard@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -7731,6 +7732,12 @@ The @code{#:package} parameter can be passed to specify a package name, which
 is useful 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}.
+
+The @code{#:profile} parameter can be passed to specify the
+@uref{https://dune.readthedocs.io/en/stable/dune-files.html#profil, dune
+build profile}. This is equivalent to passing the @code{--profile}
+argument to @code{dune}. Its default value is @code{"release"}.
+
 @end defvr
 
 @defvr {Scheme Variable} go-build-system
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index bf9242410d..547b905317 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -2854,8 +2854,7 @@ without a complete in-memory representation of the data.")
           "1dvcl108ir9nqkk4mjm9xhhj4p9dx9bmg8bnms54fizs1x3x8ar3"))))
     (build-system dune-build-system)
     (arguments
-     `(#:test-target "tests"
-       #:build-flags (list "--profile=release")))
+     `(#:test-target "tests"))
     (propagated-inputs
      `(("ocaml-cmdliner" ,ocaml-cmdliner)))
     (home-page "https://www.typerex.org/ocp-indent.html")
@@ -3273,8 +3272,7 @@ build system and allows external tools to analyse your project easily.")
                   "1smcc0l6fh2n0y6bp96c69j5nw755jja99w0b206wx3yb2m4w2hs"))))
     (build-system dune-build-system)
     (arguments
-     `(#:tests? #f
-       #:build-flags (list "--profile" "release")))
+     `(#:tests? #f))
     (native-inputs
      `(("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/mjambon/cppo")
@@ -3342,8 +3340,7 @@ standard iterator type starting from 4.07.")
         (base32 "07ycb103mr4mrkxfd63cwlsn023xvcjp0ra0k7n2gwrg0mwxmfss"))))
     (build-system dune-build-system)
     (arguments
-     `(#:tests? #f
-       #:build-flags (list "--profile" "release")))
+     `(#:tests? #f))
     (propagated-inputs
      `(("ocaml-seq" ,ocaml-seq)))
     (native-inputs
@@ -3820,9 +3817,8 @@ the plugins facilitate extensibility, and the frontends serve as entry points.")
                 "0chn7ldqb3wyf95yhmsxxq65cif56smgz1mhhc7m0dpwmyq1k97h"))))
     (build-system dune-build-system)
     (arguments
-     `(#:build-flags (list "--profile" "release")
-       #:test-target "camomile-test"
-       #:tests? #f; Tests fail, see https://github.com/yoriyuki/Camomile/issues/82
+     `(#:test-target "camomile-test"
+       #:tests? #f ; Tests fail, see https://github.com/yoriyuki/Camomile/issues/82
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'fix-usr-share
@@ -3913,8 +3909,7 @@ connect an engine to your inputs and rendering functions to get an editor.")
         (base32 "0zcjy6fvf0d3i2ssz96asl889n3r6bplyzk7xvb2s3dkxbgcisyy"))))
     (build-system dune-build-system)
     (arguments
-     `(#:build-flags (list "--profile" "release")
-       #:tests? #f
+     `(#:tests? #f
        #:ocaml ,ocaml-4.07
        #:findlib ,ocaml4.07-findlib
        #:dune ,ocaml4.07-dune))
diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index 6a2f3d16de..1a64cf9b75 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2021 pukkamustard <pukkamustard@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,6 +89,7 @@
                      (out-of-source? #t)
                      (jbuild? #f)
                      (package #f)
+                     (profile "release")
                      (tests? #t)
                      (test-flags ''())
                      (test-target "test")
@@ -127,6 +129,7 @@ provides a 'setup.ml' file as its build system."
                    #:out-of-source? ,out-of-source?
                    #:jbuild? ,jbuild?
                    #:package ,package
+                   #:profile ,profile
                    #: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 7e2ec1e3e1..6a0c2593ac 100644
--- a/guix/build/dune-build-system.scm
+++ b/guix/build/dune-build-system.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2019 Gabriel Hondet <gabrielhondet@gmail.com>
+;;; Copyright © 2021 pukkamustard <pukkamustard@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,11 +32,14 @@
 ;; Code:
 
 (define* (build #:key (build-flags '()) (jbuild? #f)
-                (use-make? #f) (package #f) #:allow-other-keys)
+                (use-make? #f) (package #f)
+                (profile "release") #:allow-other-keys)
   "Build the given package."
   (let ((program (if jbuild? "jbuilder" "dune")))
     (apply invoke program "build" "@install"
-           (append (if package (list "-p" package) '()) build-flags)))
+           (append (if package (list "-p" package) '())
+                   `("--profile" ,profile)
+                   build-flags)))
   #t)
 
 (define* (check #:key (test-flags '()) (test-target "test") tests?
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments.
  2021-08-04  8:08 ` [bug#49868] [PATCH 1/2] " pukkamustard
@ 2021-08-04  8:08   ` pukkamustard
  0 siblings, 0 replies; 19+ messages in thread
From: pukkamustard @ 2021-08-04  8:08 UTC (permalink / raw)
  To: 49868; +Cc: pukkamustard

* gnu/packages/ocaml.scm (ocaml4.07-base): Remove unnecessary arguments.
---
 gnu/packages/ocaml.scm | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 547b905317..39ed60088e 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -4925,16 +4925,6 @@ provided by companion libraries such as
         (sha256
          (base32
           "0j6xb4265jr41vw4fjzak6yr8s30qrnzapnc6rl1dxy8bjai0nir"))))
-     (arguments
-      `(#:phases
-        (modify-phases %standard-phases
-          (replace 'build
-            ;; make warnings non fatal (jbuilder behaviour)
-            (lambda _
-              (invoke "dune" "build" "@install" "--profile=release"))))
-        #:ocaml ,ocaml-4.07
-        #:findlib ,ocaml4.07-findlib
-        #:dune ,ocaml4.07-dune))
      (properties '()))))
 
 (define-public ocaml-compiler-libs
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-04  8:04 [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter pukkamustard
  2021-08-04  8:08 ` [bug#49868] [PATCH 1/2] " pukkamustard
@ 2021-08-09  2:17 ` Julien Lepiller
  2021-08-09  7:17   ` pukkamustard
  2021-08-09  7:19 ` [bug#49868] [PATCH v2 1/2] " pukkamustard
  2021-08-20 22:09 ` bug#49868: [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
  3 siblings, 1 reply; 19+ messages in thread
From: Julien Lepiller @ 2021-08-09  2:17 UTC (permalink / raw)
  To: pukkamustard; +Cc: 49868

Thanks for the patches! They LGTM, but since they're changing all our
ocaml packages (which can go to master), I thought I could sneak in a
small dune update. That needed an opam update and it was not as smooth
as expected. I'd like to wait until I get reviews on
https://issues.guix.gnu.org/49950, so we can push our patches together,
if that's ok with you?

Also, note that the link in the doc is incorrect, the anchor should be
#profile, not #profil :)




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-09  2:17 ` [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
@ 2021-08-09  7:17   ` pukkamustard
  0 siblings, 0 replies; 19+ messages in thread
From: pukkamustard @ 2021-08-09  7:17 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868


Julien Lepiller <julien@lepiller.eu> writes:

> Thanks for the patches! They LGTM, but since they're changing 
> all our
> ocaml packages (which can go to master), I thought I could sneak 
> in a
> small dune update. That needed an opam update and it was not as 
> smooth
> as expected. I'd like to wait until I get reviews on
> https://issues.guix.gnu.org/49950, so we can push our patches 
> together,
> if that's ok with you?

Sounds good to me!

Will try and checkout #49950 today.

> Also, note that the link in the doc is incorrect, the anchor 
> should be
> #profile, not #profil :)

Oops. Fixed in v2.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH v2 1/2] guix: dune-build-system: Add a profile parameter.
  2021-08-04  8:04 [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter pukkamustard
  2021-08-04  8:08 ` [bug#49868] [PATCH 1/2] " pukkamustard
  2021-08-09  2:17 ` [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
@ 2021-08-09  7:19 ` pukkamustard
  2021-08-09  7:19   ` [bug#49868] [PATCH v2 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments pukkamustard
  2021-08-20 22:09 ` bug#49868: [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
  3 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-08-09  7:19 UTC (permalink / raw)
  To: 49868; +Cc: pukkamustard

* guix/build-system/dune.scm: Add a profile parameter.
* guix/build/dune-build-system.scm (build): Use it.
* doc/guix.texi: Document it.
* gnu/packages/ocaml.scm: Remove profile being set from build flags.
---
 doc/guix.texi                    |  7 +++++++
 gnu/packages/ocaml.scm           | 17 ++++++-----------
 guix/build-system/dune.scm       |  3 +++
 guix/build/dune-build-system.scm |  8 ++++++--
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9a9c85678c..15b0ed7534 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -94,6 +94,7 @@ Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
 Copyright @copyright{} 2021 Domagoj Stolfa@*
 Copyright @copyright{} 2021 Hui Lu@*
+Copyright @copyright{} 2021 pukkamustard@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -7731,6 +7732,12 @@ The @code{#:package} parameter can be passed to specify a package name, which
 is useful 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}.
+
+The @code{#:profile} parameter can be passed to specify the
+@uref{https://dune.readthedocs.io/en/stable/dune-files.html#profile,
+dune build profile}. This is equivalent to passing the @code{--profile}
+argument to @code{dune}. Its default value is @code{"release"}.
+
 @end defvr
 
 @defvr {Scheme Variable} go-build-system
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index bf9242410d..547b905317 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -2854,8 +2854,7 @@ without a complete in-memory representation of the data.")
           "1dvcl108ir9nqkk4mjm9xhhj4p9dx9bmg8bnms54fizs1x3x8ar3"))))
     (build-system dune-build-system)
     (arguments
-     `(#:test-target "tests"
-       #:build-flags (list "--profile=release")))
+     `(#:test-target "tests"))
     (propagated-inputs
      `(("ocaml-cmdliner" ,ocaml-cmdliner)))
     (home-page "https://www.typerex.org/ocp-indent.html")
@@ -3273,8 +3272,7 @@ build system and allows external tools to analyse your project easily.")
                   "1smcc0l6fh2n0y6bp96c69j5nw755jja99w0b206wx3yb2m4w2hs"))))
     (build-system dune-build-system)
     (arguments
-     `(#:tests? #f
-       #:build-flags (list "--profile" "release")))
+     `(#:tests? #f))
     (native-inputs
      `(("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/mjambon/cppo")
@@ -3342,8 +3340,7 @@ standard iterator type starting from 4.07.")
         (base32 "07ycb103mr4mrkxfd63cwlsn023xvcjp0ra0k7n2gwrg0mwxmfss"))))
     (build-system dune-build-system)
     (arguments
-     `(#:tests? #f
-       #:build-flags (list "--profile" "release")))
+     `(#:tests? #f))
     (propagated-inputs
      `(("ocaml-seq" ,ocaml-seq)))
     (native-inputs
@@ -3820,9 +3817,8 @@ the plugins facilitate extensibility, and the frontends serve as entry points.")
                 "0chn7ldqb3wyf95yhmsxxq65cif56smgz1mhhc7m0dpwmyq1k97h"))))
     (build-system dune-build-system)
     (arguments
-     `(#:build-flags (list "--profile" "release")
-       #:test-target "camomile-test"
-       #:tests? #f; Tests fail, see https://github.com/yoriyuki/Camomile/issues/82
+     `(#:test-target "camomile-test"
+       #:tests? #f ; Tests fail, see https://github.com/yoriyuki/Camomile/issues/82
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'fix-usr-share
@@ -3913,8 +3909,7 @@ connect an engine to your inputs and rendering functions to get an editor.")
         (base32 "0zcjy6fvf0d3i2ssz96asl889n3r6bplyzk7xvb2s3dkxbgcisyy"))))
     (build-system dune-build-system)
     (arguments
-     `(#:build-flags (list "--profile" "release")
-       #:tests? #f
+     `(#:tests? #f
        #:ocaml ,ocaml-4.07
        #:findlib ,ocaml4.07-findlib
        #:dune ,ocaml4.07-dune))
diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index 6a2f3d16de..1a64cf9b75 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2021 pukkamustard <pukkamustard@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,6 +89,7 @@
                      (out-of-source? #t)
                      (jbuild? #f)
                      (package #f)
+                     (profile "release")
                      (tests? #t)
                      (test-flags ''())
                      (test-target "test")
@@ -127,6 +129,7 @@ provides a 'setup.ml' file as its build system."
                    #:out-of-source? ,out-of-source?
                    #:jbuild? ,jbuild?
                    #:package ,package
+                   #:profile ,profile
                    #: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 7e2ec1e3e1..6a0c2593ac 100644
--- a/guix/build/dune-build-system.scm
+++ b/guix/build/dune-build-system.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2019 Gabriel Hondet <gabrielhondet@gmail.com>
+;;; Copyright © 2021 pukkamustard <pukkamustard@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,11 +32,14 @@
 ;; Code:
 
 (define* (build #:key (build-flags '()) (jbuild? #f)
-                (use-make? #f) (package #f) #:allow-other-keys)
+                (use-make? #f) (package #f)
+                (profile "release") #:allow-other-keys)
   "Build the given package."
   (let ((program (if jbuild? "jbuilder" "dune")))
     (apply invoke program "build" "@install"
-           (append (if package (list "-p" package) '()) build-flags)))
+           (append (if package (list "-p" package) '())
+                   `("--profile" ,profile)
+                   build-flags)))
   #t)
 
 (define* (check #:key (test-flags '()) (test-target "test") tests?
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH v2 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments.
  2021-08-09  7:19 ` [bug#49868] [PATCH v2 1/2] " pukkamustard
@ 2021-08-09  7:19   ` pukkamustard
  0 siblings, 0 replies; 19+ messages in thread
From: pukkamustard @ 2021-08-09  7:19 UTC (permalink / raw)
  To: 49868; +Cc: pukkamustard

* gnu/packages/ocaml.scm (ocaml4.07-base): Remove unnecessary arguments.
---
 gnu/packages/ocaml.scm | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 547b905317..39ed60088e 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -4925,16 +4925,6 @@ provided by companion libraries such as
         (sha256
          (base32
           "0j6xb4265jr41vw4fjzak6yr8s30qrnzapnc6rl1dxy8bjai0nir"))))
-     (arguments
-      `(#:phases
-        (modify-phases %standard-phases
-          (replace 'build
-            ;; make warnings non fatal (jbuilder behaviour)
-            (lambda _
-              (invoke "dune" "build" "@install" "--profile=release"))))
-        #:ocaml ,ocaml-4.07
-        #:findlib ,ocaml4.07-findlib
-        #:dune ,ocaml4.07-dune))
      (properties '()))))
 
 (define-public ocaml-compiler-libs
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* bug#49868: [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-04  8:04 [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter pukkamustard
                   ` (2 preceding siblings ...)
  2021-08-09  7:19 ` [bug#49868] [PATCH v2 1/2] " pukkamustard
@ 2021-08-20 22:09 ` Julien Lepiller
  2021-08-24  6:52   ` [bug#49868] " pukkamustard
  3 siblings, 1 reply; 19+ messages in thread
From: Julien Lepiller @ 2021-08-20 22:09 UTC (permalink / raw)
  To: pukkamustard; +Cc: 49868-done

Pushed to master as 777ce1485749cc3dbe178fcc1e0654a7e74900c5 and
33a1ec29fa0ad72c61cef13c8af08c847eb399c1, thanks!




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-20 22:09 ` bug#49868: [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
@ 2021-08-24  6:52   ` pukkamustard
  2021-08-24  7:13     ` pukkamustard
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-08-24  6:52 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868


Julien Lepiller <julien@lepiller.eu> writes:

> Pushed to master as 777ce1485749cc3dbe178fcc1e0654a7e74900c5 and
> 33a1ec29fa0ad72c61cef13c8af08c847eb399c1, thanks!

Hi,

I think this is causing trouble and maybe we should revert the commits.

Setting the dune "--profile" argument to "release" without using "-p" seems to cause broken builds.

For example ocaml-ppxlib builds properly but seems to be broken. Anything depending on ocaml-ppxlib fails with the errors:

```
Error: Files /gnu/store/4rxccc7d9qxfp8ggv0b3ais1r22yf46l-ocaml-ppx-compare-0.14.0/lib/ocaml/site-lib/ppx_compare/expander/ppx_compare_expander.cmxa
       and /gnu/store/dvrvy7b6d318ifg5n698x1667776alwg-ocaml-ppxlib-0.22.1/lib/ocaml/site-lib/ppxlib/ppxlib.cmxa
       make inconsistent assumptions over interface Ppxlib
Error: The files /gnu/store/dvrvy7b6d318ifg5n698x1667776alwg-ocaml-ppxlib-0.22.1/lib/ocaml/site-lib/ppxlib/ppxlib.cmi
       and /gnu/store/4rxccc7d9qxfp8ggv0b3ais1r22yf46l-ocaml-ppx-compare-0.14.0/lib/ocaml/site-lib/ppx_compare/expander/ppx_compare_expander.cmi
       make inconsistent assumptions over interface Ppxlib
````

See also https://issues.guix.gnu.org/49867#96 where the same thing happens for ocaml-eqaf.

-pukkamustard




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-24  6:52   ` [bug#49868] " pukkamustard
@ 2021-08-24  7:13     ` pukkamustard
  2021-08-24  7:51       ` pukkamustard
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-08-24  7:13 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868


pukkamustard <pukkamustard@posteo.net> writes:

> For example ocaml-ppxlib builds properly but seems to be broken. Anything depending on ocaml-ppxlib fails with the errors:

This is not true. ocaml-ppx-hash fails to build. But other things depending on ocaml-ppxlib seem to build fine (e.g. ocaml-ppx-optional, ocaml-ppx-assert).




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-24  7:13     ` pukkamustard
@ 2021-08-24  7:51       ` pukkamustard
  2021-09-07  9:33         ` pukkamustard
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-08-24  7:51 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868


I submitted #50180 to fix builds of ocaml-ppx-hash.

The impact of this seems to be smaller than I feared. Maybe reverting is not necessary.

Still I don't really understand what's going on. I will try and find a concise example and ask the Dune people.

pukkamustard <pukkamustard@posteo.net> writes:

> pukkamustard <pukkamustard@posteo.net> writes:
>
>> For example ocaml-ppxlib builds properly but seems to be broken. Anything depending on ocaml-ppxlib fails with the errors:
>
> This is not true. ocaml-ppx-hash fails to build. But other things depending on ocaml-ppxlib seem to build fine (e.g. ocaml-ppx-optional, ocaml-ppx-assert).




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-08-24  7:51       ` pukkamustard
@ 2021-09-07  9:33         ` pukkamustard
  2021-09-07 11:06           ` Julien Lepiller
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-09-07  9:33 UTC (permalink / raw)
  To: 49868; +Cc: Julien Lepiller

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]


I suggest reverting commit 33a1ec29fa0ad72c61cef13c8af08c847eb399c1
('guix: dune-build-system: Add a profile parameter.') and instead
applying attached patch.

The attached patch sets the '--release' flag instead of '--profile
release'. From 'dune --help':

--8<---------------cut here---------------start------------->8---
--release
   Put dune into a reproducible release mode. This is in fact a
   shorthand for --root . --ignore-promoted-rules --no-config
   --profile release --always-show-command-line
   --promote-install-files --default-target @install. You should use
   this option for release builds. For instance, you must use this
   option in your <package>.opam files. Except if you already use -p,
   as -p implies this option.
--8<---------------cut here---------------end--------------->8---

I think this is what we want.

Setting '--profile release' was not enough and was causing
inconsistencies with packages that were building with the '-p' flag.

-pukkamustard


[-- Attachment #2: 0001-guix-dune-build-system-Put-dune-into-a-reproducible-.patch --]
[-- Type: text/x-patch, Size: 4240 bytes --]

From 31bf546f87e90d108003b6ddef4756bf2ef04db7 Mon Sep 17 00:00:00 2001
From: pukkamustard <pukkamustard@posteo.net>
Date: Tue, 7 Sep 2021 11:24:41 +0200
Subject: [PATCH 1/2] guix: dune-build-system: Put dune into a reproducible
 release mode.

* guix/build/dune-build-system.scm (build,check): Use the release flag.
* gnu/packages/ocaml.scm: Remove profile being set to release from build flags.
---
 gnu/packages/ocaml.scm           | 15 +++++----------
 guix/build/dune-build-system.scm |  5 +++--
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index bdd52d2940..657eed2e62 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -2876,8 +2876,7 @@ without a complete in-memory representation of the data.")
           "1dvcl108ir9nqkk4mjm9xhhj4p9dx9bmg8bnms54fizs1x3x8ar3"))))
     (build-system dune-build-system)
     (arguments
-     `(#:test-target "tests"
-       #:build-flags (list "--profile=release")))
+     `(#:test-target "tests"))
     (propagated-inputs
      `(("ocaml-cmdliner" ,ocaml-cmdliner)))
     (home-page "https://www.typerex.org/ocp-indent.html")
@@ -3295,8 +3294,7 @@ build system and allows external tools to analyse your project easily.")
                   "1smcc0l6fh2n0y6bp96c69j5nw755jja99w0b206wx3yb2m4w2hs"))))
     (build-system dune-build-system)
     (arguments
-     `(#:tests? #f
-       #:build-flags (list "--profile" "release")))
+     `(#:tests? #f))
     (native-inputs
      `(("ocamlbuild" ,ocamlbuild)))
     (home-page "https://github.com/mjambon/cppo")
@@ -3364,8 +3362,7 @@ standard iterator type starting from 4.07.")
         (base32 "07ycb103mr4mrkxfd63cwlsn023xvcjp0ra0k7n2gwrg0mwxmfss"))))
     (build-system dune-build-system)
     (arguments
-     `(#:tests? #f
-       #:build-flags (list "--profile" "release")))
+     `(#:tests? #f))
     (propagated-inputs
      `(("ocaml-seq" ,ocaml-seq)))
     (native-inputs
@@ -3842,8 +3839,7 @@ the plugins facilitate extensibility, and the frontends serve as entry points.")
                 "0chn7ldqb3wyf95yhmsxxq65cif56smgz1mhhc7m0dpwmyq1k97h"))))
     (build-system dune-build-system)
     (arguments
-     `(#:build-flags (list "--profile" "release")
-       #:test-target "camomile-test"
+     `(#:test-target "camomile-test"
        #:tests? #f; Tests fail, see https://github.com/yoriyuki/Camomile/issues/82
        #:phases
        (modify-phases %standard-phases
@@ -3935,8 +3931,7 @@ connect an engine to your inputs and rendering functions to get an editor.")
         (base32 "0zcjy6fvf0d3i2ssz96asl889n3r6bplyzk7xvb2s3dkxbgcisyy"))))
     (build-system dune-build-system)
     (arguments
-     `(#:build-flags (list "--profile" "release")
-       #:tests? #f
+     `(#:tests? #f
        #:ocaml ,ocaml-4.07
        #:findlib ,ocaml4.07-findlib
        #:dune ,ocaml4.07-dune))
diff --git a/guix/build/dune-build-system.scm b/guix/build/dune-build-system.scm
index 7e2ec1e3e1..da93899e7f 100644
--- a/guix/build/dune-build-system.scm
+++ b/guix/build/dune-build-system.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2019 Gabriel Hondet <gabrielhondet@gmail.com>
+;;; Copyright © 2021 pukkamustard <pukkamustard@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -35,7 +36,7 @@
   "Build the given package."
   (let ((program (if jbuild? "jbuilder" "dune")))
     (apply invoke program "build" "@install"
-           (append (if package (list "-p" package) '()) build-flags)))
+           (append (if package (list "-p" package) '("--release")) build-flags)))
   #t)
 
 (define* (check #:key (test-flags '()) (test-target "test") tests?
@@ -44,7 +45,7 @@
   (when tests?
     (let ((program (if jbuild? "jbuilder" "dune")))
       (apply invoke program "runtest" test-target
-             (append (if package (list "-p" package) '()) test-flags))))
+             (append (if package (list "-p" package) '("--release")) test-flags))))
   #t)
 
 (define* (install #:key outputs (install-target "install") (jbuild? #f)
-- 
2.33.0


[-- Attachment #3: Type: text/plain, Size: 708 bytes --]



pukkamustard <pukkamustard@posteo.net> writes:

> I submitted #50180 to fix builds of ocaml-ppx-hash.
>
> The impact of this seems to be smaller than I feared. Maybe reverting is not necessary.
>
> Still I don't really understand what's going on. I will try and find a concise example and ask the Dune people.
>
> pukkamustard <pukkamustard@posteo.net> writes:
>
>> pukkamustard <pukkamustard@posteo.net> writes:
>>
>>> For example ocaml-ppxlib builds properly but seems to be broken. Anything depending on ocaml-ppxlib fails with the errors:
>>
>> This is not true. ocaml-ppx-hash fails to build. But other things depending on ocaml-ppxlib seem to build fine (e.g. ocaml-ppx-optional, ocaml-ppx-assert).


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-07  9:33         ` pukkamustard
@ 2021-09-07 11:06           ` Julien Lepiller
  2021-09-07 11:46             ` pukkamustard
  0 siblings, 1 reply; 19+ messages in thread
From: Julien Lepiller @ 2021-09-07 11:06 UTC (permalink / raw)
  To: pukkamustard, 49868

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

Instead of reverting, coull you senl a patch on top of master, that simply replaces the flag?

Le 7 septembre 2021 05:33:39 GMT-04:00, pukkamustard <pukkamustard@posteo.net> a écrit :
>
>I suggest reverting commit 33a1ec29fa0ad72c61cef13c8af08c847eb399c1
>('guix: dune-build-system: Add a profile parameter.') and instead
>applying attached patch.
>
>The attached patch sets the '--release' flag instead of '--profile
>release'. From 'dune --help':
>
>--8<---------------cut here---------------start------------->8---
>--release
>   Put dune into a reproducible release mode. This is in fact a
>   shorthand for --root . --ignore-promoted-rules --no-config
>   --profile release --always-show-command-line
>   --promote-install-files --default-target @install. You should use
>   this option for release builds. For instance, you must use this
>   option in your <package>.opam files. Except if you already use -p,
>   as -p implies this option.
>--8<---------------cut here---------------end--------------->8---
>
>I think this is what we want.
>
>Setting '--profile release' was not enough and was causing
>inconsistencies with packages that were building with the '-p' flag.
>
>-pukkamustard
>

[-- Attachment #2: Type: text/html, Size: 1531 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-07 11:06           ` Julien Lepiller
@ 2021-09-07 11:46             ` pukkamustard
  2021-09-07 13:03               ` Julien Lepiller
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-09-07 11:46 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868

[-- Attachment #1: Type: text/plain, Size: 95 bytes --]


Attached a patch on top of master that replaces the profile parameter
with the release flag.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guix-dune-build-system-Put-dune-into-a-reproducible-.patch --]
[-- Type: text/x-patch, Size: 3322 bytes --]

From 8616439f8331d7d8fc089a83bc91e3c2ebc25935 Mon Sep 17 00:00:00 2001
From: pukkamustard <pukkamustard@posteo.net>
Date: Tue, 7 Sep 2021 13:41:12 +0200
Subject: [PATCH] guix: dune-build-system: Put dune into a reproducible release
 mode.

* guix/build/dune-build-system.scm (build,check): Remove the profile parameter
and use the release flag.
* guix/build-system/dune.scm: Remove the profile parameter.
* doc/guix.texi: Remove paragraph on profile parameter.
---
 doc/guix.texi                    | 5 -----
 guix/build-system/dune.scm       | 2 --
 guix/build/dune-build-system.scm | 9 ++++-----
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 36a0c7f5ec..a056edc192 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7735,11 +7735,6 @@ is useful 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}.
 
-The @code{#:profile} parameter can be passed to specify the
-@uref{https://dune.readthedocs.io/en/stable/dune-files.html#profile,
-dune build profile}. This is equivalent to passing the @code{--profile}
-argument to @code{dune}. Its default value is @code{"release"}.
-
 @end defvr
 
 @defvr {Scheme Variable} go-build-system
diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index 1a64cf9b75..8f17519c2f 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -89,7 +89,6 @@
                      (out-of-source? #t)
                      (jbuild? #f)
                      (package #f)
-                     (profile "release")
                      (tests? #t)
                      (test-flags ''())
                      (test-target "test")
@@ -129,7 +128,6 @@ provides a 'setup.ml' file as its build system."
                    #:out-of-source? ,out-of-source?
                    #:jbuild? ,jbuild?
                    #:package ,package
-                   #:profile ,profile
                    #: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 6a0c2593ac..70094d2544 100644
--- a/guix/build/dune-build-system.scm
+++ b/guix/build/dune-build-system.scm
@@ -32,13 +32,11 @@
 ;; Code:
 
 (define* (build #:key (build-flags '()) (jbuild? #f)
-                (use-make? #f) (package #f)
-                (profile "release") #: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"
-           (append (if package (list "-p" package) '())
-                   `("--profile" ,profile)
+           (append (if package (list "-p" package) '("--release"))
                    build-flags)))
   #t)
 
@@ -48,7 +46,8 @@
   (when tests?
     (let ((program (if jbuild? "jbuilder" "dune")))
       (apply invoke program "runtest" test-target
-             (append (if package (list "-p" package) '()) test-flags))))
+             (append (if package (list "-p" package) '("--release"))
+                     test-flags))))
   #t)
 
 (define* (install #:key outputs (install-target "install") (jbuild? #f)
-- 
2.33.0


[-- Attachment #3: Type: text/plain, Size: 1303 bytes --]



Julien Lepiller <julien@lepiller.eu> writes:

> Instead of reverting, coull you senl a patch on top of master, that simply replaces the flag?
>
> Le 7 septembre 2021 05:33:39 GMT-04:00, pukkamustard <pukkamustard@posteo.net> a écrit :
>
>  I suggest reverting commit 33a1ec29fa0ad72c61cef13c8af08c847eb399c1
> ('guix: dune-build-system: Add a profile parameter.') and instead
> applying attached patch.
>
> The attached patch sets the '--release' flag instead of '--profile
> release'. From 'dune --help':
>
> --8<---------------cut here---------------start------------->8---
> --release
>    Put dune into a reproducible release mode. This is in fact a
>    shorthand for --root . --ignore-promoted-rules --no-config
>    --profile release --always-show-command-line
>    --promote-install-files --default-target @install. You should use
>    this option for release builds. For instance, you must use this
>    option in your <package>.opam files. Except if you already use -p,
>    as -p implies this option.
> --8<---------------cut here---------------end--------------->8---
>
> I think this is what we want.
>
> Setting '--profile release' was not enough and was causing
> inconsistencies with packages that were building with the '-p' flag.
>
> -pukkamustard


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-07 11:46             ` pukkamustard
@ 2021-09-07 13:03               ` Julien Lepiller
  2021-09-07 18:11                 ` pukkamustard
  0 siblings, 1 reply; 19+ messages in thread
From: Julien Lepiller @ 2021-09-07 13:03 UTC (permalink / raw)
  To: pukkamustard; +Cc: 49868

Le Tue, 07 Sep 2021 11:46:01 +0000,
pukkamustard <pukkamustard@posteo.net> a écrit :

> Attached a patch on top of master that replaces the profile parameter
> with the release flag.
> 

Unfortunately, this is breaking our ocaml4.07-* packages, because the
--release flag doesn't exist in the version we use for ocaml4.07-dune.
I think the easiest would be to add a flag #:release? and set it to #f
in package-with-ocaml4.07.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-07 13:03               ` Julien Lepiller
@ 2021-09-07 18:11                 ` pukkamustard
  2021-09-07 22:03                   ` Julien Lepiller
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-09-07 18:11 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868


Julien Lepiller <julien@lepiller.eu> writes:

> Unfortunately, this is breaking our ocaml4.07-* packages, because the
> --release flag doesn't exist in the version we use for ocaml4.07-dune.

Whoops. Seems like the --release flag was only added in dune 2.5.0
(https://github.com/ocaml/dune/blob/main/CHANGES.md#250-09042020;
ocaml4.07-dune is at 1.11.3).

> I think the easiest would be to add a flag #:release? and set it to #f
> in package-with-ocaml4.07.

That would work. But I think it would be better if we built everything
in release mode.

Unfortunately the way to do that with old dune is by expclity with '-p
PACKAGE1,PACKAGE2'. That means we need to rename the #:package argument
to #:packages, allow it to take a list and add explicit packages to all
OCaml4.07 packages.

Another way would be to write-out the flags for which -p and --release
are short-hand for. Unfortunately this is different in dune 2.9.0 and
1.11.3 (taken from the --help):

2.9.0:
--8<---------------cut here---------------start------------->8---
--root . --ignore-promoted-rules --no-config --profile release
  --always-show-command-line --promote-install-files --default-target
  @install
--8<---------------cut here---------------end--------------->8---

1.11.3:
--8<---------------cut here---------------start------------->8---
--root . --ignore-promoted-rules --no-config ----profile release
--8<---------------cut here---------------end--------------->8---

Can we check the version of dune in dune-build-system and either use
--release or the set of 1.11.3 flags?

I just tried doing this in (guix build dune-build-system). Didn't work
as I couldn't use (guix package). After reading up, I guess this needs
to be done in (guix build-system dune) and lowered down as an argument -
maybe as 'dune-release-flags'? Would that be ok?




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-07 18:11                 ` pukkamustard
@ 2021-09-07 22:03                   ` Julien Lepiller
  2021-09-08  8:24                     ` pukkamustard
  0 siblings, 1 reply; 19+ messages in thread
From: Julien Lepiller @ 2021-09-07 22:03 UTC (permalink / raw)
  To: pukkamustard; +Cc: 49868

Le Tue, 07 Sep 2021 18:11:24 +0000,
pukkamustard <pukkamustard@posteo.net> a écrit :

> Julien Lepiller <julien@lepiller.eu> writes:
> 
> > Unfortunately, this is breaking our ocaml4.07-* packages, because
> > the --release flag doesn't exist in the version we use for
> > ocaml4.07-dune.  
> 
> Whoops. Seems like the --release flag was only added in dune 2.5.0
> (https://github.com/ocaml/dune/blob/main/CHANGES.md#250-09042020;
> ocaml4.07-dune is at 1.11.3).
> 
> > I think the easiest would be to add a flag #:release? and set it to
> > #f in package-with-ocaml4.07.  
> 
> That would work. But I think it would be better if we built everything
> in release mode.
> 
> Unfortunately the way to do that with old dune is by expclity with '-p
> PACKAGE1,PACKAGE2'. That means we need to rename the #:package
> argument to #:packages, allow it to take a list and add explicit
> packages to all OCaml4.07 packages.
> 
> Another way would be to write-out the flags for which -p and --release
> are short-hand for. Unfortunately this is different in dune 2.9.0 and
> 1.11.3 (taken from the --help):
> 
> 2.9.0:
> --8<---------------cut here---------------start------------->8---
> --root . --ignore-promoted-rules --no-config --profile release
>   --always-show-command-line --promote-install-files --default-target
>   @install
> --8<---------------cut here---------------end--------------->8---
> 
> 1.11.3:
> --8<---------------cut here---------------start------------->8---
> --root . --ignore-promoted-rules --no-config ----profile release
> --8<---------------cut here---------------end--------------->8---

I suppose these additional flags are not available in dune 1.11?

> 
> Can we check the version of dune in dune-build-system and either use
> --release or the set of 1.11.3 flags?
> 
> I just tried doing this in (guix build dune-build-system). Didn't work
> as I couldn't use (guix package). After reading up, I guess this needs
> to be done in (guix build-system dune) and lowered down as an
> argument - maybe as 'dune-release-flags'? Would that be ok?

Yeah, that sounds good. Another solution would be to get rid of
ocaml4.07, but that's our future bootstrap path (as this is the only
bootstrapped version currently), so we will need it anyway...




^ permalink raw reply	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-07 22:03                   ` Julien Lepiller
@ 2021-09-08  8:24                     ` pukkamustard
  2021-09-08 11:45                       ` Julien Lepiller
  0 siblings, 1 reply; 19+ messages in thread
From: pukkamustard @ 2021-09-08  8:24 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 49868

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]


Julien Lepiller <julien@lepiller.eu> writes:

>> 
>> 2.9.0:
>> --8<---------------cut here---------------start------------->8---
>> --root . --ignore-promoted-rules --no-config --profile release
>>   --always-show-command-line --promote-install-files --default-target
>>   @install
>> --8<---------------cut here---------------end--------------->8---
>> 
>> 1.11.3:
>> --8<---------------cut here---------------start------------->8---
>> --root . --ignore-promoted-rules --no-config ----profile release
>> --8<---------------cut here---------------end--------------->8---
>
> I suppose these additional flags are not available in dune 1.11?
>

No, unfortunately the flags are not available in 1.11. We need to check
version and use appropriate flags.

>> 
>> Can we check the version of dune in dune-build-system and either use
>> --release or the set of 1.11.3 flags?
>> 
>> I just tried doing this in (guix build dune-build-system). Didn't work
>> as I couldn't use (guix package). After reading up, I guess this needs
>> to be done in (guix build-system dune) and lowered down as an
>> argument - maybe as 'dune-release-flags'? Would that be ok?
>
> Yeah, that sounds good.

Attached a patch that does that. ocaml4.07 packages are building again.

Unsure about the double quote things and if there is a better way to
check versions.

> Another solution would be to get rid of
> ocaml4.07, but that's our future bootstrap path (as this is the only
> bootstrapped version currently), so we will need it anyway...

Yup, good to keep it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guix-dune-build-system-Put-dune-into-a-reproducible-.patch --]
[-- Type: text/x-patch, Size: 4844 bytes --]

From bb6bf9e12b81165405da6d5872c18f63e425742d Mon Sep 17 00:00:00 2001
From: pukkamustard <pukkamustard@posteo.net>
Date: Tue, 7 Sep 2021 13:41:12 +0200
Subject: [PATCH] guix: dune-build-system: Put dune into a reproducible release
 mode.

* guix/build/dune-build-system.scm (build,check): Remove the profile parameter
and use the release flag.
* guix/build-system/dune.scm: Remove the profile parameter.
* doc/guix.texi: Remove paragraph on profile parameter.
---
 doc/guix.texi                    |  5 -----
 guix/build-system/dune.scm       | 17 ++++++++++++++---
 guix/build/dune-build-system.scm | 15 +++++++++------
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 36a0c7f5ec..a056edc192 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7735,11 +7735,6 @@ is useful 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}.
 
-The @code{#:profile} parameter can be passed to specify the
-@uref{https://dune.readthedocs.io/en/stable/dune-files.html#profile,
-dune build profile}. This is equivalent to passing the @code{--profile}
-argument to @code{dune}. Its default value is @code{"release"}.
-
 @end defvr
 
 @defvr {Scheme Variable} go-build-system
diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index 1a64cf9b75..f52bbd0257 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -60,6 +60,15 @@
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
+
+  ;; Flags that put dune into reproducible build mode.
+  (define dune-release-flags
+    (if (equal? (package-version dune) "1.11.3")
+        ''("--root" "." "--ignore-promoted-rules" "--no-config"
+           "--profile" "release")
+        ;; For dune >= 2.5.0 this is just --release.
+        ''("--release")))
+
   (define private-keywords
     '(#:source #:target #:dune #:findlib #:ocaml #:inputs #:native-inputs))
 
@@ -79,7 +88,9 @@
            (build-inputs `(("dune" ,dune)
                            ,@(bag-build-inputs base)))
            (build dune-build)
-           (arguments (strip-keyword-arguments private-keywords arguments))))))
+           (arguments (append
+                       `(#:dune-release-flags ,dune-release-flags)
+                       (strip-keyword-arguments private-keywords arguments)))))))
 
 (define* (dune-build store name inputs
                      #:key (guile #f)
@@ -89,7 +100,7 @@
                      (out-of-source? #t)
                      (jbuild? #f)
                      (package #f)
-                     (profile "release")
+                     (dune-release-flags ''())
                      (tests? #t)
                      (test-flags ''())
                      (test-target "test")
@@ -129,7 +140,7 @@ provides a 'setup.ml' file as its build system."
                    #:out-of-source? ,out-of-source?
                    #:jbuild? ,jbuild?
                    #:package ,package
-                   #:profile ,profile
+                   #:dune-release-flags ,dune-release-flags
                    #: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 6a0c2593ac..e9ccc71057 100644
--- a/guix/build/dune-build-system.scm
+++ b/guix/build/dune-build-system.scm
@@ -32,23 +32,26 @@
 ;; Code:
 
 (define* (build #:key (build-flags '()) (jbuild? #f)
-                (use-make? #f) (package #f)
-                (profile "release") #:allow-other-keys)
+                (use-make? #f) (package #f) (dune-release-flags '())
+                #:allow-other-keys)
   "Build the given package."
   (let ((program (if jbuild? "jbuilder" "dune")))
     (apply invoke program "build" "@install"
-           (append (if package (list "-p" package) '())
-                   `("--profile" ,profile)
+           (append (if package (list "-p" package)
+                       dune-release-flags)
                    build-flags)))
   #t)
 
 (define* (check #:key (test-flags '()) (test-target "test") tests?
-                  (jbuild? #f) (package #f) #:allow-other-keys)
+                (jbuild? #f) (package #f) (dune-release-flags '())
+                #:allow-other-keys)
   "Test the given package."
   (when tests?
     (let ((program (if jbuild? "jbuilder" "dune")))
       (apply invoke program "runtest" test-target
-             (append (if package (list "-p" package) '()) test-flags))))
+             (append (if package (list "-p" package)
+                         dune-release-flags)
+                     test-flags))))
   #t)
 
 (define* (install #:key outputs (install-target "install") (jbuild? #f)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
  2021-09-08  8:24                     ` pukkamustard
@ 2021-09-08 11:45                       ` Julien Lepiller
  0 siblings, 0 replies; 19+ messages in thread
From: Julien Lepiller @ 2021-09-08 11:45 UTC (permalink / raw)
  To: pukkamustard; +Cc: 49868-done

Le Wed, 08 Sep 2021 08:24:19 +0000,
pukkamustard <pukkamustard@posteo.net> a écrit :

> 
> Attached a patch that does that. ocaml4.07 packages are building
> again.
> 
> Unsure about the double quote things and if there is a better way to
> check versions.
> 
> > Another solution would be to get rid of
> > ocaml4.07, but that's our future bootstrap path (as this is the only
> > bootstrapped version currently), so we will need it anyway...
> 
> Yup, good to keep it.
> 

Pushed as f8f94cc5446753b37ab3ddd23e21919efd006769, thanks!

I made an adjustment to the commit message and used version>= in (guix
build-system dune) instead of comparing to the exact version, in case
someone wants to use a different version, older that 2.5.0. Otherwise
unchanged. Thanks again!




^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-09-08 11:46 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04  8:04 [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter pukkamustard
2021-08-04  8:08 ` [bug#49868] [PATCH 1/2] " pukkamustard
2021-08-04  8:08   ` [bug#49868] [PATCH 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments pukkamustard
2021-08-09  2:17 ` [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
2021-08-09  7:17   ` pukkamustard
2021-08-09  7:19 ` [bug#49868] [PATCH v2 1/2] " pukkamustard
2021-08-09  7:19   ` [bug#49868] [PATCH v2 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments pukkamustard
2021-08-20 22:09 ` bug#49868: [PATCH 0/2] guix: dune-build-system: Add a profile parameter Julien Lepiller
2021-08-24  6:52   ` [bug#49868] " pukkamustard
2021-08-24  7:13     ` pukkamustard
2021-08-24  7:51       ` pukkamustard
2021-09-07  9:33         ` pukkamustard
2021-09-07 11:06           ` Julien Lepiller
2021-09-07 11:46             ` pukkamustard
2021-09-07 13:03               ` Julien Lepiller
2021-09-07 18:11                 ` pukkamustard
2021-09-07 22:03                   ` Julien Lepiller
2021-09-08  8:24                     ` pukkamustard
2021-09-08 11:45                       ` Julien Lepiller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).