summaryrefslogtreecommitdiff
path: root/guix/scripts/import/opam.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2020-12-08 14:58:39 +0100
committerJulien Lepiller <julien@lepiller.eu>2020-12-08 16:47:22 +0100
commita8dccd4bdc1e58219d4ba08fe1649bf0b8325f44 (patch)
treea1182100f693fd167192e96f6305c337534e4801 /guix/scripts/import/opam.scm
parent15ee1b8317adeb74938f3bb7f0c7cb635a818292 (diff)
guix: opam: Add --repo argument to importer.
* guix/scripts/import/opam.scm (guix-import-opam): Pass --repo argument to recursive and non-recursive importers. * guix/import/opam.scm (get-opam-repository): Select proper repository location depending on a new repo argument. (opam->guix-package): Use get-opam-repository in the procedure body.
Diffstat (limited to 'guix/scripts/import/opam.scm')
-rw-r--r--guix/scripts/import/opam.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/guix/scripts/import/opam.scm b/guix/scripts/import/opam.scm
index 20da1437fe..da9392821c 100644
--- a/guix/scripts/import/opam.scm
+++ b/guix/scripts/import/opam.scm
@@ -45,6 +45,8 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
(display (G_ "
-r, --recursive import packages recursively"))
(display (G_ "
+ --repo import packages from this opam repository"))
+ (display (G_ "
-V, --version display version information and exit"))
(newline)
(show-bug-report-information))
@@ -58,6 +60,9 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
(option '(#\V "version") #f #f
(lambda args
(show-version-and-exit "guix import opam")))
+ (option '(#f "repo") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'repo arg result)))
(option '(#\r "recursive") #f #f
(lambda (opt name arg result)
(alist-cons 'recursive #t result)))
@@ -79,6 +84,7 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
%default-options))
(let* ((opts (parse-options))
+ (repo (and=> (assoc-ref opts 'repo) string->symbol))
(args (filter-map (match-lambda
(('argument . value)
value)
@@ -93,9 +99,9 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
`(define-public ,(string->symbol name)
,pkg))
(_ #f))
- (opam-recursive-import package-name))
+ (opam-recursive-import package-name #:repo repo))
;; Single import
- (let ((sexp (opam->guix-package package-name)))
+ (let ((sexp (opam->guix-package package-name #:repo repo)))
(unless sexp
(leave (G_ "failed to download meta-data for package '~a'~%")
package-name))