[PATCH 0/2] guix: dune-build-system: Add a profile parameter.

  • Done
  • quality assurance status badge
Details
2 participants
  • Julien Lepiller
  • pukkamustard
Owner
unassigned
Submitted by
pukkamustard
Severity
normal
P
P
pukkamustard wrote on 4 Aug 2021 10:04
(address . guix-patches@gnu.org)(name . pukkamustard)(address . pukkamustard@posteo.net)
20210804080423.3533-1-pukkamustard@posteo.net
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


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
P
P
pukkamustard wrote on 4 Aug 2021 10:08
[PATCH 1/2] guix: dune-build-system: Add a profile parameter.
(address . 49868@debbugs.gnu.org)(name . pukkamustard)(address . pukkamustard@posteo.net)
20210804080830.3928-1-pukkamustard@posteo.net
* 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(-)

Toggle diff (140 lines)
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
P
P
pukkamustard wrote on 4 Aug 2021 10:08
[PATCH 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments.
(address . 49868@debbugs.gnu.org)(name . pukkamustard)(address . pukkamustard@posteo.net)
20210804080830.3928-2-pukkamustard@posteo.net
* gnu/packages/ocaml.scm (ocaml4.07-base): Remove unnecessary arguments.
---
gnu/packages/ocaml.scm | 10 ----------
1 file changed, 10 deletions(-)

Toggle diff (23 lines)
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
J
J
Julien Lepiller wrote on 9 Aug 2021 04:17
Re: [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 49868@debbugs.gnu.org)
20210809041758.5b2d939e@tachikoma.lepiller.eu
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 :)
P
P
pukkamustard wrote on 9 Aug 2021 09:17
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
86mtpr5bp0.fsf@posteo.net
Julien Lepiller <julien@lepiller.eu> writes:

Toggle quote (11 lines)
> 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.

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

Oops. Fixed in v2.
P
P
pukkamustard wrote on 9 Aug 2021 09:19
[PATCH v2 1/2] guix: dune-build-system: Add a profile parameter.
(address . 49868@debbugs.gnu.org)(name . pukkamustard)(address . pukkamustard@posteo.net)
20210809071904.27334-1-pukkamustard@posteo.net
* 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(-)

Toggle diff (140 lines)
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
P
P
pukkamustard wrote on 9 Aug 2021 09:19
[PATCH v2 2/2] gnu: ocaml4.07-base: Remove unnecessary arguments.
(address . 49868@debbugs.gnu.org)(name . pukkamustard)(address . pukkamustard@posteo.net)
20210809071904.27334-2-pukkamustard@posteo.net
* gnu/packages/ocaml.scm (ocaml4.07-base): Remove unnecessary arguments.
---
gnu/packages/ocaml.scm | 10 ----------
1 file changed, 10 deletions(-)

Toggle diff (23 lines)
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
J
J
Julien Lepiller wrote on 21 Aug 2021 00:09
Re: [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 49868-done@debbugs.gnu.org)
20210821000926.00deacf3@tachikoma.lepiller.eu
Pushed to master as 777ce1485749cc3dbe178fcc1e0654a7e74900c5 and
33a1ec29fa0ad72c61cef13c8af08c847eb399c1, thanks!
Closed
P
P
pukkamustard wrote on 24 Aug 2021 08:52
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
868s0r72rb.fsf@posteo.net
Julien Lepiller <julien@lepiller.eu> writes:

Toggle quote (3 lines)
> 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#96where the same thing happens for ocaml-eqaf.

-pukkamustard
P
P
pukkamustard wrote on 24 Aug 2021 09:13
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
865yvv71sw.fsf@posteo.net
pukkamustard <pukkamustard@posteo.net> writes:

Toggle quote (2 lines)
> 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).
P
P
pukkamustard wrote on 24 Aug 2021 09:51
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
86zgt75lhe.fsf@posteo.net
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:

Toggle quote (5 lines)
> 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).
P
P
pukkamustard wrote on 7 Sep 2021 11:33
(address . 49868@debbugs.gnu.org)(name . Julien Lepiller)(address . julien@lepiller.eu)
86y288yavn.fsf@posteo.net
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':

Toggle snippet (10 lines)
--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.

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
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(-)

Toggle diff (86 lines)
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
pukkamustard <pukkamustard@posteo.net> writes:

Toggle quote (13 lines)
> 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).
J
J
Julien Lepiller wrote on 7 Sep 2021 13:06
Re: [bug#49868] [PATCH 0/2] guix: dune -build-system: Add a profile parameter.
36A316B4-720C-4753-AFFC-DBC68DBE5EF4@lepiller.eu
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 :
Toggle quote (26 lines)
>
>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: file
P
P
pukkamustard wrote on 7 Sep 2021 13:46
Re: [bug#49868] [PATCH 0/2] guix: dune-build-system: Add a profile parameter.
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
86pmtky4yu.fsf@posteo.net
Attached a patch on top of master that replaces the profile parameter
with the release flag.
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(-)

Toggle diff (68 lines)
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
Julien Lepiller <julien@lepiller.eu> writes:

Toggle quote (28 lines)
> 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
J
J
Julien Lepiller wrote on 7 Sep 2021 15:03
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 49868@debbugs.gnu.org)
20210907150330.31124799@tachikoma.lepiller.eu
Le Tue, 07 Sep 2021 11:46:01 +0000,
pukkamustard <pukkamustard@posteo.net> a écrit :

Toggle quote (4 lines)
> 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.
P
P
pukkamustard wrote on 7 Sep 2021 20:11
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
86lf48xifn.fsf@posteo.net
Julien Lepiller <julien@lepiller.eu> writes:

Toggle quote (3 lines)
> 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
ocaml4.07-dune is at 1.11.3).

Toggle quote (3 lines)
> 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:
Toggle snippet (5 lines)
--root . --ignore-promoted-rules --no-config --profile release
--always-show-command-line --promote-install-files --default-target
@install

1.11.3:
Toggle snippet (3 lines)
--root . --ignore-promoted-rules --no-config ----profile release

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?
J
J
Julien Lepiller wrote on 8 Sep 2021 00:03
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 49868@debbugs.gnu.org)
20210908000321.662876ee@tachikoma.lepiller.eu
Le Tue, 07 Sep 2021 18:11:24 +0000,
pukkamustard <pukkamustard@posteo.net> a écrit :

Toggle quote (37 lines)
> 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?

Toggle quote (9 lines)
>
> 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...
P
P
pukkamustard wrote on 8 Sep 2021 10:24
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49868@debbugs.gnu.org)
86h7evxyf2.fsf@posteo.net
Julien Lepiller <julien@lepiller.eu> writes:

Toggle quote (16 lines)
>>
>> 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.

Toggle quote (11 lines)
>>
>> 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.

Toggle quote (4 lines)
> 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.
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(-)

Toggle diff (104 lines)
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
J
J
Julien Lepiller wrote on 8 Sep 2021 13:45
(name . pukkamustard)(address . pukkamustard@posteo.net)(address . 49868-done@debbugs.gnu.org)
20210908134521.5eba3dd3@tachikoma.lepiller.eu
Le Wed, 08 Sep 2021 08:24:19 +0000,
pukkamustard <pukkamustard@posteo.net> a écrit :

Toggle quote (14 lines)
>
> 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!
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 49868@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 49868
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch