import/cran: description->package: Use COND and computed booleans.

* guix/import/cran.scm (description->package): Use COND with previously
computed booleans instead of using CASE on REPOSITORY.
This commit is contained in:
Ricardo Wurmus 2022-08-12 19:59:50 +02:00
parent 8c620a6036
commit ec92bcaadd
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC

@ -516,10 +516,10 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
(package (package
`(package `(package
(name ,(cran-guix-name name)) (name ,(cran-guix-name name))
(version ,(case repository (version ,(cond
((git) (git?
`(git-version ,version revision commit)) `(git-version ,version revision commit))
((hg) (hg?
`(string-append ,version "-" revision "." changeset)) `(string-append ,version "-" revision "." changeset))
(else version))) (else version)))
(source (origin (source (origin
@ -527,12 +527,12 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
(git? 'git-fetch) (git? 'git-fetch)
(hg? 'hg-fetch) (hg? 'hg-fetch)
(else 'url-fetch))) (else 'url-fetch)))
(uri ,(case repository (uri ,(cond
((git) (git?
`(git-reference `(git-reference
(url ,(assoc-ref meta 'git)) (url ,(assoc-ref meta 'git))
(commit commit))) (commit commit)))
((hg) (hg?
`(hg-reference `(hg-reference
(url ,(assoc-ref meta 'hg)) (url ,(assoc-ref meta 'hg))
(changeset changeset))) (changeset changeset)))
@ -576,12 +576,12 @@ from the alist META, which was derived from the R package's DESCRIPTION file."
""))) "")))
(license ,license)))) (license ,license))))
(values (values
(case repository (cond
((git) (git?
`(let ((commit ,(assoc-ref meta 'git-commit)) `(let ((commit ,(assoc-ref meta 'git-commit))
(revision "1")) (revision "1"))
,package)) ,package))
((hg) (hg?
`(let ((changeset ,(assoc-ref meta 'hg-changeset)) `(let ((changeset ,(assoc-ref meta 'hg-changeset))
(revision "1")) (revision "1"))
,package)) ,package))