From patchwork Sat Jul 15 17:38:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pukkamustard X-Patchwork-Id: 51729 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E436227BBEC; Sat, 15 Jul 2023 18:40:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A543F27BBE2 for ; Sat, 15 Jul 2023 18:40:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKjFb-0001NB-Os; Sat, 15 Jul 2023 13:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKjFW-0001LR-4Q for guix-patches@gnu.org; Sat, 15 Jul 2023 13:40:08 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKjFV-0000Sk-BH for guix-patches@gnu.org; Sat, 15 Jul 2023 13:40:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKjFV-0006xG-6F; Sat, 15 Jul 2023 13:40:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64249] [PATCH ocaml-team v2 7/7] WIP: gnu: opam: Update to 2.1.5. Resent-From: pukkamustard Original-Sender: "Debbugs-submit" Resent-CC: julien@lepiller.eu, pukkamustard@posteo.net, guix-patches@gnu.org Resent-Date: Sat, 15 Jul 2023 17:40:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64249 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64249@debbugs.gnu.org Cc: pukkamustard , Julien Lepiller , pukkamustard X-Debbugs-Original-Xcc: Julien Lepiller , pukkamustard Received: via spool by 64249-submit@debbugs.gnu.org id=B64249.168944275526586 (code B ref 64249); Sat, 15 Jul 2023 17:40:05 +0000 Received: (at 64249) by debbugs.gnu.org; 15 Jul 2023 17:39:15 +0000 Received: from localhost ([127.0.0.1]:45979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKjEg-0006ue-Lm for submit@debbugs.gnu.org; Sat, 15 Jul 2023 13:39:15 -0400 Received: from mout02.posteo.de ([185.67.36.66]:54467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKjEZ-0006ss-JQ for 64249@debbugs.gnu.org; Sat, 15 Jul 2023 13:39:09 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 14360240104 for <64249@debbugs.gnu.org>; Sat, 15 Jul 2023 19:39:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1689442742; bh=iDSmw+MJr8Ri8I8yFPcmMhBe9JvJWmHvF18hqmczPxM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=B26IPfcO8ALMpk1KCc48tQbA+WN4TANGpTkF4MG48orKL1GaIijBdIIAVO0dDJTOt RzAyhdKmiWZRwI0deynkZ3pDcRqII/JiUfidmLKIpzWAc9XvNXA5ba0yw1xmazc90B L6pdgfrTJeO8YfDTZqxOnggX9qVkF0UMQrWyrOcguIQduUq0AqOZC7A/hO+sx/KBoD dOx1zZNU/evftJ1dxWPAsnd7Bev0PeNEwFbaQvFkNoXwNBT925zG4f6Aqo40ljwcaz bjm7VrZ3ISpHHToSFO5khzenxrBo/epNUKkl9zpupUfasa0mRyZCuKko5Ijm1yj7SR LJL9cOB/nW/gw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R3FvT4Rqnz9rxQ; Sat, 15 Jul 2023 19:39:01 +0200 (CEST) From: pukkamustard Date: Sat, 15 Jul 2023 17:38:34 +0000 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches --- gnu/packages/ocaml.scm | 220 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index 289b86cc27..d96af0ee2d 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -833,7 +833,225 @@ (define-public ocaml-opam-file-format ;; With static-linking exception (license license:lgpl2.1+))) +(define-public ocaml-opam-core + (package + (name "ocaml-opam-core") + (version "2.1.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ocaml/opam") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0ckd87rcmcz11iyhhm5qnmy27jbdffx6n1fr06hvrqqrzi00jljh")))) + (build-system dune-build-system) + (native-inputs (list ocaml-cppo)) + (propagated-inputs (list ocaml-graph ocaml-re)) + (arguments `(#:package "opam-core" + ;; tests require the opam-client library that is not yet available + #:tests? #f)) + (home-page "https://opam.ocaml.org/") + (synopsis "Package manager for OCaml") + (description + "OPAM is a tool to manage OCaml packages. It supports multiple +simultaneous compiler installations, flexible package constraints, and a +Git-friendly development workflow.") + ;; The 'LICENSE' file waives some requirements compared to LGPLv3. + (license license:lgpl3))) + +(define-public ocaml-opam-format + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-format") + (native-inputs '()) + (propagated-inputs (list ocaml-opam-core + ocaml-opam-file-format + ocaml-re)) + (arguments `(#:package "opam-format" + ;; tests require the opam-client library that is not yet available + #:tests? #f)))) + +(define-public ocaml-opam-repository + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-repository") + (native-inputs '()) + (propagated-inputs (list ocaml-opam-format)) + (arguments `(#:package "opam-repository" + ;; tests require the opam-client library that is not yet available + #:tests? #f)))) + +(define-public ocaml-opam-state + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-state") + (native-inputs '()) + (propagated-inputs (list ocaml-opam-repository)) + (arguments `(#:package "opam-state" + ;; tests require the opam-client library that is not yet available + #:tests? #f)))) + +(define-public ocaml-opam-solver + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-solver") + (native-inputs '()) + (propagated-inputs (list ocaml-opam-format + ocaml-mccs + ocaml-dose3)) + (arguments `(#:package "opam-solver" + ;; tests require the opam-client library that is not yet available + #:tests? #f)))) + +(define-public ocaml-opam-client + (package + (inherit ocaml-opam-core) + (name "ocaml-opam-client") + (native-inputs '()) + (propagated-inputs '()) + (inputs (list ocaml-opam-state + ocaml-opam-solver + ocaml-base64-boot + ocaml-opam-repository + ocaml-re + ocaml-cmdliner)) + (arguments `(#:package "opam-client" + ;; TODO + #:tests? #f)))) + (define-public opam + (package + (inherit ocaml-opam-core) + (name "opam") + (arguments + `(#:package "opam" + #: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 (search-input-file inputs "/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")) + (with-output-to-file (string-append (getcwd) "/test-home/.gitconfig") + (lambda _ + (display "[user] +email = guix@localhost.none +name = Guix Builder") + (newline))) + + ;; 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 it tries to clone a git + ;; repository from inside bwrap + (("diff upgrade-format.test upgrade-format.out") "run true") + ;; Disable a failing test because it tries to figure out which + ;; distro this is, and it doesn't know Guix + (("diff pin.unix.test pin.unix.out") "run true") + ;; Disable a failing test because of a failed expansion + (("diff opamroot-versions.test opamroot-versions.out") "run true") + ;; Disable a failing test, probably because the repository we + ;; replaced is not as expected + (("diff opamrt-big-upgrade.test opamrt-big-upgrade.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 "#!" + (search-input-file inputs "/bin/sh")))) + (substitute* "tests/reftests/testing-env" + (("OPAMSTRICT=1") + (string-append "OPAMSTRICT=1\nLIBRARY_PATH=" + (assoc-ref inputs "libc") "/lib")))))))) + (native-inputs + (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)))))) + `(;; For tests. + ("bubblewrap" ,bubblewrap) + ("git" ,git-minimal/pinned) + ("openssl" ,openssl) + ("python" ,python-wrapper) + ("rsync" ,rsync) + ("unzip" ,unzip) + ("which" ,which) + + ("opam-repo-0070613707" ,(opam-repo "00706137074d536d2019d2d222fbe1bea929deda" + "1gv1vvmfscj7wirfv6qncp8pf81wygnpzjwd0lyqcxm7g8r8lb4w")) + ("opam-repo-009e00fa" ,(opam-repo "009e00fa86300d11c311309a2544e5c6c3eb8de2" + "1wwy0rwrsjf4q10j1rh1dazk32fbzhzy6f7zl6qmndidx9b1bq7w")) + ("opam-repo-7090735c" ,(opam-repo "7090735c9d1dd2dc481c4128c5ef4d3667238f15" + "1bccsgjhlp64lmvfjfn6viywf3x73ji75myg9ssf1ij1fkmabn0z")) + ("opam-repo-a5d7cdc0" ,(opam-repo "a5d7cdc0c91452b0aef4fa71c331ee5237f6dddd" + "0z7kawqisy07088p5xjxwpvmvzlbj1d9cgdipsj90yx7nc5qh369")) + ("opam-repo-ad4dd344" ,(opam-repo "ad4dd344fe5cd1cab49ced49d6758a9844549fb4" + "1a1qj47kj8xjdnc4zc50ijrix1kym1n7k20n3viki80a7518baw8")) + ("opam-repo-c1842d168d" ,(opam-repo "c1842d168de956caf06d7ac8588e65020d7594d8" + "142y1ac7sprygyh91shcp0zcyfxjjkshi9g44qgg4rx60rbsbhai")) + ("opam-repo-c1d23f0e" ,(opam-repo "c1d23f0e17ec83a036ebfbad1c78311b898a2ca0" + "0j9abisx3ifzm66ci3p45mngmz4f0fx7yd9jjxrz3f8w5jffc9ii")) + ("opam-repo-f372039d" ,(opam-repo "f372039db86a970ef3e662adbfe0d4f5cd980701" + "0ld7fcry6ss6fmrpswvr6bikgx299w97h0gwrjjh7kd7rydsjdws")) + ("opam-repo-11ea1cb" ,(opam-repo "11ea1cb6f2418b1f8a6679e4422771a04c9c3655" + "1s4p0wfn3bx97yvm8xvj3yhzv2pz0jwml68g2ybv37hj9mpbrsq0")) + ("opam-repo-297366c" ,(opam-repo "297366cd01c3aaf29b967bf0b34ccc7989d4d5b3" + "1ysg69gys37nc2cxivs2ikh6xp0gj85if4rcrr874mqb9z12dm0j")) + ("opam-repo-3235916" ,(opam-repo "3235916a162a59d7c82dac3fe24214975d48f1aa" + "1yf73rv2n740a4s9g7a9k4j91b4k7al88nwnw9cdw0k2ncbmr486")) + ("opam-repo-de897adf36c4230dfea812f40c98223b31c4521a" + ,(opam-repo "de897adf36c4230dfea812f40c98223b31c4521a" + "1m18x9gcwnbar8yv9sbfz8a3qpw412fp9cf4d6fb7syn0p0h96jw"))))) + (propagated-inputs '()) + (inputs (list ocaml-opam-client + ocaml-opam-state + ocaml-opam-solver + ocaml-base64-boot + ocaml-opam-repository + ocaml-re + ocaml-cmdliner)))) + +(define-public opam-2.1.3 (package (name "opam") (version "2.1.3") @@ -941,6 +1159,8 @@ (define-public opam ("which" ,which) ;; Data for tests + ("opam-repo-0070613707" ,(opam-repo "00706137074d536d2019d2d222fbe1bea929deda" + "1wwy0rwrsjf4q10j1rh1dbzk32fbzhzy5f7zl6qmndidx9b1bq7w")) ("opam-repo-009e00fa" ,(opam-repo "009e00fa86300d11c311309a2544e5c6c3eb8de2" "1wwy0rwrsjf4q10j1rh1dazk32fbzhzy6f7zl6qmndidx9b1bq7w")) ("opam-repo-7090735c" ,(opam-repo "7090735c9d1dd2dc481c4128c5ef4d3667238f15"