summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-06-05 18:40:10 +0200
committerRicardo Wurmus <rekado@elephly.net>2023-06-05 18:55:11 +0200
commita025d8fee6c8df1db750058d41f984103eb77978 (patch)
tree499748f3f1cb20c2ecdbf05ee5f44480a0e74c39
parent52e0a77a1b66e2ba5fa0dbac2f1dad35856d0586 (diff)
import/cran: Ensure current package is not among inputs.
* guix/import/cran.scm (cran-package-inputs): Remove the current package from the result.
-rw-r--r--guix/import/cran.scm27
1 files changed, 16 insertions, 11 deletions
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index d21acda22b..59ed65d929 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -601,6 +601,7 @@ META."
"Return the list of <upstream-input> corresponding to all the dependencies
of META, a package in REPOSITORY."
(let* ((url (cran-package-source-url meta repository))
+ (name (assoc-ref meta "Package"))
(source (download-source url
#:method
(cond ((assoc-ref meta 'git) 'git)
@@ -608,17 +609,21 @@ of META, a package in REPOSITORY."
(else #f))))
(tarball? (not (or (assoc-ref meta 'git)
(assoc-ref meta 'hg)))))
- (sort (append (source->dependencies source tarball?)
- (filter-map (lambda (name)
- (and (not (member name invalid-packages))
- (upstream-input
- (name name)
- (downstream-name
- (transform-sysname name)))))
- (map string-downcase
- (listify meta "SystemRequirements")))
- (cran-package-propagated-inputs meta)
- (vignette-builders meta))
+ (sort (filter
+ ;; Prevent tight cycles.
+ (lambda (input)
+ ((negate string=?) name (upstream-input-name input)))
+ (append (source->dependencies source tarball?)
+ (filter-map (lambda (name)
+ (and (not (member name invalid-packages))
+ (upstream-input
+ (name name)
+ (downstream-name
+ (transform-sysname name)))))
+ (map string-downcase
+ (listify meta "SystemRequirements")))
+ (cran-package-propagated-inputs meta)
+ (vignette-builders meta)))
(lambda (input1 input2)
(string<? (upstream-input-downstream-name input1)
(upstream-input-downstream-name input2))))))