2015-03-08 01:48:38 -05:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
|
2016-03-22 23:40:38 -04:00
|
|
|
;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
|
mailmap: Update entries for Nikita.
* .mailmap: change email and name for Nikita.
* Makefile.am, doc/guix.texi, etc/completion/fish/guix.fish,
gnu/packages/accessibility.scm, gnu/packages/admin.scm,
gnu/packages/audio.scm, gnu/packages/autotools.scm, gnu/packages/cdrom.scm,
gnu/packages/check.scm, gnu/packages/cinnamon.scm,
gnu/packages/compression.scm, gnu/packages/crypto.scm,
gnu/packages/databases.scm, gnu/packages/django.scm, gnu/packages/dns.scm,
gnu/packages/elixir.scm, gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm,
gnu/packages/enlightenment.scm, gnu/packages/erlang.scm,
gnu/packages/fonts.scm, gnu/packages/fontutils.scm, gnu/packages/forth.scm,
gnu/packages/fvwm.scm, gnu/packages/games.scm, gnu/packages/gl.scm,
gnu/packages/gnome.scm, gnu/packages/gnunet.scm, gnu/packages/gnupg.scm,
gnu/packages/gtk.scm, gnu/packages/guile-wm.scm, gnu/packages/guile-xyz.scm,
gnu/packages/haskell-apps.scm, gnu/packages/haskell-check.scm,
gnu/packages/haskell-crypto.scm, gnu/packages/haskell-xyz.scm,
gnu/packages/haskell.scm, gnu/packages/image-viewers.scm,
gnu/packages/image.scm, gnu/packages/irc.scm, gnu/packages/language.scm,
gnu/packages/libcanberra.scm, gnu/packages/linux.scm,
gnu/packages/lisp-xyz.scm, gnu/packages/lisp.scm, gnu/packages/lolcode.scm,
gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/mail.scm,
gnu/packages/markup.scm, gnu/packages/mate.scm, gnu/packages/maths.scm,
gnu/packages/mc.scm, gnu/packages/messaging.scm, gnu/packages/music.scm,
gnu/packages/ncurses.scm, gnu/packages/networking.scm,
gnu/packages/nickle.scm, gnu/packages/openbox.scm, gnu/packages/pdf.scm,
gnu/packages/perl-check.scm, gnu/packages/perl.scm,
gnu/packages/python-compression.scm, gnu/packages/python-crypto.scm,
gnu/packages/python-web.scm, gnu/packages/python-xyz.scm,
gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/ruby.scm,
gnu/packages/rust.scm, gnu/packages/scheme.scm,
gnu/packages/serialization.scm, gnu/packages/shells.scm,
gnu/packages/ssh.scm, gnu/packages/suckless.scm, gnu/packages/tbb.scm,
gnu/packages/telephony.scm, gnu/packages/text-editors.scm,
gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tls.scm,
gnu/packages/tor.scm, gnu/packages/version-control.scm,
gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/web.scm,
gnu/packages/wm.scm, gnu/packages/xdisorg.scm, gnu/packages/xfce.scm,
gnu/packages/xml.scm, gnu/packages/xorg.scm, gnu/services/certbot.scm,
gnu/services/desktop.scm, gnu/services/version-control.scm,
gnu/services/web.scm, guix/import/hackage.scm, guix/licenses.scm: Likewise.
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2020-05-11 07:05:45 -04:00
|
|
|
;;; Copyright © 2016 Nikita <nikita@n0.is>
|
2018-08-07 12:00:16 -04:00
|
|
|
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
2019-06-05 15:05:36 -04:00
|
|
|
;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
|
2021-05-17 16:11:15 -04:00
|
|
|
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
2021-07-14 21:40:37 -04:00
|
|
|
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
2021-01-19 10:47:18 -05:00
|
|
|
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
|
2022-06-24 16:01:35 -04:00
|
|
|
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
;;; Copyright © 2023 Ludovic Courtès <ludo@gnu.org>
|
2015-03-08 01:48:38 -05:00
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (guix import hackage)
|
|
|
|
#:use-module (ice-9 match)
|
2016-03-22 23:44:51 -04:00
|
|
|
#:use-module (ice-9 regex)
|
2022-03-07 16:48:10 -05:00
|
|
|
#:use-module (srfi srfi-71)
|
2017-02-09 11:05:41 -05:00
|
|
|
#:use-module (srfi srfi-34)
|
2015-03-08 01:48:38 -05:00
|
|
|
#:use-module (srfi srfi-26)
|
|
|
|
#:use-module (srfi srfi-1)
|
2022-06-24 16:01:35 -04:00
|
|
|
#:use-module (guix diagnostics)
|
2016-03-22 23:44:51 -04:00
|
|
|
#:use-module ((guix download) #:select (download-to-store url-fetch))
|
2015-11-14 09:15:00 -05:00
|
|
|
#:use-module ((guix utils) #:select (package-name->name+version
|
|
|
|
canonical-newline-port))
|
2016-03-22 23:38:54 -04:00
|
|
|
#:use-module (guix http-client)
|
2022-06-24 16:01:35 -04:00
|
|
|
#:use-module (guix i18n)
|
2021-12-17 08:10:40 -05:00
|
|
|
#:use-module (guix import utils)
|
2015-04-26 05:22:29 -04:00
|
|
|
#:use-module (guix import cabal)
|
2015-03-08 01:48:38 -05:00
|
|
|
#:use-module (guix store)
|
Switch to Guile-Gcrypt.
This removes (guix hash) and (guix pk-crypto), which now live as part of
Guile-Gcrypt (version 0.1.0.)
* guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm,
tests/hash.scm, tests/pk-crypto.scm: Remove.
* configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and
LIBGCRYPT_LIBDIR assignments.
* m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove.
* README: Add Guile-Gcrypt to the dependencies; move libgcrypt as
"required unless --disable-daemon".
* doc/guix.texi (Requirements): Likewise.
* gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm,
guix/git.scm, guix/http-client.scm, guix/import/cpan.scm,
guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm,
guix/import/gnu.scm, guix/import/hackage.scm,
guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm,
guix/pki.scm, guix/scripts/archive.scm,
guix/scripts/authenticate.scm, guix/scripts/download.scm,
guix/scripts/hash.scm, guix/scripts/pack.scm,
guix/scripts/publish.scm, guix/scripts/refresh.scm,
guix/scripts/substitute.scm, guix/store.scm,
guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm,
tests/builders.scm, tests/challenge.scm, tests/cpan.scm,
tests/crate.scm, tests/derivations.scm, tests/gem.scm,
tests/nar.scm, tests/opam.scm, tests/pki.scm,
tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm,
tests/store.scm, tests/substitute.scm: Adjust imports.
* gnu/system/vm.scm: Likewise.
(guile-sqlite3&co): Rename to...
(gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT.
(expression->derivation-in-linux-vm)[config]: Remove.
(iso9660-image)[config]: Remove.
(qemu-image)[config]: Remove.
(system-docker-image)[config]: Remove.
* guix/scripts/pack.scm: Adjust imports.
(guile-sqlite3&co): Rename to...
(gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT.
(self-contained-tarball)[build]: Call 'make-config.scm' without
#:libgcrypt argument.
(squashfs-image)[libgcrypt]: Remove.
[build]: Call 'make-config.scm' without #:libgcrypt.
(docker-image)[config, json]: Remove.
[build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from
the imported modules.
* guix/self.scm (specification->package): Remove "libgcrypt", add
"guile-gcrypt".
(compiled-guix): Remove #:libgcrypt.
[guile-gcrypt]: New variable.
[dependencies]: Add it.
[*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call.
Add #:extensions.
[*config*]: Remove #:libgcrypt from 'make-config.scm' call.
(%dependency-variables): Remove %libgcrypt.
(make-config.scm): Remove #:libgcrypt.
* build-aux/build-self.scm (guile-gcrypt): New variable.
(make-config.scm): Remove #:libgcrypt.
(build-program)[fake-gcrypt-hash]: New variable.
Add (gcrypt hash) to the imported modules. Adjust load path
assignments.
* gnu/packages/package-management.scm (guix)[propagated-inputs]: Add
GUILE-GCRYPT.
[arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search
path.
2018-08-31 11:07:07 -04:00
|
|
|
#:use-module (gcrypt hash)
|
2015-03-08 01:48:38 -05:00
|
|
|
#:use-module (guix base32)
|
2018-08-08 09:29:18 -04:00
|
|
|
#:use-module (guix memoization)
|
2016-03-22 23:44:51 -04:00
|
|
|
#:use-module (guix upstream)
|
|
|
|
#:use-module (guix packages)
|
2021-11-02 12:48:09 -04:00
|
|
|
#:autoload (guix build-system haskell) (hackage-uri)
|
2015-03-08 01:48:38 -05:00
|
|
|
#:use-module ((guix utils) #:select (call-with-temporary-output-file))
|
2020-11-03 15:30:28 -05:00
|
|
|
#:export (%hackage-url
|
|
|
|
hackage->guix-package
|
2018-08-08 09:29:18 -04:00
|
|
|
hackage-recursive-import
|
2017-02-06 12:19:26 -05:00
|
|
|
%hackage-updater
|
|
|
|
|
2018-08-20 11:38:56 -04:00
|
|
|
hackage-name->package-name
|
2017-02-06 12:19:26 -05:00
|
|
|
hackage-fetch
|
|
|
|
hackage-source-url
|
|
|
|
hackage-cabal-url
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
hackage-package?
|
|
|
|
|
|
|
|
cabal-package-inputs))
|
2015-03-08 01:48:38 -05:00
|
|
|
|
|
|
|
(define ghc-standard-libraries
|
2021-09-14 07:15:07 -04:00
|
|
|
;; List of libraries distributed with ghc (as of 8.10.7).
|
|
|
|
;; Contents of …-ghc-8.10.7/lib/ghc-8.10.7
|
2019-05-25 16:11:02 -04:00
|
|
|
'("ghc"
|
|
|
|
"cabal" ;; in the output of `ghc-pkg list` Cabal is uppercased, but
|
|
|
|
;; hackage-name->package-name takes this into account.
|
|
|
|
"win32" ;; similarly uppercased
|
|
|
|
"array"
|
2015-03-08 01:48:38 -05:00
|
|
|
"base"
|
|
|
|
"binary"
|
|
|
|
"bytestring"
|
|
|
|
"containers"
|
2015-10-21 09:46:25 -04:00
|
|
|
"deepseq"
|
|
|
|
"directory"
|
2021-09-14 07:15:07 -04:00
|
|
|
"exceptions"
|
2015-10-21 09:46:25 -04:00
|
|
|
"filepath"
|
2019-06-05 15:05:36 -04:00
|
|
|
"ghc"
|
2023-01-06 04:11:28 -05:00
|
|
|
"ghc-bignum"
|
2019-05-25 16:11:02 -04:00
|
|
|
"ghc-boot"
|
2019-06-05 15:05:36 -04:00
|
|
|
"ghc-boot-th"
|
2019-05-25 16:11:02 -04:00
|
|
|
"ghc-compact"
|
2019-10-30 22:22:30 -04:00
|
|
|
"ghc-heap"
|
2015-03-08 01:48:38 -05:00
|
|
|
"ghc-prim"
|
2019-05-25 16:11:02 -04:00
|
|
|
"ghci"
|
2015-10-21 09:46:25 -04:00
|
|
|
"haskeline"
|
|
|
|
"hpc"
|
2015-03-08 01:48:38 -05:00
|
|
|
"integer-gmp"
|
2019-10-30 22:22:30 -04:00
|
|
|
"libiserv"
|
2019-05-25 16:11:02 -04:00
|
|
|
"mtl"
|
|
|
|
"parsec"
|
2019-06-05 15:05:36 -04:00
|
|
|
"pretty"
|
2015-03-08 01:48:38 -05:00
|
|
|
"process"
|
2019-06-05 15:05:36 -04:00
|
|
|
"stm"
|
2015-10-21 09:46:25 -04:00
|
|
|
"template-haskell"
|
2019-06-05 15:05:36 -04:00
|
|
|
"terminfo"
|
2019-05-25 16:11:02 -04:00
|
|
|
"text"
|
2015-10-21 09:46:25 -04:00
|
|
|
"time"
|
|
|
|
"transformers"
|
2015-03-08 01:48:38 -05:00
|
|
|
"unix"
|
2015-10-21 09:46:25 -04:00
|
|
|
"xhtml"))
|
2015-03-08 01:48:38 -05:00
|
|
|
|
|
|
|
(define package-name-prefix "ghc-")
|
|
|
|
|
2020-11-03 15:30:28 -05:00
|
|
|
(define %hackage-url
|
|
|
|
(make-parameter "https://hackage.haskell.org"))
|
|
|
|
|
2016-03-22 23:40:38 -04:00
|
|
|
(define (hackage-source-url name version)
|
|
|
|
"Given a Hackage package NAME and VERSION, return a url to the source
|
|
|
|
tarball."
|
2020-11-03 15:30:28 -05:00
|
|
|
(string-append (%hackage-url) "/package/"
|
|
|
|
name "/" name "-" version ".tar.gz"))
|
2016-03-22 23:40:38 -04:00
|
|
|
|
|
|
|
(define* (hackage-cabal-url name #:optional version)
|
|
|
|
"Given a Hackage package NAME and VERSION, return a url to the corresponding
|
|
|
|
.cabal file on Hackage. If VERSION is #f or missing, the url for the latest
|
|
|
|
version is returned."
|
|
|
|
(if version
|
2020-11-03 15:30:28 -05:00
|
|
|
(string-append (%hackage-url) "/package/"
|
2016-03-22 23:40:38 -04:00
|
|
|
name "-" version "/" name ".cabal")
|
2020-11-03 15:30:28 -05:00
|
|
|
(string-append (%hackage-url) "/package/"
|
2016-03-22 23:40:38 -04:00
|
|
|
name "/" name ".cabal")))
|
|
|
|
|
2015-03-08 01:48:38 -05:00
|
|
|
(define (hackage-name->package-name name)
|
2015-04-26 05:22:29 -04:00
|
|
|
"Given the NAME of a Cabal package, return the corresponding Guix name."
|
2015-03-08 01:48:38 -05:00
|
|
|
(if (string-prefix? package-name-prefix name)
|
|
|
|
(string-downcase name)
|
|
|
|
(string-append package-name-prefix (string-downcase name))))
|
|
|
|
|
2019-06-13 15:39:14 -04:00
|
|
|
(define (read-cabal-and-hash port)
|
|
|
|
"Read a Cabal file from PORT and return it and its hash in nix-base32
|
|
|
|
format as two values."
|
2022-03-07 16:48:10 -05:00
|
|
|
(let ((port get-hash (open-sha256-input-port port)))
|
2019-06-13 15:39:14 -04:00
|
|
|
(values (read-cabal (canonical-newline-port port))
|
|
|
|
(bytevector->nix-base32-string (get-hash)))))
|
|
|
|
|
|
|
|
(define (hackage-fetch-and-hash name-version)
|
|
|
|
"Fetch the latest Cabal revision for the package NAME-VERSION, and return
|
|
|
|
two values: the parsed Cabal file and its hash in nix-base32 format. If the
|
|
|
|
version part is omitted from the package name, then fetch the latest
|
|
|
|
version. On failure, both return values will be #f."
|
|
|
|
(guard (c ((and (http-get-error? c)
|
|
|
|
(= 404 (http-get-error-code c)))
|
|
|
|
(values #f #f))) ;"expected" if package is unknown
|
2022-03-07 16:48:10 -05:00
|
|
|
(let* ((name version (package-name->name+version name-version))
|
|
|
|
(url (hackage-cabal-url name version))
|
|
|
|
(port _ (http-fetch url))
|
|
|
|
(cabal hash (read-cabal-and-hash port)))
|
2019-06-13 15:39:14 -04:00
|
|
|
(close-port port)
|
|
|
|
(values cabal hash))))
|
|
|
|
|
2015-03-08 01:48:38 -05:00
|
|
|
(define (hackage-fetch name-version)
|
|
|
|
"Return the Cabal file for the package NAME-VERSION, or #f on failure. If
|
|
|
|
the version part is omitted from the package name, then return the latest
|
|
|
|
version."
|
2022-03-07 16:48:10 -05:00
|
|
|
(let ((cabal hash (hackage-fetch-and-hash name-version)))
|
2019-06-13 15:39:14 -04:00
|
|
|
cabal))
|
2015-03-08 01:48:38 -05:00
|
|
|
|
|
|
|
(define string->license
|
|
|
|
;; List of valid values from
|
|
|
|
;; https://www.haskell.org
|
|
|
|
;; /cabal/release/cabal-latest/doc/API/Cabal/Distribution-License.html.
|
|
|
|
(match-lambda
|
2021-05-17 16:11:15 -04:00
|
|
|
("GPL-2" 'license:gpl2)
|
|
|
|
("GPL-3" 'license:gpl3)
|
2015-03-08 01:48:38 -05:00
|
|
|
("GPL" "'gpl??")
|
2021-05-17 16:11:15 -04:00
|
|
|
("AGPL-3" 'license:agpl3)
|
2015-03-08 01:48:38 -05:00
|
|
|
("AGPL" "'agpl??")
|
2021-05-17 16:11:15 -04:00
|
|
|
("LGPL-2.1" 'license:lgpl2.1)
|
|
|
|
("LGPL-3" 'license:lgpl3)
|
2015-03-08 01:48:38 -05:00
|
|
|
("LGPL" "'lgpl??")
|
2021-05-17 16:11:15 -04:00
|
|
|
("BSD2" 'license:bsd-2)
|
|
|
|
("BSD3" 'license:bsd-3)
|
|
|
|
("BSD-3-Clause" 'license:bsd-3)
|
|
|
|
("MIT" 'license:expat)
|
|
|
|
("ISC" 'license:isc)
|
|
|
|
("MPL" 'license:mpl2.0)
|
|
|
|
("Apache-2.0" 'license:asl2.0)
|
|
|
|
("PublicDomain" 'license:public-domain)
|
2015-03-08 01:48:38 -05:00
|
|
|
((x) (string->license x))
|
|
|
|
((lst ...) `(list ,@(map string->license lst)))
|
|
|
|
(_ #f)))
|
|
|
|
|
2015-04-26 05:22:29 -04:00
|
|
|
|
2018-07-13 09:54:41 -04:00
|
|
|
(define (cabal-dependencies->names cabal)
|
|
|
|
"Return the list of dependencies names from the CABAL package object,
|
|
|
|
not including test suite dependencies or custom-setup dependencies."
|
2015-04-26 05:22:29 -04:00
|
|
|
(let* ((lib (cabal-package-library cabal))
|
|
|
|
(lib-deps (if (pair? lib)
|
|
|
|
(map cabal-dependency-name
|
|
|
|
(append-map cabal-library-dependencies lib))
|
|
|
|
'()))
|
|
|
|
(exe (cabal-package-executables cabal))
|
|
|
|
(exe-deps (if (pair? exe)
|
|
|
|
(map cabal-dependency-name
|
|
|
|
(append-map cabal-executable-dependencies exe))
|
|
|
|
'())))
|
2018-07-13 09:54:41 -04:00
|
|
|
(delete-duplicates (append lib-deps exe-deps))))
|
|
|
|
|
|
|
|
(define (cabal-test-dependencies->names cabal)
|
|
|
|
"Return the list of test suite dependencies from the CABAL package
|
|
|
|
object."
|
|
|
|
(let* ((ts (cabal-package-test-suites cabal))
|
|
|
|
(ts-deps (if (pair? ts)
|
|
|
|
(map cabal-dependency-name
|
|
|
|
(append-map cabal-test-suite-dependencies ts))
|
|
|
|
'())))
|
|
|
|
ts-deps))
|
|
|
|
|
|
|
|
(define (cabal-custom-setup-dependencies->names cabal)
|
|
|
|
"Return the list of custom-setup dependencies from the CABAL package
|
|
|
|
object."
|
2018-08-07 12:00:16 -04:00
|
|
|
(let* ((custom-setup-dependencies (or (and=> (cabal-package-custom-setup cabal)
|
|
|
|
cabal-custom-setup-dependencies)
|
|
|
|
'())))
|
2018-07-13 09:54:41 -04:00
|
|
|
(map cabal-dependency-name custom-setup-dependencies)))
|
2015-04-26 05:22:29 -04:00
|
|
|
|
2022-05-22 05:20:07 -04:00
|
|
|
(define (filter-dependencies dependencies own-names)
|
2015-04-26 05:22:29 -04:00
|
|
|
"Filter the dependencies included with the GHC compiler from DEPENDENCIES, a
|
2022-05-22 05:20:07 -04:00
|
|
|
list with the names of dependencies. OWN-NAMES is the name of the Cabal
|
|
|
|
package being processed and its internal libaries and is used to filter
|
|
|
|
references to itself."
|
2022-06-02 07:52:08 -04:00
|
|
|
(let ((ignored-dependencies (map string-downcase
|
2022-05-22 05:20:07 -04:00
|
|
|
(append own-names ghc-standard-libraries))))
|
2022-06-02 07:52:08 -04:00
|
|
|
(filter (lambda (d) (not (member (string-downcase d) ignored-dependencies)))
|
|
|
|
dependencies)))
|
2015-04-26 05:22:29 -04:00
|
|
|
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
(define* (cabal-package-inputs cabal #:key (include-test-dependencies? #t))
|
|
|
|
"Return the list of <upstream-input> for CABAL representing its
|
|
|
|
dependencies."
|
|
|
|
(define own-names
|
|
|
|
(cons (cabal-package-name cabal)
|
|
|
|
(filter-map cabal-library-name (cabal-package-library cabal))))
|
2022-05-22 05:20:07 -04:00
|
|
|
|
2018-08-08 09:29:18 -04:00
|
|
|
(define hackage-dependencies
|
2022-05-22 05:20:07 -04:00
|
|
|
(filter-dependencies (cabal-dependencies->names cabal) own-names))
|
2018-08-08 09:29:18 -04:00
|
|
|
|
|
|
|
(define hackage-native-dependencies
|
2018-09-22 12:48:50 -04:00
|
|
|
(lset-difference
|
|
|
|
equal?
|
2022-03-07 16:44:34 -05:00
|
|
|
(filter-dependencies
|
|
|
|
(append (if include-test-dependencies?
|
|
|
|
(cabal-test-dependencies->names cabal)
|
|
|
|
'())
|
|
|
|
(cabal-custom-setup-dependencies->names cabal))
|
2022-05-22 05:20:07 -04:00
|
|
|
own-names)
|
2018-09-22 12:48:50 -04:00
|
|
|
hackage-dependencies))
|
2018-08-08 09:29:18 -04:00
|
|
|
|
2015-04-26 05:22:29 -04:00
|
|
|
(define dependencies
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
(map (lambda (name)
|
|
|
|
(upstream-input
|
|
|
|
(name name)
|
|
|
|
(downstream-name (hackage-name->package-name name))
|
|
|
|
(type 'regular)))
|
|
|
|
hackage-dependencies))
|
2018-07-13 09:54:41 -04:00
|
|
|
|
|
|
|
(define native-dependencies
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
(map (lambda (name)
|
|
|
|
(upstream-input
|
|
|
|
(name name)
|
|
|
|
(downstream-name (hackage-name->package-name name))
|
|
|
|
(type 'native)))
|
|
|
|
hackage-native-dependencies))
|
|
|
|
|
|
|
|
(append dependencies native-dependencies))
|
|
|
|
|
|
|
|
(define* (hackage-module->sexp cabal cabal-hash
|
|
|
|
#:key (include-test-dependencies? #t))
|
|
|
|
"Return the `package' S-expression for a Cabal package. CABAL is the
|
|
|
|
representation of a Cabal file as produced by 'read-cabal'. CABAL-HASH is
|
|
|
|
the hash of the Cabal file."
|
|
|
|
(define name
|
|
|
|
(cabal-package-name cabal))
|
|
|
|
|
|
|
|
(define version
|
|
|
|
(cabal-package-version cabal))
|
|
|
|
|
|
|
|
(define revision
|
|
|
|
(cabal-package-revision cabal))
|
|
|
|
|
|
|
|
(define source-url
|
|
|
|
(hackage-source-url name version))
|
|
|
|
|
|
|
|
(define inputs
|
|
|
|
(cabal-package-inputs cabal
|
|
|
|
#:include-test-dependencies?
|
|
|
|
include-test-dependencies?))
|
|
|
|
|
2015-03-08 01:48:38 -05:00
|
|
|
(define (maybe-inputs input-type inputs)
|
|
|
|
(match inputs
|
|
|
|
(()
|
|
|
|
'())
|
|
|
|
((inputs ...)
|
|
|
|
(list (list input-type
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
`(list ,@(map (compose string->symbol
|
|
|
|
upstream-input-downstream-name)
|
|
|
|
inputs)))))))
|
2021-07-14 21:40:37 -04:00
|
|
|
|
2015-04-26 05:22:29 -04:00
|
|
|
(define (maybe-arguments)
|
2019-06-13 15:39:14 -04:00
|
|
|
(match (append (if (not include-test-dependencies?)
|
|
|
|
'(#:tests? #f)
|
|
|
|
'())
|
|
|
|
(if (not (string-null? revision))
|
|
|
|
`(#:cabal-revision (,revision ,cabal-hash))
|
|
|
|
'()))
|
|
|
|
(() '())
|
|
|
|
(args `((arguments (,'quasiquote ,args))))))
|
2015-04-26 05:22:29 -04:00
|
|
|
|
2015-03-08 01:48:38 -05:00
|
|
|
(let ((tarball (with-store store
|
|
|
|
(download-to-store store source-url))))
|
2018-08-08 09:29:18 -04:00
|
|
|
(values
|
|
|
|
`(package
|
|
|
|
(name ,(hackage-name->package-name name))
|
|
|
|
(version ,version)
|
|
|
|
(source (origin
|
|
|
|
(method url-fetch)
|
2021-11-02 12:48:09 -04:00
|
|
|
(uri (hackage-uri ,name version))
|
2018-08-08 09:29:18 -04:00
|
|
|
(sha256
|
|
|
|
(base32
|
|
|
|
,(if tarball
|
|
|
|
(bytevector->nix-base32-string (file-sha256 tarball))
|
|
|
|
"failed to download tar archive")))))
|
|
|
|
(build-system haskell-build-system)
|
2023-01-04 03:37:25 -05:00
|
|
|
(properties '((upstream-name . ,name)))
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
,@(maybe-inputs 'inputs
|
|
|
|
(filter (upstream-input-type-predicate 'regular)
|
|
|
|
inputs))
|
|
|
|
,@(maybe-inputs 'native-inputs
|
|
|
|
(filter (upstream-input-type-predicate 'native)
|
|
|
|
inputs))
|
2018-08-08 09:29:18 -04:00
|
|
|
,@(maybe-arguments)
|
|
|
|
(home-page ,(cabal-package-home-page cabal))
|
|
|
|
(synopsis ,(cabal-package-synopsis cabal))
|
2021-12-17 08:10:40 -05:00
|
|
|
(description ,(beautify-description (cabal-package-description cabal)))
|
2018-08-08 09:29:18 -04:00
|
|
|
(license ,(string->license (cabal-package-license cabal))))
|
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.
* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-15 16:37:25 -04:00
|
|
|
inputs)))
|
2015-04-26 05:22:29 -04:00
|
|
|
|
2019-05-26 17:18:21 -04:00
|
|
|
(define* (hackage->guix-package package-name #:key
|
|
|
|
(include-test-dependencies? #t)
|
|
|
|
(port #f)
|
2022-11-27 05:12:32 -05:00
|
|
|
(cabal-environment '())
|
|
|
|
#:allow-other-keys)
|
2019-05-26 17:18:21 -04:00
|
|
|
"Fetch the Cabal file for PACKAGE-NAME from hackage.haskell.org, or, if the
|
2015-04-26 05:22:29 -04:00
|
|
|
called with keyword parameter PORT, from PORT. Return the `package'
|
|
|
|
S-expression corresponding to that package, or #f on failure.
|
|
|
|
CABAL-ENVIRONMENT is an alist defining the environment in which the Cabal
|
|
|
|
conditionals are evaluated. The accepted keys are: \"os\", \"arch\", \"impl\"
|
|
|
|
and the name of a flag. The value associated with a flag has to be either the
|
|
|
|
symbol 'true' or 'false'. The value associated with other keys has to conform
|
|
|
|
to the Cabal file format definition. The default value associated with the
|
|
|
|
keys \"os\", \"arch\" and \"impl\" is \"linux\", \"x86_64\" and \"ghc\"
|
|
|
|
respectively."
|
2022-03-07 16:48:10 -05:00
|
|
|
(let ((cabal-meta cabal-hash
|
|
|
|
(if port
|
|
|
|
(read-cabal-and-hash port)
|
|
|
|
(hackage-fetch-and-hash package-name))))
|
2021-01-19 10:47:18 -05:00
|
|
|
(if cabal-meta
|
2022-03-07 16:44:34 -05:00
|
|
|
(hackage-module->sexp (eval-cabal cabal-meta cabal-environment)
|
|
|
|
cabal-hash
|
|
|
|
#:include-test-dependencies?
|
|
|
|
include-test-dependencies?)
|
2021-01-19 10:47:18 -05:00
|
|
|
(values #f '()))))
|
2019-05-26 17:18:21 -04:00
|
|
|
|
|
|
|
(define hackage->guix-package/m ;memoized variant
|
|
|
|
(memoize hackage->guix-package))
|
2018-08-08 09:29:18 -04:00
|
|
|
|
|
|
|
(define* (hackage-recursive-import package-name . args)
|
2021-02-28 11:18:34 -05:00
|
|
|
(recursive-import package-name
|
2022-11-27 05:12:32 -05:00
|
|
|
#:repo->guix-package (lambda* (name #:key version #:allow-other-keys)
|
2019-05-26 17:18:21 -04:00
|
|
|
(apply hackage->guix-package/m
|
|
|
|
(cons name args)))
|
2018-08-08 09:29:18 -04:00
|
|
|
#:guix-name hackage-name->package-name))
|
2015-03-08 01:48:38 -05:00
|
|
|
|
2020-07-03 16:45:21 -04:00
|
|
|
(define hackage-package?
|
2021-09-17 05:09:04 -04:00
|
|
|
(let ((hackage-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage/)")))
|
2020-07-03 16:45:21 -04:00
|
|
|
(url-predicate (cut regexp-exec hackage-rx <>))))
|
2016-03-22 23:44:51 -04:00
|
|
|
|
2022-06-24 16:01:35 -04:00
|
|
|
(define* (latest-release package #:key (version #f))
|
2016-04-14 15:40:20 -04:00
|
|
|
"Return an <upstream-source> for the latest release of PACKAGE."
|
2022-06-24 16:01:35 -04:00
|
|
|
(when version
|
2023-04-07 12:11:21 -04:00
|
|
|
(raise
|
2022-06-24 16:01:35 -04:00
|
|
|
(formatted-message
|
|
|
|
(G_ "~a updater doesn't support updating to a specific version, sorry.")
|
|
|
|
"hackage")))
|
2023-01-04 03:37:26 -05:00
|
|
|
(let* ((hackage-name (package-upstream-name* package))
|
2016-03-22 23:44:51 -04:00
|
|
|
(cabal-meta (hackage-fetch hackage-name)))
|
|
|
|
(match cabal-meta
|
|
|
|
(#f
|
|
|
|
(format (current-error-port)
|
|
|
|
"warning: failed to parse ~a~%"
|
|
|
|
(hackage-cabal-url hackage-name))
|
|
|
|
#f)
|
2022-06-11 05:02:52 -04:00
|
|
|
;; Cabal files have no particular order and while usually the version
|
|
|
|
;; as somewhere in the middle it can also be at the beginning,
|
|
|
|
;; requiring two pattern.
|
|
|
|
((or (_ *** ("version" (version))) (("version" (version)) _ ...))
|
2021-11-02 12:48:09 -04:00
|
|
|
(let ((url (hackage-uri hackage-name version)))
|
2016-03-22 23:44:51 -04:00
|
|
|
(upstream-source
|
2016-04-14 15:40:20 -04:00
|
|
|
(package (package-name package))
|
2016-03-22 23:44:51 -04:00
|
|
|
(version version)
|
|
|
|
(urls (list url))))))))
|
|
|
|
|
|
|
|
(define %hackage-updater
|
|
|
|
(upstream-updater
|
|
|
|
(name 'hackage)
|
|
|
|
(description "Updater for Hackage packages")
|
|
|
|
(pred hackage-package?)
|
upstream-updater: Rename record field.
The next commits will make the functions, which are currently importing the
latest version of a package, change into importing the latest or a given
version of the package (for those updaters supporting specifying a version).
Thus the name ‘latest‘ is no longer appropriate.
* guix/upstream.scm (upstream-updater) Rename field [latest] to
[import]. (lookup-updater, package-latest-release) Adjust fieldname
accordingly.
* guix/gnu-maintenance.scm (%gnu-updater, %gnu-ftp-updater,
%savannah-updater, %sourceforge-updater, %xorg-updater,
%kernel.org-updater, %generic-html-updater),
guix/import/cpan.scm (%cpan-updater),
guix/import/cran.scm (%cran-updater, %bioconductor-updater),
guix/import/crate.scm (%crate-updater),
guix/import/egg.scm (%egg-updater),
guix/import/elpa.scm (%elpa-updater),
guix/import/gem.scm (%gem-updater),
guix/import/git.scm (%generic-git-updater),
guix/import/github.scm (%github-updater),
guix/import/gnome.scm (%gnome-updater),
guix/import/hackage.scm (%hackage-updater),
guix/import/hexpm.scm (%hexpm-updater),
guix/import/kde.scm (%kde-updater),
guix/import/launchpad.scm (%launchpad-updater),
guix/import/minetest.scm (%minetest-updater),
guix/import/opam.scm (%opam-updater),
guix/import/pypi.scm (%pypi-updater),
guix/import/stackage.scm (%stackage-updater),
tests/import-github.scm (found-sexp)
tests/transformations.scm ("options->transformation, with-latest"):
Adjust fieldname accordingly.
2022-08-27 07:05:33 -04:00
|
|
|
(import latest-release)))
|
2016-03-22 23:44:51 -04:00
|
|
|
|
2015-03-08 01:48:38 -05:00
|
|
|
;;; cabal.scm ends here
|