From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: [PATCH core-updates 6/6] utils: Add helper method to make files writable. Date: Wed, 25 Jan 2017 18:19:38 +0100 Message-ID: <20170125171938.27271-7-mbakke@fastmail.com> References: <20170125171938.27271-1-mbakke@fastmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWREi-0002vo-Jv for guix-devel@gnu.org; Wed, 25 Jan 2017 12:19:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWREf-0006ZV-Fq for guix-devel@gnu.org; Wed, 25 Jan 2017 12:19:56 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54885) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cWREf-0006ZJ-BF for guix-devel@gnu.org; Wed, 25 Jan 2017 12:19:53 -0500 In-Reply-To: <20170125171938.27271-1-mbakke@fastmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: Marius Bakke * 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 1b31dc153..756a6872b 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 59394c2ca..e83ec22ae 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -393,8 +393,10 @@ makefiles." (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. + (make-file-writable file) + (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 cf0932639..021df1bfb 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -48,6 +48,7 @@ with-directory-excursion mkdir-p install-file + make-file-writable copy-recursively delete-file-recursively file-name-predicate @@ -237,6 +238,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)) -- 2.11.0