[PATCH] Update opam and dune

DoneSubmitted by Julien Lepiller.
Details
2 participants
  • Julien Lepiller
  • Xinglu Chen
Owner
unassigned
Severity
normal
J
J
Julien Lepiller wrote on 9 Aug 2021 04:14
(address . guix-patches@gnu.org)
20210809041444.613748a7@tachikoma.lepiller.eu
Hi Guix!

This small series updates opam and dune. Opam was surprisingly
difficult to update, after the switch to dune, but I had to update it
because the previous version we had doesn't build with the new dune.

The most difficult part was making the tests pass, as they require
network access. For some of them, I was able to download the files in
advance (see opam-repo in the inputs), and change the tests to use
that, fix shebangs, ... I still had to disable three tests: one that
runs opam and let it clone a git repository, one that fails only
because of a difference in text formating (it's expected to be on one
line, but actually is nicely formated), and one that compares a
generated dune file with the one that was just modified.

also ocaml-markup fails with the new dune, so I updated it to the
latest version.
From 8b17bf14e9892b26b049c530365c6a41b1231838 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 9 Aug 2021 03:57:38 +0200
Subject: [PATCH 1/4] gnu: ocaml-markup: Update to 1.0.2.

* gnu/packages/ocaml.scm (ocaml-markup): Update to 1.0.2.
---
gnu/packages/ocaml.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 112751ddec..923d7b1704 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -6432,7 +6432,7 @@ the full Core is not available, such as in Javascript.")
 (define-public ocaml-markup
   (package
     (name "ocaml-markup")
-    (version "1.0.0")
+    (version "1.0.2")
     (home-page "https://github.com/aantron/markup.ml")
     (source
      (origin
@@ -6443,7 +6443,7 @@ the full Core is not available, such as in Javascript.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "09hkrf9pw6hpb9j06p5bddklpnjwdjpqza3bx2179l970yl67an9"))))
+         "1kvqwrrcrys5d0kzdwxcj66jpi6sdhfas4pcg02pixx92q87vhqm"))))
     (build-system dune-build-system)
     (arguments
      `(#:package "markup"))
-- 
2.32.0
From d76314465a79fe531c05f3849f5e609c175362aa Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 9 Aug 2021 03:24:08 +0200
Subject: [PATCH 2/4] gnu: ocaml-opam-file-format: Update to 2.1.3.

* gnu/packages/ocaml.scm (ocaml-opam-file-format): Update to 2.1.3.
---
gnu/packages/ocaml.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 923d7b1704..11f7eff267 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -747,7 +747,7 @@ let () = String.split_on_char ':' (Sys.getenv \"OCAMLPATH\")
 (define-public ocaml-opam-file-format
   (package
     (name "ocaml-opam-file-format")
-    (version "2.0.0")
+    (version "2.1.3")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -756,7 +756,7 @@ let () = String.split_on_char ':' (Sys.getenv \"OCAMLPATH\")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0fqb99asnair0043hhc8r158d6krv5nzvymd0xwycr5y72yrp0hv"))))
+                "1fxhppdmrysr2nb5z3c448h17np48f3ga9jih33acj78r4rdblcs"))))
     (build-system ocaml-build-system)
     (arguments
      `(#:tests? #f; No tests
-- 
2.32.0
From 66cc97fb59324387a3d829e1dbe7382e5511fe6a Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 9 Aug 2021 03:20:06 +0200
Subject: [PATCH 3/4] gnu: opam: Update to 2.1.0.

* gnu/packages/ocaml.scm (opam): Update to 2.1.0.
---
gnu/packages/ocaml.scm | 158 +++++++++++++++++++++++------------------
1 file changed, 89 insertions(+), 69 deletions(-)

Toggle diff (189 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 11f7eff267..230d9d1e03 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -77,6 +77,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web)
   #:use-module (gnu packages web-browsers)
@@ -775,7 +776,7 @@ the opam file format.")
 (define-public opam
   (package
     (name "opam")
-    (version "2.0.8")
+    (version "2.1.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -784,78 +785,97 @@ the opam file format.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1z0ls6xxa4ws5xw0am5gxmh5apnmyhgkcphrncp53w34j8sfydsj"))))
-    (build-system ocaml-build-system)
+                "12l7l4pbzy71k1yc7ym5aczajszvc9bqkdnfg8xhqc8ch8j1h1lj"))))
+    (build-system dune-build-system)
     (arguments
-     `(#:configure-flags
-       (list (string-append "SHELL="
-                            (assoc-ref %build-inputs "bash")
-                            "/bin/sh"))
+     `(#:test-target "."
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'pre-build
+           (lambda* (#:key inputs make-flags #:allow-other-keys)
+             (let ((bash (assoc-ref inputs "bash"))
+                   (bwrap (string-append (assoc-ref inputs "bubblewrap")
+                                         "/bin/bwrap")))
+               (substitute* "src/core/opamSystem.ml"
+                 (("\"/bin/sh\"")
+                  (string-append "\"" bash "/bin/sh\""))
+                 (("getconf")
+                  (which "getconf")))
+               ;; Use bwrap from the store directly.
+               (substitute* "src/state/shellscripts/bwrap.sh"
+                 (("-v bwrap") (string-append "-v " bwrap))
+                 (("exec bwrap") (string-append "exec " bwrap))
+                 ;; Mount /gnu and /run/current-system in the
+                 ;; isolated environment when building with opam.
+                 ;; This is necessary for packages to find external
+                 ;; dependencies, such as a C compiler, make, etc...
+                 (("^add_sys_mounts /usr")
+                  "add_sys_mounts /gnu /run/current-system /usr"))
+               (substitute* "src/client/opamInitDefaults.ml"
+                 (("\"bwrap\"") (string-append "\"" bwrap "\""))))))
+         (add-before 'check 'prepare-checks
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Opam tests need to run an isolated environment from a writable
+             ;; home directory.
+             (mkdir-p "test-home")
+             (setenv "HOME" (string-append (getcwd) "/test-home"))
 
-       ;; For some reason, 'ocp-build' needs $TERM to be set.
-       #:make-flags
-       (list "TERM=screen"
-             (string-append "SHELL="
-                            (assoc-ref %build-inputs "bash")
-                            "/bin/sh"))
-
-       #:test-target "tests"
-
-       #:phases (modify-phases %standard-phases
-                 (add-before 'build 'pre-build
-                   (lambda* (#:key inputs make-flags #:allow-other-keys)
-                     (let ((bash (assoc-ref inputs "bash"))
-                           (bwrap (string-append (assoc-ref inputs "bubblewrap")
-                                                 "/bin/bwrap")))
-                       (substitute* "src/core/opamSystem.ml"
-                         (("\"/bin/sh\"")
-                          (string-append "\"" bash "/bin/sh\""))
-                         (("getconf")
-                          (which "getconf")))
-                       ;; Use bwrap from the store directly.
-                       (substitute* "src/state/shellscripts/bwrap.sh"
-                         (("-v bwrap") (string-append "-v " bwrap))
-                         (("exec bwrap") (string-append "exec " bwrap))
-                         ;; Mount /gnu and /run/current-system in the
-                         ;; isolated environment when building with opam.
-                         ;; This is necessary for packages to find external
-                         ;; dependencies, such as a C compiler, make, etc...
-                         (("^add_sys_mounts /usr")
-                          "add_sys_mounts /gnu /run/current-system /usr"))
-                       (substitute* "src/client/opamInitDefaults.ml"
-                         (("\"bwrap\"") (string-append "\"" bwrap "\"")))
-                       ;; Generating the documentation needs write access
-                       (for-each
-                         (lambda (f) (chmod f #o644))
-                         (find-files "doc" "."))
-                       #t)))
-                 (add-before 'check 'pre-check
-                   (lambda _
-                     ;; The "repo" test attempts to open some of these files O_WRONLY
-                     ;; and fails with a bogus "OpamSystem.File_not_found" otherwise.
-                     (for-each
-                      (lambda (f) (chmod f #o644))
-                      (find-files "tests/packages" "\\.opam$"))
-
-                     (substitute* "tests/Makefile"
-                       (("/usr/bin/printf")
-                        (which "printf"))
-                       ;; By default tests run twice: once with a "local" repository
-                       ;; and once with a git repository: disable the git tests to
-                       ;; avoid the dependency.
-                       (("all: local git")
-                        "all: local"))
-                     #t)))))
+             ;; Opam tests require data from opam-repository. Instead of
+             ;; downloading them with wget from the guix environment, copy the
+             ;; content to the expected directory.
+             (substitute* "tests/reftests/dune.inc"
+               (("tar -C.*opam-archive-([0-9a-f]*)[^)]*" _ commit)
+                (string-append "rmdir %{targets}) (run cp -r "
+                               (assoc-ref inputs (string-append "opam-repo-" commit))
+                               "/ %{targets}) (run chmod +w -R %{targets}"))
+               (("wget[^)]*") "touch %{targets}")
+               ;; Disable a failing test because of different line wrapping
+               (("diff cli-versioning.test cli-versioning.out") "run true")
+               ;; Disable a failing test because it tries to clone a git
+               ;; repository from inside bwrap
+               (("diff upgrade-format.test upgrade-format.out") "run true"))
+             (substitute* "tests/reftests/dune"
+               ;; Because of our changes to the previous file, we cannot check
+               ;; it can be regenerated
+               (("diff dune.inc dune.inc.gen") "run true"))
+             ;; Ensure we can run the generated build.sh (no /bin/sh)
+             (substitute* '("tests/reftests/legacy-local.test"
+                            "tests/reftests/legacy-git.test")
+               (("#! ?/bin/sh") (string-append "#!" (assoc-ref inputs "bash")
+                                               "/bin/sh")))
+             (substitute* "tests/reftests/testing-env"
+               (("OPAMSTRICT=1")
+                (string-append "OPAMSTRICT=1\nLIBRARY_PATH="
+                               (assoc-ref inputs "libc") "/lib"))))))))
     (native-inputs
-     `(("dune" ,dune)
-       ("ocaml-cppo" ,ocaml-cppo)
+      (let ((opam-repo (lambda (commit hash)
+                         (origin
+                           (method git-fetch)
+                           (uri (git-reference
+                                  (url "https://github.com/ocaml/opam-repository")
+                                  (commit commit)))
+                           (file-name (git-file-name "opam-repo" commit))
+                           (sha256 (base32 hash))))))
+       `(("dune" ,dune)
+         ("ocaml-cppo" ,ocaml-cppo)
 
-       ;; For tests.
-       ("openssl" ,openssl)
-       ("python" ,python-wrapper)
-       ("rsync" ,rsync)
-       ("unzip" ,unzip)
-       ("which" ,which)))
+         ;; For tests.
+         ("git" ,git)
+         ("openssl" ,openssl)
+         ("python" ,python-wrapper)
+         ("rsync" ,rsync)
+         ("unzip" ,unzip)
+         ("which" ,which)
+
+         ;; Data for tests
+         ("opam-repo-009e00fa" ,(opam-repo "009e00fa86300d11c311309a2544e5c6c3eb8de2"
+                                           "1wwy0rwrsjf4q10j1rh1dazk32fbzhzy6f7zl6qmndidx9b1bq7w"))
+         ("opam-repo-ad4dd344" ,(opam-repo "ad4dd344fe5cd1cab49ced49d6758a9844549fb4"
+                                           "1a1qj47kj8xjdnc4zc50ijrix1kym1n7k20n3viki80a7518baw8"))
+         ("opam-repo-c1d23f0e" ,(opam-repo "c1d23f0e17ec83a036ebfbad1c78311b898a2ca0"
+                                           "0j9abisx3ifzm66ci3p45mngmz4f0fx7yd9jjxrz3f8w5jffc9ii"))
+         ("opam-repo-f372039d" ,(opam-repo "f372039db86a970ef3e662adbfe0d4f5cd980701"
+                                           "0ld7fcry6ss6fmrpswvr6bikgx299w97h0gwrjjh7kd7rydsjdws")))))
     (inputs
      `(("ocaml" ,ocaml)
        ("ncurses" ,ncurses)
-- 
2.32.0
From 3fe708407a881e3e5e306e4461e44d31bb0e9c9d Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sun, 8 Aug 2021 22:53:27 +0200
Subject: [PATCH 4/4] gnu: ocaml-dune: Update to 2.9.0.

* gnu/packages/ocaml.scm (dune): Update to 2.9.0.
---
gnu/packages/ocaml.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 230d9d1e03..efbd03aa56 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1625,7 +1625,7 @@ full_split, cut, rcut, etc..")
 (define dune-bootstrap
   (package
     (name "dune")
-    (version "2.8.5")
+    (version "2.9.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -1634,7 +1634,7 @@ full_split, cut, rcut, etc..")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0a1jj6njzsfjgklsirs6a79079wg4jhy6n888vg3dgp44awwq5jn"))))
+                "01np4jy0f3czkpzkl38k9b4lsh41qk52ldaqxl98mgigyzhx4w0b"))))
     (build-system ocaml-build-system)
     (arguments
      `(#:tests? #f; require odoc
-- 
2.32.0
X
X
Xinglu Chen wrote on 9 Aug 2021 12:15
87fsviq5yb.fsf@yoctocell.xyz
On Mon, Aug 09 2021, Julien Lepiller wrote:

Toggle quote (155 lines)
> Hi Guix!
>
> This small series updates opam and dune. Opam was surprisingly
> difficult to update, after the switch to dune, but I had to update it
> because the previous version we had doesn't build with the new dune.
>
> The most difficult part was making the tests pass, as they require
> network access. For some of them, I was able to download the files in
> advance (see opam-repo in the inputs), and change the tests to use
> that, fix shebangs, ... I still had to disable three tests: one that
> runs opam and let it clone a git repository, one that fails only
> because of a difference in text formating (it's expected to be on one
> line, but actually is nicely formated), and one that compares a
> generated dune file with the one that was just modified.
>
> also ocaml-markup fails with the new dune, so I updated it to the
> latest version.
> From 8b17bf14e9892b26b049c530365c6a41b1231838 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Mon, 9 Aug 2021 03:57:38 +0200
> Subject: [PATCH 1/4] gnu: ocaml-markup: Update to 1.0.2.
>
> * gnu/packages/ocaml.scm (ocaml-markup): Update to 1.0.2.
> ---
> gnu/packages/ocaml.scm | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index 112751ddec..923d7b1704 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -6432,7 +6432,7 @@ the full Core is not available, such as in Javascript.")
> (define-public ocaml-markup
> (package
> (name "ocaml-markup")
> - (version "1.0.0")
> + (version "1.0.2")
> (home-page "https://github.com/aantron/markup.ml")
> (source
> (origin
> @@ -6443,7 +6443,7 @@ the full Core is not available, such as in Javascript.")
> (file-name (git-file-name name version))
> (sha256
> (base32
> - "09hkrf9pw6hpb9j06p5bddklpnjwdjpqza3bx2179l970yl67an9"))))
> + "1kvqwrrcrys5d0kzdwxcj66jpi6sdhfas4pcg02pixx92q87vhqm"))))
> (build-system dune-build-system)
> (arguments
> `(#:package "markup"))
> --
> 2.32.0
>
> From d76314465a79fe531c05f3849f5e609c175362aa Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Mon, 9 Aug 2021 03:24:08 +0200
> Subject: [PATCH 2/4] gnu: ocaml-opam-file-format: Update to 2.1.3.
>
> * gnu/packages/ocaml.scm (ocaml-opam-file-format): Update to 2.1.3.
> ---
> gnu/packages/ocaml.scm | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index 923d7b1704..11f7eff267 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -747,7 +747,7 @@ let () = String.split_on_char ':' (Sys.getenv \"OCAMLPATH\")
> (define-public ocaml-opam-file-format
> (package
> (name "ocaml-opam-file-format")
> - (version "2.0.0")
> + (version "2.1.3")
> (source (origin
> (method git-fetch)
> (uri (git-reference
> @@ -756,7 +756,7 @@ let () = String.split_on_char ':' (Sys.getenv \"OCAMLPATH\")
> (file-name (git-file-name name version))
> (sha256
> (base32
> - "0fqb99asnair0043hhc8r158d6krv5nzvymd0xwycr5y72yrp0hv"))))
> + "1fxhppdmrysr2nb5z3c448h17np48f3ga9jih33acj78r4rdblcs"))))
> (build-system ocaml-build-system)
> (arguments
> `(#:tests? #f; No tests
> --
> 2.32.0
>
> From 66cc97fb59324387a3d829e1dbe7382e5511fe6a Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Mon, 9 Aug 2021 03:20:06 +0200
> Subject: [PATCH 3/4] gnu: opam: Update to 2.1.0.
>
> * gnu/packages/ocaml.scm (opam): Update to 2.1.0.
> ---
> gnu/packages/ocaml.scm | 158 +++++++++++++++++++++++------------------
> 1 file changed, 89 insertions(+), 69 deletions(-)
>
> diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
> index 11f7eff267..230d9d1e03 100644
> --- a/gnu/packages/ocaml.scm
> +++ b/gnu/packages/ocaml.scm
> @@ -77,6 +77,7 @@
> #:use-module (gnu packages texinfo)
> #:use-module (gnu packages time)
> #:use-module (gnu packages tls)
> + #:use-module (gnu packages version-control)
> #:use-module (gnu packages virtualization)
> #:use-module (gnu packages web)
> #:use-module (gnu packages web-browsers)
> @@ -775,7 +776,7 @@ the opam file format.")
> (define-public opam
> (package
> (name "opam")
> - (version "2.0.8")
> + (version "2.1.0")
> (source (origin
> (method git-fetch)
> (uri (git-reference
> @@ -784,78 +785,97 @@ the opam file format.")
> (file-name (git-file-name name version))
> (sha256
> (base32
> - "1z0ls6xxa4ws5xw0am5gxmh5apnmyhgkcphrncp53w34j8sfydsj"))))
> - (build-system ocaml-build-system)
> + "12l7l4pbzy71k1yc7ym5aczajszvc9bqkdnfg8xhqc8ch8j1h1lj"))))
> + (build-system dune-build-system)
> (arguments
> - `(#:configure-flags
> - (list (string-append "SHELL="
> - (assoc-ref %build-inputs "bash")
> - "/bin/sh"))
> + `(#:test-target "."
> + #:phases
> + (modify-phases %standard-phases
> + (add-before 'build 'pre-build
> + (lambda* (#:key inputs make-flags #:allow-other-keys)
> + (let ((bash (assoc-ref inputs "bash"))
> + (bwrap (string-append (assoc-ref inputs "bubblewrap")
> + "/bin/bwrap")))
> + (substitute* "src/core/opamSystem.ml"
> + (("\"/bin/sh\"")
> + (string-append "\"" bash "/bin/sh\""))
> + (("getconf")
> + (which "getconf")))
> + ;; Use bwrap from the store directly.
> + (substitute* "src/state/shellscripts/bwrap.sh"
> + (("-v bwrap") (string-append "-v " bwrap))
> + (("exec bwrap") (string-append "exec " bwrap))
> + ;; Mount /gnu and /run/current-system in the
> + ;; isolated environment when building with opam.
> + ;; This is necessary for packages to find external
> + ;; dependencies, such as a C compiler, make, etc...
> + (("^add_sys_mounts /usr")
> + "add_sys_mounts /gnu /run/current-system /usr"))

/gnu should be replaced by (%store-directory) (from (gnu build utils)), in
case the store isn’t mounted at /gnu/store. :-)

Toggle quote (113 lines)
> + (substitute* "src/client/opamInitDefaults.ml"
> + (("\"bwrap\"") (string-append "\"" bwrap "\""))))))
> + (add-before 'check 'prepare-checks
> + (lambda* (#:key inputs #:allow-other-keys)
> + ;; Opam tests need to run an isolated environment from a writable
> + ;; home directory.
> + (mkdir-p "test-home")
> + (setenv "HOME" (string-append (getcwd) "/test-home"))
>
> - ;; For some reason, 'ocp-build' needs $TERM to be set.
> - #:make-flags
> - (list "TERM=screen"
> - (string-append "SHELL="
> - (assoc-ref %build-inputs "bash")
> - "/bin/sh"))
> -
> - #:test-target "tests"
> -
> - #:phases (modify-phases %standard-phases
> - (add-before 'build 'pre-build
> - (lambda* (#:key inputs make-flags #:allow-other-keys)
> - (let ((bash (assoc-ref inputs "bash"))
> - (bwrap (string-append (assoc-ref inputs "bubblewrap")
> - "/bin/bwrap")))
> - (substitute* "src/core/opamSystem.ml"
> - (("\"/bin/sh\"")
> - (string-append "\"" bash "/bin/sh\""))
> - (("getconf")
> - (which "getconf")))
> - ;; Use bwrap from the store directly.
> - (substitute* "src/state/shellscripts/bwrap.sh"
> - (("-v bwrap") (string-append "-v " bwrap))
> - (("exec bwrap") (string-append "exec " bwrap))
> - ;; Mount /gnu and /run/current-system in the
> - ;; isolated environment when building with opam.
> - ;; This is necessary for packages to find external
> - ;; dependencies, such as a C compiler, make, etc...
> - (("^add_sys_mounts /usr")
> - "add_sys_mounts /gnu /run/current-system /usr"))
> - (substitute* "src/client/opamInitDefaults.ml"
> - (("\"bwrap\"") (string-append "\"" bwrap "\"")))
> - ;; Generating the documentation needs write access
> - (for-each
> - (lambda (f) (chmod f #o644))
> - (find-files "doc" "."))
> - #t)))
> - (add-before 'check 'pre-check
> - (lambda _
> - ;; The "repo" test attempts to open some of these files O_WRONLY
> - ;; and fails with a bogus "OpamSystem.File_not_found" otherwise.
> - (for-each
> - (lambda (f) (chmod f #o644))
> - (find-files "tests/packages" "\\.opam$"))
> -
> - (substitute* "tests/Makefile"
> - (("/usr/bin/printf")
> - (which "printf"))
> - ;; By default tests run twice: once with a "local" repository
> - ;; and once with a git repository: disable the git tests to
> - ;; avoid the dependency.
> - (("all: local git")
> - "all: local"))
> - #t)))))
> + ;; Opam tests require data from opam-repository. Instead of
> + ;; downloading them with wget from the guix environment, copy the
> + ;; content to the expected directory.
> + (substitute* "tests/reftests/dune.inc"
> + (("tar -C.*opam-archive-([0-9a-f]*)[^)]*" _ commit)
> + (string-append "rmdir %{targets}) (run cp -r "
> + (assoc-ref inputs (string-append "opam-repo-" commit))
> + "/ %{targets}) (run chmod +w -R %{targets}"))
> + (("wget[^)]*") "touch %{targets}")
> + ;; Disable a failing test because of different line wrapping
> + (("diff cli-versioning.test cli-versioning.out") "run true")
> + ;; Disable a failing test because it tries to clone a git
> + ;; repository from inside bwrap
> + (("diff upgrade-format.test upgrade-format.out") "run true"))
> + (substitute* "tests/reftests/dune"
> + ;; Because of our changes to the previous file, we cannot check
> + ;; it can be regenerated
> + (("diff dune.inc dune.inc.gen") "run true"))
> + ;; Ensure we can run the generated build.sh (no /bin/sh)
> + (substitute* '("tests/reftests/legacy-local.test"
> + "tests/reftests/legacy-git.test")
> + (("#! ?/bin/sh") (string-append "#!" (assoc-ref inputs "bash")
> + "/bin/sh")))
> + (substitute* "tests/reftests/testing-env"
> + (("OPAMSTRICT=1")
> + (string-append "OPAMSTRICT=1\nLIBRARY_PATH="
> + (assoc-ref inputs "libc") "/lib"))))))))
> (native-inputs
> - `(("dune" ,dune)
> - ("ocaml-cppo" ,ocaml-cppo)
> + (let ((opam-repo (lambda (commit hash)
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/ocaml/opam-repository")
> + (commit commit)))
> + (file-name (git-file-name "opam-repo" commit))
> + (sha256 (base32 hash))))))
> + `(("dune" ,dune)
> + ("ocaml-cppo" ,ocaml-cppo)
>
> - ;; For tests.
> - ("openssl" ,openssl)
> - ("python" ,python-wrapper)
> - ("rsync" ,rsync)
> - ("unzip" ,unzip)
> - ("which" ,which)))
> + ;; For tests.
> + ("git" ,git)

Maybe ‘git-minimal’ would be enough.

The rest LGTM, I am not super familiar with Opam, though.

Thank you for working on this!
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmERAFwVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5ClUQAKqo9E3rnD+7Ns/YD3G7tvhFNlN/
I5w882o5eDM05XPki0TIiRBeAt3zER13lamp+KYzi9RRTlPH6WKej9GReTfndY9p
RklsiUQrAPCzbyOj7d+WBLjuCjEvRCeTUFrUGrmUqH6ThTnW+FAYJXMvkWrNpzIh
T0lZiFpQtCzi9gp6ckIGjKPGDGOlM6DyW9y+q5Nt30fSXtHU4PiyeLbXGpewKa8G
EhmmvYxAgr/+e+MqW25ewvvXLK9A9y55RWowrXSPoN3o6tCVnYgmKr0vU6hxg1WJ
AnAEIODHEwpSGosfjLQ8g99PKFHTh3l8/TV0Lo7lI4nR2bNo1RJCPthrJrto3Z4/
Ch3DvI8aLKYgLU8n2hLsUIDa5uT6jiNhr5H+3sfczhhxUMZSkO2Vv/uSOIkJOvNv
9T8c473fia8FhaOMYseYRVR+4NGyH1GXMkWEoC7gMHg/CXurwnmM8nHDtNx3tJbb
E4ZF2Vex0rIDx1fxSYc3Hi5ABowaCIDVDCc1TPL1znIErZ72DCBMHMXb//y2zrfF
rjH1idQLer/V7TZ2yz7GyWuh/PnRejJikKRYbA03X7v6tJBX1SQpx2qRI7EM465S
M6dCZpcckETvgcWGHt2aVud/sCHJpve3BldlnH+8U91OKQBp5u4QaEZtIV8f9sRo
fEYVH79EH1LUhlD+
=1BZw
-----END PGP SIGNATURE-----

J
J
Julien Lepiller wrote on 21 Aug 2021 00:08
(address . 49950-done@debbugs.gnu.org)
20210821000841.37963041@tachikoma.lepiller.eu
Le Mon, 9 Aug 2021 04:14:44 +0200,
Julien Lepiller <julien@lepiller.eu> a écrit :

Toggle quote (18 lines)
> Hi Guix!
>
> This small series updates opam and dune. Opam was surprisingly
> difficult to update, after the switch to dune, but I had to update it
> because the previous version we had doesn't build with the new dune.
>
> The most difficult part was making the tests pass, as they require
> network access. For some of them, I was able to download the files in
> advance (see opam-repo in the inputs), and change the tests to use
> that, fix shebangs, ... I still had to disable three tests: one that
> runs opam and let it clone a git repository, one that fails only
> because of a difference in text formating (it's expected to be on one
> line, but actually is nicely formated), and one that compares a
> generated dune file with the one that was just modified.
>
> also ocaml-markup fails with the new dune, so I updated it to the
> latest version.

Pushed to master as f916c827092aca86bd2581299f0335bcbae64f35 to
777ce1485749cc3dbe178fcc1e0654a7e74900c5.
Closed
?
Your comment

This issue is archived.

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