gnu: opam: Update to 2.1.0.

* gnu/packages/ocaml.scm (opam): Update to 2.1.0.
This commit is contained in:
Julien Lepiller 2021-08-09 03:20:06 +02:00
parent 43c0be8c6a
commit 3d3807a022
No known key found for this signature in database
GPG key ID: 53D457B2D636EE82

View file

@ -77,6 +77,7 @@ (define-module (gnu packages ocaml)
#:use-module (gnu packages texinfo) #:use-module (gnu packages texinfo)
#:use-module (gnu packages time) #:use-module (gnu packages time)
#:use-module (gnu packages tls) #:use-module (gnu packages tls)
#:use-module (gnu packages version-control)
#:use-module (gnu packages virtualization) #:use-module (gnu packages virtualization)
#:use-module (gnu packages web) #:use-module (gnu packages web)
#:use-module (gnu packages web-browsers) #:use-module (gnu packages web-browsers)
@ -775,7 +776,7 @@ (define-public ocaml-opam-file-format
(define-public opam (define-public opam
(package (package
(name "opam") (name "opam")
(version "2.0.8") (version "2.1.0")
(source (origin (source (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
@ -784,78 +785,99 @@ (define-public opam
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"1z0ls6xxa4ws5xw0am5gxmh5apnmyhgkcphrncp53w34j8sfydsj")))) "12l7l4pbzy71k1yc7ym5aczajszvc9bqkdnfg8xhqc8ch8j1h1lj"))))
(build-system ocaml-build-system) (build-system dune-build-system)
(arguments (arguments
`(#:configure-flags `(#:test-target "."
(list (string-append "SHELL=" #:phases
(assoc-ref %build-inputs "bash") (modify-phases %standard-phases
"/bin/sh")) (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")
(string-append "add_sys_mounts "
(%store-directory)
" /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. ;; Opam tests require data from opam-repository. Instead of
#:make-flags ;; downloading them with wget from the guix environment, copy the
(list "TERM=screen" ;; content to the expected directory.
(string-append "SHELL=" (substitute* "tests/reftests/dune.inc"
(assoc-ref %build-inputs "bash") (("tar -C.*opam-archive-([0-9a-f]*)[^)]*" _ commit)
"/bin/sh")) (string-append "rmdir %{targets}) (run cp -r "
(assoc-ref inputs (string-append "opam-repo-" commit))
#:test-target "tests" "/ %{targets}) (run chmod +w -R %{targets}"))
(("wget[^)]*") "touch %{targets}")
#:phases (modify-phases %standard-phases ;; Disable a failing test because of different line wrapping
(add-before 'build 'pre-build (("diff cli-versioning.test cli-versioning.out") "run true")
(lambda* (#:key inputs make-flags #:allow-other-keys) ;; Disable a failing test because it tries to clone a git
(let ((bash (assoc-ref inputs "bash")) ;; repository from inside bwrap
(bwrap (string-append (assoc-ref inputs "bubblewrap") (("diff upgrade-format.test upgrade-format.out") "run true"))
"/bin/bwrap"))) (substitute* "tests/reftests/dune"
(substitute* "src/core/opamSystem.ml" ;; Because of our changes to the previous file, we cannot check
(("\"/bin/sh\"") ;; it can be regenerated
(string-append "\"" bash "/bin/sh\"")) (("diff dune.inc dune.inc.gen") "run true"))
(("getconf") ;; Ensure we can run the generated build.sh (no /bin/sh)
(which "getconf"))) (substitute* '("tests/reftests/legacy-local.test"
;; Use bwrap from the store directly. "tests/reftests/legacy-git.test")
(substitute* "src/state/shellscripts/bwrap.sh" (("#! ?/bin/sh") (string-append "#!" (assoc-ref inputs "bash")
(("-v bwrap") (string-append "-v " bwrap)) "/bin/sh")))
(("exec bwrap") (string-append "exec " bwrap)) (substitute* "tests/reftests/testing-env"
;; Mount /gnu and /run/current-system in the (("OPAMSTRICT=1")
;; isolated environment when building with opam. (string-append "OPAMSTRICT=1\nLIBRARY_PATH="
;; This is necessary for packages to find external (assoc-ref inputs "libc") "/lib"))))))))
;; 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)))))
(native-inputs (native-inputs
`(("dune" ,dune) (let ((opam-repo (lambda (commit hash)
("ocaml-cppo" ,ocaml-cppo) (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. ;; For tests.
("openssl" ,openssl) ("git" ,git-minimal)
("python" ,python-wrapper) ("openssl" ,openssl)
("rsync" ,rsync) ("python" ,python-wrapper)
("unzip" ,unzip) ("rsync" ,rsync)
("which" ,which))) ("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 (inputs
`(("ocaml" ,ocaml) `(("ocaml" ,ocaml)
("ncurses" ,ncurses) ("ncurses" ,ncurses)