union: Ensure that the output is always a directory.
Fixes the creation of single-package profiles, reported by Ludovic Courtès. * guix/build/union.scm (union-build): Add new internal procedure 'union-of-directories' that always creates a directory, containing the code previously used only to merge multiple directories. Call it from the multiple-directory case in 'union' and from the top-level 'union-build'.master
parent
ded1012f3c
commit
6a0b30f36c
|
@ -108,8 +108,19 @@ the INPUTS."
|
||||||
(call-with-values (lambda () (partition file-is-directory? inputs))
|
(call-with-values (lambda () (partition file-is-directory? inputs))
|
||||||
(match-lambda*
|
(match-lambda*
|
||||||
((dirs ())
|
((dirs ())
|
||||||
;; All inputs are directories. Create a new directory
|
;; All inputs are directories.
|
||||||
;; where we will merge the input directories.
|
(union-of-directories output dirs))
|
||||||
|
|
||||||
|
((() (file (? (cut file=? <> file)) ...))
|
||||||
|
;; There are no directories, and all files have the same contents,
|
||||||
|
;; so there's no conflict.
|
||||||
|
(symlink* file output))
|
||||||
|
|
||||||
|
((dirs files)
|
||||||
|
(resolve-collisions output dirs files)))))))
|
||||||
|
|
||||||
|
(define (union-of-directories output dirs)
|
||||||
|
;; Create a new directory where we will merge the input directories.
|
||||||
(mkdir output)
|
(mkdir output)
|
||||||
|
|
||||||
;; Build a hash table mapping each file to a list of input
|
;; Build a hash table mapping each file to a list of input
|
||||||
|
@ -133,19 +144,11 @@ the INPUTS."
|
||||||
(reverse dirs-with-file))))
|
(reverse dirs-with-file))))
|
||||||
table)))
|
table)))
|
||||||
|
|
||||||
((() (file (? (cut file=? <> file)) ...))
|
|
||||||
;; There are no directories, and all files have the same contents,
|
|
||||||
;; so there's no conflict.
|
|
||||||
(symlink* file output))
|
|
||||||
|
|
||||||
((dirs files)
|
|
||||||
(resolve-collisions output dirs files)))))))
|
|
||||||
|
|
||||||
(setvbuf (current-output-port) _IOLBF)
|
(setvbuf (current-output-port) _IOLBF)
|
||||||
(setvbuf (current-error-port) _IOLBF)
|
(setvbuf (current-error-port) _IOLBF)
|
||||||
(when (file-port? log-port)
|
(when (file-port? log-port)
|
||||||
(setvbuf log-port _IOLBF))
|
(setvbuf log-port _IOLBF))
|
||||||
|
|
||||||
(union output (delete-duplicates inputs)))
|
(union-of-directories output (delete-duplicates inputs)))
|
||||||
|
|
||||||
;;; union.scm ends here
|
;;; union.scm ends here
|
||||||
|
|
Reference in New Issue