guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: guix: dune-build-system: Put dune into a reproduc


From: guix-commits
Subject: branch master updated: guix: dune-build-system: Put dune into a reproducible release mode.
Date: Wed, 08 Sep 2021 07:43:35 -0400

This is an automated email from the git hooks/post-receive script.

roptat pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new f8f94cc  guix: dune-build-system: Put dune into a reproducible release 
mode.
f8f94cc is described below

commit f8f94cc5446753b37ab3ddd23e21919efd006769
Author: pukkamustard <pukkamustard@posteo.net>
AuthorDate: Tue Sep 7 13:41:12 2021 +0200

    guix: dune-build-system: Put dune into a reproducible release mode.
    
    * guix/build/dune-build-system.scm (build,check): Replace the profile 
parameter
    with the appropriate release flags.
    * guix/build-system/dune.scm: Remove the profile parameter.
    * doc/guix.texi: Remove paragraph on profile parameter.
    
    Signed-off-by: Julien Lepiller <julien@lepiller.eu>
---
 doc/guix.texi                    |  5 -----
 guix/build-system/dune.scm       | 19 ++++++++++++++++---
 guix/build/dune-build-system.scm | 15 +++++++++------
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 679f6b4..29246ad 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 1a64cf9..5b33ef6 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -60,6 +60,17 @@
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
+
+  ;; Flags that put dune into reproducible build mode.
+  (define dune-release-flags
+    (if (version>=? (package-version dune) "2.5.0")
+        ;; For dune >= 2.5.0 this is just --release.
+        ''("--release")
+        ;; --release does not exist before 2.5.0.  Replace with flags 
compatible
+        ;; with our old ocaml4.07-dune (1.11.3)
+        ''("--root" "." "--ignore-promoted-rules" "--no-config"
+           "--profile" "release")))
+
   (define private-keywords
     '(#:source #:target #:dune #:findlib #:ocaml #:inputs #:native-inputs))
 
@@ -79,7 +90,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 +102,7 @@
                      (out-of-source? #t)
                      (jbuild? #f)
                      (package #f)
-                     (profile "release")
+                     (dune-release-flags ''())
                      (tests? #t)
                      (test-flags ''())
                      (test-target "test")
@@ -129,7 +142,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 6a0c259..e9ccc71 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]