diff options
author | Xinglu Chen <public@yoctocell.xyz> | 2021-11-01 11:55:26 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-11-07 23:10:41 +0100 |
commit | b999c80c2e71bd4b3f26a18a321b7e7e7b580103 (patch) | |
tree | e56d06ff022d3233066cb0a0516937998cf15bc8 /guix/import/egg.scm | |
parent | 2f665d4309053d5a9fe25bc93ee78d55dbc30cb7 (diff) |
import: egg: Allow imports of a specific version.
* guix/import/egg.scm (eggs-repository): Change URL.
(egg-metadata): Accept optional #:version keyword argument.
(egg->guix-package): Accept ‘version’ argument.
(egg-recursive-import): Add ‘version’ argument and honor it.
* guix/scripts/import/egg.scm (guix-import-egg): Parse a specification instead
of just a package name.
* doc/guix.texi (Invoking guix import): Document it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/import/egg.scm')
-rw-r--r-- | guix/import/egg.scm | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/guix/import/egg.scm b/guix/import/egg.scm index 89e7a9160d..ff9f5a0247 100644 --- a/guix/import/egg.scm +++ b/guix/import/egg.scm @@ -51,10 +51,10 @@ ;;; ;;; The following happens under the hood: ;;; -;;; * <git://code.call-cc.org/eggs-5-latest> is a Git repository that contains -;;; the latest version of all CHICKEN eggs. We look clone this repository -;;; and retrieve the latest version number, and the PACKAGE.egg file, which -;;; contains a list of lists containing metadata about the egg. +;;; * <git://code.call-cc.org/eggs-5-all> is a Git repository that contains +;;; all versions of all CHICKEN eggs. We look clone this repository and, by +;;; default, retrieve the latest version number, and the PACKAGE.egg file, +;;; which contains a list of lists containing metadata about the egg. ;;; ;;; * All the eggs are stored as tarballs at ;;; <https://code.call-cc.org/egg-tarballs/5>, so we grab the tarball for @@ -96,7 +96,7 @@ NAME." (define (eggs-repository) "Update or fetch the latest version of the eggs repository and return the path to the repository." - (let* ((url "git://code.call-cc.org/eggs-5-latest") + (let* ((url "git://code.call-cc.org/eggs-5-all") (directory commit _ (update-cached-checkout url))) directory)) @@ -112,12 +112,13 @@ to the repository." (last directory) #f))) -(define* (egg-metadata name #:optional file) - "Return the package metadata file for the egg NAME, or if FILE is specified, -return the package metadata in FILE." +(define* (egg-metadata name #:key (version #f) (file #f)) + "Return the package metadata file for the egg NAME at version VERSION, or if +FILE is specified, return the package metadata in FILE." (call-with-input-file (or file (string-append (egg-directory name) "/" - (find-latest-version name) + (or version + (find-latest-version name)) "/" name ".egg")) read)) @@ -173,10 +174,11 @@ return the package metadata in FILE." ;;; Egg importer. ;;; -(define* (egg->guix-package name #:key (file #f) (source #f)) - "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. +(define* (egg->guix-package name version #:key (file #f) (source #f)) + "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 +the particular version from the egg repository. SOURCE is a ``file-like'' object containing the source code corresponding to the egg. If SOURCE is not specified, the latest tarball for egg NAME will be @@ -186,8 +188,8 @@ Specifying the SOURCE argument is mainly useful for developing a CHICKEN egg locally. Note that if FILE and SOURCE are specified, recursive import will not work." (define egg-content (if file - (egg-metadata name file) - (egg-metadata name))) + (egg-metadata name #:file file) + (egg-metadata name #:version version))) (if (not egg-content) (values #f '()) ; egg doesn't exist (let* ((version* (or (assoc-ref egg-content 'version) @@ -326,10 +328,11 @@ not work." (define egg->guix-package/m ;memoized variant (memoize egg->guix-package)) -(define (egg-recursive-import package-name) +(define* (egg-recursive-import package-name #:optional version) (recursive-import package-name + #:version version #:repo->guix-package (lambda* (name #:key version repo) - (egg->guix-package/m name)) + (egg->guix-package/m name version)) #:guix-name egg-name->guix-name)) |