self: Optimize 'file-append*' for 'local-file?'.

* guix/self.scm (file-append*): Add 'local-file?' case.
* guix/gexp.scm (local-file-select?): Export.
This commit is contained in:
Ludovic Courtès 2020-05-25 17:33:04 +02:00
parent 8c23d7a15e
commit f408d8d636
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 10 additions and 1 deletions

View File

@ -51,6 +51,7 @@
local-file-absolute-file-name
local-file-name
local-file-recursive?
local-file-select?
plain-file
plain-file?

View File

@ -213,7 +213,15 @@ record with the new file name."
;; itself.
(local-file (string-append item "/" file)
#:recursive? recursive?))
;; TODO: Add 'local-file?' case.
((? local-file? base)
;; Likewise, but with a <local-file>.
(if (local-file-recursive? base)
(local-file (string-append (local-file-absolute-file-name base)
"/" file)
(basename file)
#:recursive? recursive?
#:select? (local-file-select? base))
(file-append base file)))
(_
;; In this case, anything that refers to the result also depends on ITEM,
;; which isn't great.