[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#38408] [PATCH v4 5/6] guix: crate: Depublicated dependencies
From: |
Martin Becze |
Subject: |
[bug#38408] [PATCH v4 5/6] guix: crate: Depublicated dependencies |
Date: |
Tue, 10 Dec 2019 14:23:42 -0500 |
* guix/import/crate.scm: (crate-version-dependencies): dedup deps
---
guix/import/crate.scm | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 5683369b7a..535ac2d8e5 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -109,15 +109,22 @@ record or #f if it was not found."
"Return the list of <crate-dependency> records of VERSION, a
<crate-version>."
(let* ((path (assoc-ref (crate-version-links version) "dependencies"))
- (url (string-append (%crate-base-url) path)))
- (match (assoc-ref (or (json-fetch url) '()) "dependencies")
- ((? vector? vector)
- (filter (lambda (dep)
- (not (eq? (crate-dependency-kind dep) 'dev)))
- (map json->crate-dependency (vector->list vector))))
- (_
- '()))))
-
+ (url (string-append (%crate-base-url) path))
+ (deps-list (match (assoc-ref (or (json-fetch url) '()) "dependencies")
+ ((? vector? vector) (vector->list vector))
+ (_
+ '())))
+ ;; turn the raw list into <dependency>'s and remove dev depenedencies
+ (deps (filter-map (lambda (json)
+ (let ((dep (json->crate-dependency json)))
+ (if (eq? (crate-dependency-kind dep) 'dev)
+ #f
+ dep)))
+ deps-list)))
+ ;;remove duplicate dependencies
+ (apply lset-adjoin `(,(lambda (a b)
+ (string-ci=? (crate-dependency-id a)
(crate-dependency-id b)))
+ () ,@deps))))
;;;
;;; Converting crates to Guix packages.
--
2.24.0
- [bug#38408] [PATCH v4 0/6] Semantic version aware recusive importer for crates, Martin Becze, 2019/12/10
- [bug#38408] [PATCH v4 4/6] added "#:skip-build? #t" to the output of (make-crate-sexp). Most the the packages imported will be libaries and won't need to build. The top level package will build them though., Martin Becze, 2019/12/10
- [bug#38408] [PATCH v4 5/6] guix: crate: Depublicated dependencies,
Martin Becze <=
- [bug#38408] [PATCH v4 3/6] Rewrote some of guix/import/crate.scm to use recursive-import-semver and updated script and test., Martin Becze, 2019/12/10
- [bug#38408] [PATCH v4 2/6] gnu: added new procedure, recusive-import-semver, Martin Becze, 2019/12/10
- [bug#38408] [PATCH v4 6/6] guix: import: recursive-import-semver: allow the range of a package to be specified when begining import., Martin Becze, 2019/12/10