diff options
author | Marius Bakke <mbakke@fastmail.com> | 2017-01-25 16:28:03 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2017-01-26 22:19:16 +0100 |
commit | 5a64a791317d98171435eff541a835ab0d3f498c (patch) | |
tree | 16d7651fbd58003a8f810ad85fb2f29a37c88766 /guix | |
parent | 14551e073f96d1d3add3eed3036f9eee6371a508 (diff) | |
download | gnu-guix-5a64a791317d98171435eff541a835ab0d3f498c.tar gnu-guix-5a64a791317d98171435eff541a835ab0d3f498c.tar.gz |
utils: Add helper method to make files writable.
* gnu/build/activation.scm (make-file-writable): Move this to ...
* guix/build/utils.scm (make-file-writable): ... here. Export it.
* guix/build/gnu-build-system.scm (strip): Use it.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/gnu-build-system.scm | 6 | ||||
-rw-r--r-- | guix/build/utils.scm | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 39ed1e4d4a..1786e2e3c9 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -392,8 +392,10 @@ makefiles." (and (or (elf-file? file) (ar-file? file)) (or (not debug-output) (make-debug-file file)) - ;; Ensure libraries are writable. - (chmod file #o755) + + ;; Ensure the file is writable. + (begin (make-file-writable file) #t) + (zero? (apply system* strip-command (append strip-flags (list file)))) (or (not debug-output) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 9e9ac90050..e8efb0653a 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -50,6 +50,7 @@ with-directory-excursion mkdir-p install-file + make-file-writable copy-recursively delete-file-recursively file-name-predicate @@ -262,6 +263,11 @@ name." (mkdir-p directory) (copy-file file (string-append directory "/" (basename file)))) +(define (make-file-writable file) + "Make FILE writable for its owner." + (let ((stat (lstat file))) ;XXX: symlinks + (chmod file (logior #o600 (stat:perms stat))))) + (define* (copy-recursively source destination #:key (log (current-output-port)) |