summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-08-28 22:07:05 +0200
committerLudovic Courtès <ludo@gnu.org>2015-08-29 01:25:08 +0200
commit4cc2ed98cf7837e042ad4234c91fe730259a7170 (patch)
treef53ca5200e375146b88caca42b5e5397a10c9a5e
parent90d891fc6c28120ec19c8f3b0e34943b034a0a15 (diff)
downloadguix-4cc2ed98cf7837e042ad4234c91fe730259a7170.tar.gz
utils: Add 'install-file'.
* guix/build/utils.scm (install-file): New procedure.
-rw-r--r--guix/build/utils.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 676a0120e3..16406930b5 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -43,6 +43,7 @@
             ar-file?
             with-directory-excursion
             mkdir-p
+            install-file
             copy-recursively
             delete-file-recursively
             file-name-predicate
@@ -197,6 +198,12 @@ with the bytes in HEADER, a bytevector."
                  (apply throw args))))))
       (() #t))))
 
+(define (install-file file directory)
+  "Create DIRECTORY if it does not exist and copy FILE in there under the same
+name."
+  (mkdir-p directory)
+  (copy-file file (string-append directory "/" (basename file))))
+
 (define* (copy-recursively source destination
                            #:key
                            (log (current-output-port))