union: Don't warn when colliding leaves point to the same file.

* guix/build/union.scm (union-build)[resolve-collision]: Pass LEAVES
  through `delete-duplicates'; warn iff the result contains more than
  one item.
This commit is contained in:
Ludovic Courtès 2013-02-06 22:52:50 +01:00
parent 6211223021
commit 1be77eac08

View File

@ -137,13 +137,20 @@ the DIRECTORIES."
(define (resolve-collision leaves) (define (resolve-collision leaves)
;; LEAVES all have the same basename, so choose one of them. ;; LEAVES all have the same basename, so choose one of them.
(format (current-error-port) "warning: collision encountered: ~{~a ~}~%" (match (delete-duplicates leaves string=?)
leaves) ((one-and-the-same)
;; LEAVES all actually point to the same file, so nothing to worry
;; about.
one-and-the-same)
((and lst (head _ ...))
;; A real collision.
(format (current-error-port) "warning: collision encountered: ~{~a ~}~%"
lst)
;; TODO: Implement smarter strategies. ;; TODO: Implement smarter strategies.
(format (current-error-port) "warning: arbitrarily choosing ~a~%" (format (current-error-port) "warning: arbitrarily choosing ~a~%"
(car leaves)) head)
(car leaves)) head)))
(setvbuf (current-output-port) _IOLBF) (setvbuf (current-output-port) _IOLBF)
(setvbuf (current-error-port) _IOLBF) (setvbuf (current-error-port) _IOLBF)