diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-10-01 17:10:49 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-10-01 17:10:49 -0400 |
commit | 2e65e4834a226c570866f2e8976ed7f252b45cd1 (patch) | |
tree | 21d625bce8d03627680214df4a6622bf8eb79dc9 /guix/derivations.scm | |
parent | 9c68ecb24dd1660ce736cdcdea0422a73ec318a2 (diff) | |
parent | f1a3c11407b52004e523ec5de20d326c5661681f (diff) |
Merge remote-tracking branch 'origin/master' into staging
With resolved conflicts in:
gnu/packages/bittorrent.scm
gnu/packages/databases.scm
gnu/packages/geo.scm
gnu/packages/gnupg.scm
gnu/packages/gstreamer.scm
gnu/packages/gtk.scm
gnu/packages/linux.scm
gnu/packages/python-xyz.scm
gnu/packages/xorg.scm
guix/build/qt-utils.scm
Diffstat (limited to 'guix/derivations.scm')
-rw-r--r-- | guix/derivations.scm | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 2fe684cc18..33f4dc5d9d 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -241,32 +241,29 @@ the store." "Return a list of inputs, such that when INPUTS contains the same DRV twice, they are coalesced, with their sub-derivations merged. This is needed because Nix itself keeps only one of them." - (define (find pred lst) ;inlinable copy of 'find' - (let loop ((lst lst)) - (match lst - (() #f) - ((head . tail) - (if (pred head) head (loop tail)))))) + (define table + (make-hash-table 25)) - (fold (lambda (input result) - (match input - (($ <derivation-input> (= derivation-file-name path) sub-drvs) - ;; XXX: quadratic - (match (find (match-lambda - (($ <derivation-input> (= derivation-file-name p) - s) - (string=? p path))) - result) - (#f - (cons input result)) - ((and dup ($ <derivation-input> drv sub-drvs2)) - ;; Merge DUP with INPUT. - (let ((sub-drvs (delete-duplicates - (append sub-drvs sub-drvs2)))) - (cons (make-derivation-input drv (sort sub-drvs string<?)) - (delq dup result)))))))) - '() - inputs)) + (for-each (lambda (input) + (let* ((drv (derivation-input-path input)) + (sub-drvs (derivation-input-sub-derivations input))) + (match (hash-get-handle table drv) + (#f + (hash-set! table drv input)) + ((and handle (key . ($ <derivation-input> drv sub-drvs2))) + ;; Merge DUP with INPUT. + (let* ((sub-drvs (delete-duplicates + (append sub-drvs sub-drvs2))) + (input + (make-derivation-input drv + (sort sub-drvs string<?)))) + (set-cdr! handle input)))))) + inputs) + + (hash-fold (lambda (key input lst) + (cons input lst)) + '() + table)) (define* (derivation-prerequisites drv #:optional (cut? (const #f))) "Return the list of derivation-inputs required to build DRV, recursively. |