pull: Simplify the builder.

* guix/scripts/pull.scm (unpack)[builder]: Use 'copy-recursively' and
  'copy-file' instead of 'file-system-fold'.
This commit is contained in:
Ludovic Courtès 2013-10-12 23:45:57 +02:00
parent ab5d72ad2b
commit 52af657aee
1 changed files with 5 additions and 21 deletions

View File

@ -47,6 +47,8 @@ files."
(ice-9 ftw) (ice-9 ftw)
(ice-9 match)) (ice-9 match))
(setvbuf (current-output-port) _IOLBF)
(setvbuf (current-error-port) _IOLBF)
(let ((out (assoc-ref %outputs "out")) (let ((out (assoc-ref %outputs "out"))
(tar (assoc-ref %build-inputs "tar")) (tar (assoc-ref %build-inputs "tar"))
(gzip (assoc-ref %build-inputs "gzip")) (gzip (assoc-ref %build-inputs "gzip"))
@ -66,27 +68,9 @@ files."
(format #t "copying and compiling Guix to `~a'...~%" out) (format #t "copying and compiling Guix to `~a'...~%" out)
;; Copy everything under guix/ and gnu/ plus guix.scm. ;; Copy everything under guix/ and gnu/ plus guix.scm.
(file-system-fold (lambda (dir stat result) ; enter? (copy-recursively "guix" (string-append out "/guix"))
(or (string-prefix? "./guix" dir) (copy-recursively "gnu" (string-append out "/gnu"))
(string-prefix? "./gnu" dir) (copy-file "guix.scm" (string-append out "/guix.scm"))
(string=? "." dir)))
(lambda (file stat result) ; leaf
(when (or (not (string=? (dirname file) "."))
(string=? (basename file) "guix.scm"))
(let ((target (string-drop file 1)))
(copy-file file
(string-append out target)))))
(lambda (dir stat result) ; down
(mkdir (string-append out
(string-drop dir 1))))
(const #t) ; up
(const #t) ; skip
(lambda (file stat errno result)
(error "cannot access file"
file (strerror errno)))
#f
"."
lstat)
;; Add a fake (guix config) module to allow the other modules to be ;; Add a fake (guix config) module to allow the other modules to be
;; compiled. The user's (guix config) is the one that will be used. ;; compiled. The user's (guix config) is the one that will be used.