summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/linux-initrd.scm8
-rw-r--r--guix/build/union.scm29
2 files changed, 32 insertions, 5 deletions
diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm
index 208ad711ef..cbdb363b4e 100644
--- a/guix/build/linux-initrd.scm
+++ b/guix/build/linux-initrd.scm
@@ -80,13 +80,19 @@
(mknod (scope "dev/vda2") 'block-special #o644 (device-number 8 2))
;; TTYs.
+ (mknod (scope "dev/tty") 'char-special #o600
+ (device-number 5 0))
(let loop ((n 0))
(and (< n 50)
(let ((name (format #f "dev/tty~a" n)))
- (mknod (scope name) 'block-special #o644
+ (mknod (scope name) 'char-special #o600
(device-number 4 n))
(loop (+ 1 n)))))
+ ;; Rendez-vous point for syslogd.
+ (mknod (scope "dev/log") 'socket #o666 0)
+ (mknod (scope "dev/kmsg") 'char-special #o600 (device-number 1 11))
+
;; Other useful nodes.
(mknod (scope "dev/null") 'char-special #o666 (device-number 1 3))
(mknod (scope "dev/zero") 'char-special #o666 (device-number 1 5)))
diff --git a/guix/build/union.scm b/guix/build/union.scm
index 275746d83e..077b7fe530 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -105,7 +105,22 @@ single leaf."
the DIRECTORIES."
(define (file-tree dir)
;; Return the contents of DIR as a tree.
- (match (file-system-fold (const #t)
+
+ (define (others-have-it? subdir)
+ ;; Return #t if other elements of DIRECTORIES have SUBDIR.
+ (let ((subdir (substring subdir (string-length dir))))
+ (any (lambda (other)
+ (and (not (string=? other dir))
+ (file-exists? (string-append other "/" subdir))))
+ directories)))
+
+ (match (file-system-fold (lambda (subdir stat result) ; enter?
+ ;; No need to traverse DIR since there's
+ ;; nothing to union it with. Thus, we avoid
+ ;; creating a gazillon symlinks (think
+ ;; share/emacs/24.3, share/texmf, etc.)
+ (or (string=? subdir dir)
+ (others-have-it? subdir)))
(lambda (file stat result) ; leaf
(match result
(((siblings ...) rest ...)
@@ -117,7 +132,12 @@ the DIRECTORIES."
(((leaves ...) (siblings ...) rest ...)
`(((,(basename dir) ,@leaves) ,@siblings)
,@rest))))
- (const #f) ; skip
+ (lambda (dir stat result) ; skip
+ ;; DIR is not available elsewhere, so treat it
+ ;; as a leaf.
+ (match result
+ (((siblings ...) rest ...)
+ `((,dir ,@siblings) ,@rest))))
(lambda (file stat errno result)
(format (current-error-port) "union-build: ~a: ~a~%"
file (strerror errno)))
@@ -158,8 +178,9 @@ the DIRECTORIES."
(mkdir output)
(let loop ((tree (delete-duplicate-leaves
(cons "."
- (tree-union (append-map (compose tree-leaves file-tree)
- directories)))
+ (tree-union
+ (append-map (compose tree-leaves file-tree)
+ (delete-duplicates directories))))
leaf=?
resolve-collision))
(dir '()))