summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-11-27 11:12:32 +0100
committerRicardo Wurmus <rekado@elephly.net>2022-12-31 14:48:46 +0100
commit3c24da4260f28b4ed57efda0296688a50ac94628 (patch)
tree5b62e96e82639c0309d2f977540ce49268e17bba
parentdb675db2232893233e90df3b818c55043071dccd (diff)
downloadguix-3c24da4260f28b4ed57efda0296688a50ac94628.tar.gz
import/utils: Pass all arguments through to package builder.
Individual importer may have additional arguments.

* guix/import/utils.scm (recursive-import): Patch all keyword arguments
through to repo->guix-package.
* guix/import/cran.scm (cran->guix-package): Add #:allow-other-keys.
* guix/import/crate.scm (crate->guix-package): Ditto.
* guix/import/egg.scm (egg->guix-package): Ditto.
* guix/import/elm.scm (elm->guix-package): Ditto.
* guix/import/gem.scm (gem->guix-package): Ditto.
* guix/import/gnu.scm (gnu->guix-package): Ditto.
* guix/import/go.scm (go-module->guix-package): Ditto.
(go-module-recursive-import): Ditto.
* guix/import/hackage.scm (hackage->guix-package): Ditto.
(hackage-recursive-import): Ditto.
* guix/import/hexpm.scm (hexpm->guix-package): Ditto.
* guix/import/minetest.scm (minetest->guix-package): Ditto.
(minetest-recursive-import): Ditto.
* guix/import/opam.scm (opam->guix-package): Ditto.
* guix/import/pypi.scm (pypi->guix-package): Ditto.
* guix/import/stackage.scm (stackage->guix-package): Ditto.
(stackage-recursive-import): Ditto.
* guix/import/texlive.scm (texlive->guix-package): Ditto.
-rw-r--r--guix/import/cran.scm2
-rw-r--r--guix/import/crate.scm3
-rw-r--r--guix/import/egg.scm3
-rw-r--r--guix/import/elm.scm2
-rw-r--r--guix/import/gem.scm3
-rw-r--r--guix/import/gnu.scm3
-rw-r--r--guix/import/go.scm5
-rw-r--r--guix/import/hackage.scm5
-rw-r--r--guix/import/hexpm.scm2
-rw-r--r--guix/import/minetest.scm5
-rw-r--r--guix/import/opam.scm2
-rw-r--r--guix/import/pypi.scm2
-rw-r--r--guix/import/stackage.scm5
-rw-r--r--guix/import/texlive.scm4
-rw-r--r--guix/import/utils.scm10
15 files changed, 31 insertions, 25 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 1ed3580315..69423cf8ca 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -644,7 +644,7 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
 
 (define cran->guix-package
   (memoize
-   (lambda* (package-name #:key (repo 'cran) version)
+   (lambda* (package-name #:key (repo 'cran) version #:allow-other-keys)
      "Fetch the metadata for PACKAGE-NAME from REPO and return the `package'
 s-expression corresponding to that package, or #f on failure."
      (let ((description (fetch-description repo package-name version)))
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 339dbcd74c..c17d96ef41 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -217,7 +217,8 @@ and LICENSE."
                          'unknown-license!)))
               (string-split string (string->char-set " /"))))
 
-(define* (crate->guix-package crate-name #:key version include-dev-deps? repo)
+(define* (crate->guix-package crate-name #:key version include-dev-deps?
+                              #:allow-other-keys)
   "Fetch the metadata for CRATE-NAME from crates.io, and return the
 `package' s-expression corresponding to that package, or #f on failure.
 When VERSION is specified, convert it into a semver range and attempt to fetch
diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index 10a40fe4f8..90d97909b5 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -171,7 +171,8 @@ FILE is specified, return the package metadata in FILE."
 ;;; Egg importer.
 ;;;
 
-(define* (egg->guix-package name version #:key (file #f) (source #f))
+(define* (egg->guix-package name version #:key (file #f) (source #f)
+                            #:allow-other-keys)
   "Import a CHICKEN egg called NAME from either the given .egg FILE, or from the
 latest NAME metadata downloaded from the official repository if FILE is #f.
 Return a <package> record or #f on failure.  If VERSION is specified, import
diff --git a/guix/import/elm.scm b/guix/import/elm.scm
index 74902b8617..c8fb15343f 100644
--- a/guix/import/elm.scm
+++ b/guix/import/elm.scm
@@ -190,7 +190,7 @@ given NAME and VERSION, and a list of Elm packages it depends on."
 
 (define elm->guix-package
   (memoize
-   (lambda* (package-name #:key repo version)
+   (lambda* (package-name #:key version #:allow-other-keys)
      "Fetch the metadata for PACKAGE-NAME, an Elm package registered at
 package.elm.org, and return two values: the `package' s-expression
 corresponding to that package (or #f on failure) and a list of Elm
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 8ad0662628..c8d6cd4d2d 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -124,7 +124,8 @@ VERSION, HASH, HOME-PAGE, DESCRIPTION, DEPENDENCIES, and LICENSES."
                  ((license) (license->symbol license))
                  (_ `(list ,@(map license->symbol licenses)))))))
 
-(define* (gem->guix-package package-name #:key (repo 'rubygems) version)
+(define* (gem->guix-package package-name #:key (repo 'rubygems) version
+                            #:allow-other-keys)
   "Fetch the metadata for PACKAGE-NAME from rubygems.org, and return the
 `package' s-expression corresponding to that package, or #f on failure.
 Optionally include a VERSION string to fetch a specific version gem."
diff --git a/guix/import/gnu.scm b/guix/import/gnu.scm
index 139c32a545..cff088f423 100644
--- a/guix/import/gnu.scm
+++ b/guix/import/gnu.scm
@@ -109,7 +109,8 @@ download policy (see 'download-tarball' for details.)"
        #f))))
 
 (define* (gnu->guix-package name
-                            #:key (key-download 'interactive))
+                            #:key (key-download 'interactive)
+                            #:allow-other-keys)
   "Return the package declaration for NAME as an s-expression.  Use
 KEY-DOWNLOAD as the OpenPGP key download policy (see 'download-tarball' for
 details.)"
diff --git a/guix/import/go.scm b/guix/import/go.scm
index d00c13475a..90d4c8931d 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -602,7 +602,8 @@ available versions:~{ ~a~}.")
 (define* (go-module->guix-package module-path #:key
                                   (goproxy "https://proxy.golang.org")
                                   version
-                                  pin-versions?)
+                                  pin-versions?
+                                  #:allow-other-keys)
   "Return the package S-expression corresponding to MODULE-PATH at VERSION, a Go package.
 The meta-data is fetched from the GOPROXY server and https://pkg.go.dev/.
 When VERSION is unspecified, the latest version available is used."
@@ -687,7 +688,7 @@ This package and its dependencies won't be imported.~%")
    package-name
    #:repo->guix-package
    (memoize
-    (lambda* (name #:key version repo)
+    (lambda* (name #:key version repo #:allow-other-keys)
       (receive (package-sexp dependencies)
           (go-module->guix-package* name #:goproxy goproxy
                                     #:version version
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 3c2cd75db4..7bc2908405 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -326,7 +326,8 @@ the hash of the Cabal file."
 (define* (hackage->guix-package package-name #:key
                                 (include-test-dependencies? #t)
                                 (port #f)
-                                (cabal-environment '()))
+                                (cabal-environment '())
+                                #:allow-other-keys)
   "Fetch the Cabal file for PACKAGE-NAME from hackage.haskell.org, or, if the
 called with keyword parameter PORT, from PORT.  Return the `package'
 S-expression corresponding to that package, or #f on failure.
@@ -353,7 +354,7 @@ respectively."
 
 (define* (hackage-recursive-import package-name . args)
   (recursive-import package-name
-                    #:repo->guix-package (lambda* (name #:key repo version)
+                    #:repo->guix-package (lambda* (name #:key version #:allow-other-keys)
                                            (apply hackage->guix-package/m
                                                   (cons name args)))
                     #:guix-name hackage-name->package-name))
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 8a009fd245..dac5d1756f 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -234,7 +234,7 @@ build-system, and DEPENDENCIES the inputs for the package."
           (fold (lambda (a b)
                   (if (version>? a b) a b)) (car versions) versions)))))
 
-(define* (hexpm->guix-package package-name #:key repo version)
+(define* (hexpm->guix-package package-name #:key version #:allow-other-keys)
   "Fetch the metadata for PACKAGE-NAME from hexpms.io, and return the
 `package' s-expression corresponding to that package, or #f on failure.
 When VERSION is specified, attempt to fetch that version; otherwise fetch the
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 1f1cfc834d..e5775e2fa9 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -441,7 +441,8 @@ DEPENDENCIES as a list of AUTHOR/NAME strings."
                #f)))))
    dependency-list))
 
-(define* (%minetest->guix-package author/name #:key (sort %default-sort-key))
+(define* (%minetest->guix-package author/name #:key (sort %default-sort-key)
+                                  #:allow-other-keys)
   "Fetch the metadata for AUTHOR/NAME from https://content.minetest.net, and
 return the 'package' S-expression corresponding to that package, or raise an
 exception on failure.  On success, also return the upstream dependencies as a
@@ -477,7 +478,7 @@ list of AUTHOR/NAME strings."
   (memoize %minetest->guix-package))
 
 (define* (minetest-recursive-import author/name #:key (sort %default-sort-key))
-  (define* (minetest->guix-package* author/name #:key repo version)
+  (define* (minetest->guix-package* author/name #:key version #:allow-other-keys)
     (minetest->guix-package author/name #:sort sort))
   (recursive-import author/name
                     #:repo->guix-package minetest->guix-package*
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 59dbb7cb8b..29b2b886bf 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -340,7 +340,7 @@ path to the repository."
                     (sha256 (base32 ,(guix-hash-url temp)))))))
         'no-source-information)))
 
-(define* (opam->guix-package name #:key (repo 'opam) version)
+(define* (opam->guix-package name #:key (repo 'opam) version #:allow-other-keys)
   "Import OPAM package NAME from REPOSITORY (a directory name) or, if
 REPOSITORY is #f, from the official OPAM repository.  Return a 'package' sexp
 or #f on failure."
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 0e5998b36e..c9aaacbc3f 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -492,7 +492,7 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
 
 (define pypi->guix-package
   (memoize
-   (lambda* (package-name #:key repo version)
+   (lambda* (package-name #:key version #:allow-other-keys)
      "Fetch the metadata for PACKAGE-NAME from pypi.org, and return the
 `package' s-expression corresponding to that package, or #f on failure."
      (let* ((project (pypi-fetch package-name))
diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index e54df95985..70d3e271f4 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -109,7 +109,8 @@
              (lts-version %default-lts-version)
              (packages
               (stackage-lts-packages
-               (stackage-lts-info-fetch lts-version))))
+               (stackage-lts-info-fetch lts-version)))
+             #:allow-other-keys)
      "Fetch Cabal file for PACKAGE-NAME from hackage.haskell.org.  The retrieved
 version corresponds to the version of PACKAGE-NAME specified in the LTS-VERSION
 release at stackage.org.  Return the `package' S-expression corresponding to
@@ -126,7 +127,7 @@ included in the Stackage LTS release."
 
 (define (stackage-recursive-import package-name . args)
   (recursive-import package-name
-                    #:repo->guix-package (lambda* (name #:key repo version)
+                    #:repo->guix-package (lambda* (name #:key version #:allow-other-keys)
                                            (apply stackage->guix-package (cons name args)))
                     #:guix-name hackage-name->package-name))
 
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index 116bd1f66a..6bf7f92e60 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -303,9 +303,9 @@ of those files are returned that are unexpectedly installed."
 (define texlive->guix-package
   (memoize
    (lambda* (name #:key
-                  repo
                   (version (number->string %texlive-revision))
-                  (package-database tlpdb))
+                  (package-database tlpdb)
+                  #:allow-other-keys)
      "Find the metadata for NAME in the tlpdb and return the `package'
 s-expression corresponding to that package, or #f on failure."
      (tlpdb->package name version (package-database)))))
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index d6b179b57c..45e55f1df6 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -580,11 +580,11 @@ obtain a node's uniquely identifying \"key\"."
                    (set-insert (node-name head) visited))))))))
 
 (define* (recursive-import package-name
-                           #:key repo->guix-package guix-name version repo
-                           #:allow-other-keys)
+                           #:key repo->guix-package guix-name version
+                           #:allow-other-keys #:rest rest)
   "Return a list of package expressions for PACKAGE-NAME and all its
 dependencies, sorted in topological order.  For each package,
-call (REPO->GUIX-PACKAGE NAME :KEYS version repo), which should return a
+call (REPO->GUIX-PACKAGE NAME :KEYS version), which should return a
 package expression and a list of dependencies; call (GUIX-NAME PACKAGE-NAME)
 to obtain the Guix package name corresponding to the upstream name."
   (define-record-type <node>
@@ -599,9 +599,7 @@ to obtain the Guix package name corresponding to the upstream name."
     (not (null? (find-packages-by-name (guix-name name) version))))
 
   (define (lookup-node name version)
-    (let* ((package dependencies (repo->guix-package name
-                                                     #:version version
-                                                     #:repo repo))
+    (let* ((package dependencies (apply repo->guix-package (cons name rest)))
            (normalized-deps (map (match-lambda
                                    ((name version) (list name version))
                                    (name (list name #f))) dependencies)))