GNU bug report logs -
#38408
[PATCH 0/3] (WIP) Semantic version aware recusive importer for crates
Previous Next
Reported by: Martin Becze <mjbecze <at> riseup.net>
Date: Thu, 28 Nov 2019 00:14:01 UTC
Severity: normal
Tags: patch
Merged with 44560,
44694
Fixed in version 44560
Done: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
* guix/import/crate.scm: (crate-version-dependencies): dedup deps
---
guix/import/crate.scm | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 5683369b7a..f3c36ba516 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -109,14 +109,26 @@ 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))
+ ;; split normal and build dependencies
+ (deps-normal deps-build (partition (lambda (dep)
+ (eq? (crate-dependency-kind dep) 'normal))
+ deps)))
+ ;;remove duplicate normal and build dependencies
+ (lset-union (lambda (a b)
+ (string= (crate-dependency-id a) (crate-dependency-id a)))
+ deps-normal deps-build)))
;;;
--
2.24.0
This bug report was last modified 4 years and 159 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.