import: cran: Only use the git import with what looks like a URL.

* guix/import/cran.scm (fetch-description): Abort if the argument does not
look like a URL.
This commit is contained in:
Ricardo Wurmus 2019-09-02 14:46:04 +02:00
parent c7358ac4fc
commit 8786fec485
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
1 changed files with 11 additions and 10 deletions

View File

@ -230,16 +230,17 @@ from ~s: ~a (~s)~%"
(if (boolean? type) meta
(cons `(bioconductor-type . ,type) meta))))))))))
((git)
;; Download the git repository at "NAME"
(call-with-values
(lambda () (download name #t))
(lambda (dir commit)
(and=> (description->alist (with-input-from-file
(string-append dir "/DESCRIPTION") read-string))
(lambda (meta)
(cons* `(git . ,name)
`(git-commit . ,commit)
meta))))))))
(and (string-prefix? "http" name)
;; Download the git repository at "NAME"
(call-with-values
(lambda () (download name #t))
(lambda (dir commit)
(and=> (description->alist (with-input-from-file
(string-append dir "/DESCRIPTION") read-string))
(lambda (meta)
(cons* `(git . ,name)
`(git-commit . ,commit)
meta)))))))))
(define (listify meta field)
"Look up FIELD in the alist META. If FIELD contains a comma-separated