summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-02-06 22:52:50 +0100
committerLudovic Courtès <ludo@gnu.org>2013-02-06 23:04:10 +0100
commit1be77eac08d33a316d0dd179fcfc2a8a6558aaf5 (patch)
tree0d628aa8074fee9d0808dbea761d52f8fe96406e
parent6211223021cdb477e93d7ba789d5a0119ffb4bd4 (diff)
downloadguix-1be77eac08d33a316d0dd179fcfc2a8a6558aaf5.tar.gz
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.
-rw-r--r--guix/build/union.scm19
1 files changed, 13 insertions, 6 deletions
diff --git a/guix/build/union.scm b/guix/build/union.scm
index a6a4450180..275746d83e 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -137,13 +137,20 @@ the DIRECTORIES."
 
   (define (resolve-collision leaves)
     ;; LEAVES all have the same basename, so choose one of them.
-    (format (current-error-port) "warning: collision encountered: ~{~a ~}~%"
-            leaves)
+    (match (delete-duplicates leaves string=?)
+      ((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.
-    (format (current-error-port) "warning: arbitrarily choosing ~a~%"
-            (car leaves))
-    (car leaves))
+       ;; TODO: Implement smarter strategies.
+       (format (current-error-port) "warning: arbitrarily choosing ~a~%"
+               head)
+       head)))
 
   (setvbuf (current-output-port) _IOLBF)
   (setvbuf (current-error-port) _IOLBF)