graft: Only create directory when needed.

* guix/build/graft.scm (rewrite-directory)[rewrite-leaf]: Only create
the parent directories when they don't already exist.

Change-Id: I802aac4d6090ed07effddde3eb3195f64aca31d3
This commit is contained in:
Efraim Flashner 2024-07-23 20:21:11 +03:00
parent c74401749a
commit 56395b12f6
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351

View file

@ -347,7 +347,8 @@ (define (destination file)
(define (rewrite-leaf file) (define (rewrite-leaf file)
(let ((stat (lstat file)) (let ((stat (lstat file))
(dest (destination file))) (dest (destination file)))
(mkdir-p (dirname dest)) (unless (file-exists? (dirname dest))
(mkdir-p (dirname dest)))
(case (stat:type stat) (case (stat:type stat)
((symlink) ((symlink)
(let ((target (readlink file))) (let ((target (readlink file)))