Deduplicate inferior packages including replacements
Previously, duplicates could creep through if the duplicate wasn't exported, and only found as a replacement. Now they're filtered out. This isn't ideal, as duplicates aren't always mistakes, it would be useful still to capture this package, but having multiple entries for the same name+version causes the comparison functionality to break.
This commit is contained in:
parent
0cc749a1fa
commit
fe556f4a4d
1 changed files with 19 additions and 18 deletions
|
|
@ -781,31 +781,32 @@ WHERE job_id = $1")
|
||||||
b-name)))))))
|
b-name)))))))
|
||||||
|
|
||||||
(define (inferior-packages-plus-replacements inf)
|
(define (inferior-packages-plus-replacements inf)
|
||||||
(let* ((packages
|
(let* ((packages (inferior-packages inf))
|
||||||
;; This isn't perfect, sometimes there can be two packages with the
|
|
||||||
;; same name and version, but different derivations. Guix will warn
|
|
||||||
;; about this case though, generally this means only one of the
|
|
||||||
;; packages should be exported.
|
|
||||||
(deduplicate-inferior-packages
|
|
||||||
(inferior-packages inf)))
|
|
||||||
(replacements (filter-map inferior-package-replacement packages))
|
(replacements (filter-map inferior-package-replacement packages))
|
||||||
|
(non-exported-replacements
|
||||||
(package-id-hash-table (make-hash-table)))
|
(let ((package-id-hash-table (make-hash-table)))
|
||||||
|
|
||||||
(for-each (lambda (pkg)
|
(for-each (lambda (pkg)
|
||||||
(hash-set! package-id-hash-table
|
(hash-set! package-id-hash-table
|
||||||
(inferior-package-id pkg)
|
(inferior-package-id pkg)
|
||||||
#t))
|
#t))
|
||||||
packages)
|
packages)
|
||||||
|
|
||||||
(let ((non-exported-replacements
|
|
||||||
(filter (lambda (pkg)
|
(filter (lambda (pkg)
|
||||||
(eq? #f
|
(eq? #f
|
||||||
(hash-ref package-id-hash-table
|
(hash-ref package-id-hash-table
|
||||||
(inferior-package-id pkg))))
|
(inferior-package-id pkg))))
|
||||||
replacements)))
|
replacements)))
|
||||||
|
|
||||||
(append packages non-exported-replacements))))
|
(deduplicated-packages
|
||||||
|
;; This isn't perfect, sometimes there can be two packages with the
|
||||||
|
;; same name and version, but different derivations. Guix will warn
|
||||||
|
;; about this case though, generally this means only one of the
|
||||||
|
;; packages should be exported.
|
||||||
|
(deduplicate-inferior-packages
|
||||||
|
(append! packages non-exported-replacements))))
|
||||||
|
|
||||||
|
|
||||||
|
deduplicated-packages))
|
||||||
|
|
||||||
(define* (insert-packages conn inf packages #:key (process-replacements? #t))
|
(define* (insert-packages conn inf packages #:key (process-replacements? #t))
|
||||||
(let* ((package-license-set-ids
|
(let* ((package-license-set-ids
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue