diff mbox

[bug#49868,0/2] guix: dune-build-system: Add a profile parameter.

Message ID 86pmtky4yu.fsf@posteo.net
State Accepted
Headers show

Commit Message

pukkamustard Sept. 7, 2021, 11:46 a.m. UTC
Attached a patch on top of master that replaces the profile parameter
with the release flag.
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

Comments

Julien Lepiller Sept. 7, 2021, 1:03 p.m. UTC | #1
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.
pukkamustard Sept. 7, 2021, 6:11 p.m. UTC | #2
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?
Julien Lepiller Sept. 7, 2021, 10:03 p.m. UTC | #3
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...
diff mbox

Patch

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