guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: utils: Add helper method to make files writable.


From: Marius Bakke
Subject: 02/02: utils: Add helper method to make files writable.
Date: Thu, 26 Jan 2017 21:21:08 +0000 (UTC)

mbakke pushed a commit to branch core-updates
in repository guix.

commit 5a64a791317d98171435eff541a835ab0d3f498c
Author: Marius Bakke <address@hidden>
Date:   Wed Jan 25 16:28:03 2017 +0100

    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.
---
 gnu/build/activation.scm        |    5 -----
 guix/build/gnu-build-system.scm |    6 ++++--
 guix/build/utils.scm            |    6 ++++++
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 1b31dc1..756a687 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -78,11 +78,6 @@
 (define (dot-or-dot-dot? file)
   (member 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-account-skeletons home
                                  #:optional (directory %skeleton-directory))
   "Copy the account skeletons from DIRECTORY to HOME."
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 39ed1e4..1786e2e 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 9e9ac90..e8efb06 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]