all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikolai Merinov <nikolai.merinov@member.fsf.org>
To: 33066@debbugs.gnu.org
Subject: [bug#33066] [PATCH 1/2] gnu: rust: workaround rust 1.25-27 reproducibility issues
Date: Tue, 16 Oct 2018 02:32:11 +0500	[thread overview]
Message-ID: <875zy1u5ec.fsf@member.fsf.org> (raw)
In-Reply-To: <877eihu5hx.fsf@member.fsf.org>

* gnu/packages/patches/rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch:
patch that make "searchindex.js" reproducible in rust 1.27 and newer.
* gnu/local.mk (dist_patch_DATA): Add new patch file.
* gnu/packages/rust.scm (rust-1.19): Use system libssh2 library
during cargo build. Note: libgit2 still builded as part of cargo build,
because cargo tests assume specific libgit2 minor release.
(rust-1.23): inherit native-inputs from previous package.
(rust-1.25): switch back to llvm 3.9.1 as workaround for
https://github.com/rust-lang/rust/issues/50556 issue.
(rust-1.27): apply patch to make "searchindex.js" files reproducible.
---
 gnu/local.mk                                  |  1 +
 ...ible-builds-by-forcing-window.search.patch | 28 ++++++++++++++++
 gnu/packages/rust.scm                         | 32 ++++++-------------
 3 files changed, 38 insertions(+), 23 deletions(-)
 create mode 100644 gnu/packages/patches/rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1fa2eaba3..2150cbf13 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1130,6 +1130,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch \
   %D%/packages/patches/rust-bootstrap-stage0-test.patch		\
   %D%/packages/patches/rust-coresimd-doctest.patch		\
+  %D%/packages/patches/rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch \
   %D%/packages/patches/rxvt-unicode-escape-sequences.patch	\
   %D%/packages/patches/scheme48-tests.patch			\
   %D%/packages/patches/scotch-test-threading.patch		\
diff --git a/gnu/packages/patches/rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch b/gnu/packages/patches/rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch
new file mode 100644
index 000000000..916662cbc
--- /dev/null
+++ b/gnu/packages/patches/rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch
@@ -0,0 +1,28 @@
+From b9ca108fcae2b738ca3f0c88c84ae5dc5a6f843f Mon Sep 17 00:00:00 2001
+From: Tim Ryan <id@timryan.org>
+Date: Mon, 14 May 2018 06:22:21 -0400
+Subject: [PATCH] Support reproducible builds by forcing window.search to use
+ stable key ordering. (#692)
+
+---
+ src/vendor/mdbook/src/renderer/html_handlebars/search.rs | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/vendor/mdbook/src/renderer/html_handlebars/search.rs b/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
+index d49772f8b..1ee66a511 100644
+--- a/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
++++ b/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
+@@ -205,6 +205,10 @@ fn write_to_js(index: Index, search_config: &Search) -> Result<String> {
+         searchoptions,
+         index,
+     };
++
++    // By converting to serde_json::Value as an intermediary, we use a
++    // BTreeMap internally and can force a stable ordering of map keys.
++    let json_contents = serde_json::to_value(&json_contents)?;
+     let json_contents = serde_json::to_string(&json_contents)?;
+ 
+     Ok(format!("window.search = {};", json_contents))
+-- 
+2.19.0
+
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 40633854a..cbfbdccf1 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -480,7 +480,8 @@ test = { path = \"../libtest\" }
      `(("jemalloc" ,jemalloc-4.5.0)
        ("llvm" ,llvm-3.9.1)
        ("openssl" ,openssl)
-       ("libcurl" ,curl))) ; For "cargo"
+       ("libssh2" ,libssh2) ; For "cargo"
+       ("libcurl" ,curl)))  ; For "cargo"
 
     ;; rustc invokes gcc, so we need to set its search paths accordingly.
     ;; Note: duplicate its value here to cope with circular dependencies among
@@ -649,18 +650,11 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
     (name "rust")
     (version "1.23.0")
     (source (rust-source version "14fb8vhjzsxlbi6yrn1r6fl5dlbdd1m92dn5zj5gmzfwf4w9ar3l"))
+    ;; Use rust-bootstrap@1.22 package to build rust 1.23
     (native-inputs
-     `(("bison" ,bison) ; For the tests
-       ("cmake" ,cmake)
-       ("flex" ,flex) ; For the tests
-       ("gdb" ,gdb)   ; For the tests
-       ("git" ,git)
-       ("procps" ,procps) ; For the tests
-       ("python-2" ,python-2)
-       ("rustc-bootstrap" ,rust-bootstrap)
-       ("cargo-bootstrap" ,rust-bootstrap "cargo")
-       ("pkg-config" ,pkg-config) ; For "cargo"
-       ("which" ,which)))
+     (alist-replace "cargo-bootstrap" (list rust-bootstrap "cargo")
+                    (alist-replace "rustc-bootstrap" (list rust-bootstrap)
+                                   (package-native-inputs rust-1.20))))
     (arguments
      (substitute-keyword-arguments (package-arguments rust-1.20)
        ((#:phases phases)
@@ -699,10 +693,6 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
           #:patches '("rust-1.25-accept-more-detailed-gdb-lines.patch"))))
     (package
       (inherit base-rust)
-      (inputs
-       ;; Use LLVM 6.0
-       (alist-replace "llvm" (list llvm)
-                      (package-inputs base-rust)))
       (arguments
        (substitute-keyword-arguments (package-arguments base-rust)
          ((#:phases phases)
@@ -713,14 +703,9 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                    ;; This test wants to update the crate index.
                    (("fn no_index_update") "#[ignore]\nfn no_index_update"))
                  #t))
-             (add-after 'configure 'enable-codegen-tests
-               (lambda _
-                 (substitute* "config.toml"
-                   (("codegen-tests = false") ""))
-                 #t))
              ;; FIXME: Re-enable this test if it's indeed supposed to work.
              ;; See <https://github.com/rust-lang/rust/issues/54178>.
-             (add-after 'enable-codegen-tests 'disable-nil-enum-test
+             (add-after 'configure 'disable-nil-enum-test
                (lambda _
                  (substitute* "src/test/debuginfo/nil-enum.rs"
                    (("ignore-lldb") "ignore-gdb"))
@@ -795,7 +780,8 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                                     #:patches
                                     '("rust-coresimd-doctest.patch"
                                       "rust-bootstrap-stage0-test.patch"
-                                      "rust-1.25-accept-more-detailed-gdb-lines.patch"))))
+                                      "rust-1.25-accept-more-detailed-gdb-lines.patch"
+                                      "rust-mdbook-Support-reproducible-builds-by-forcing-window.search.patch"))))
     (package
       (inherit base-rust)
       (arguments
-- 
2.19.0

  reply	other threads:[~2018-10-16 18:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 18:00 [bug#33066] [PATCH 0/2] Workaround rust reproducibility issues Nikolai Merinov
2018-10-15 21:32 ` Nikolai Merinov [this message]
2018-10-17 11:14   ` [bug#33066] [PATCH 1/2] gnu: rust: workaround rust 1.25-27 " Danny Milosavljevic
2018-10-19 19:44     ` Nikolai Merinov
2018-10-19 20:58       ` [bug#33066] [PATCHv3] " Nikolai Merinov
2018-10-21  7:28         ` Nikolai Merinov
2018-10-24 19:43           ` Danny Milosavljevic
2018-10-25  5:44           ` Danny Milosavljevic
2018-10-26 11:40             ` Nikolai Merinov
2018-10-26 16:12               ` Danny Milosavljevic
2021-02-05 15:00                 ` bug#33066: [PATCH 0/2] Workaround rust " Maxim Cournoyer
2018-10-15 21:37 ` [bug#33066] [PATCH 2/2] gnu: rust: add rust 1.28 and rust 1.29 packages Nikolai Merinov
2018-10-17 11:15   ` Danny Milosavljevic
2018-10-17 14:14   ` Joe Hillenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zy1u5ec.fsf@member.fsf.org \
    --to=nikolai.merinov@member.fsf.org \
    --cc=33066@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.