mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
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.
This commit is contained in:
parent
14551e073f
commit
5a64a79131
3 changed files with 10 additions and 7 deletions
|
@ -78,11 +78,6 @@ (define %skeleton-directory
|
||||||
(define (dot-or-dot-dot? file)
|
(define (dot-or-dot-dot? file)
|
||||||
(member 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
|
(define* (copy-account-skeletons home
|
||||||
#:optional (directory %skeleton-directory))
|
#:optional (directory %skeleton-directory))
|
||||||
"Copy the account skeletons from DIRECTORY to HOME."
|
"Copy the account skeletons from DIRECTORY to HOME."
|
||||||
|
|
|
@ -392,8 +392,10 @@ (define (strip-dir dir)
|
||||||
(and (or (elf-file? file) (ar-file? file))
|
(and (or (elf-file? file) (ar-file? file))
|
||||||
(or (not debug-output)
|
(or (not debug-output)
|
||||||
(make-debug-file file))
|
(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
|
(zero? (apply system* strip-command
|
||||||
(append strip-flags (list file))))
|
(append strip-flags (list file))))
|
||||||
(or (not debug-output)
|
(or (not debug-output)
|
||||||
|
|
|
@ -50,6 +50,7 @@ (define-module (guix build utils)
|
||||||
with-directory-excursion
|
with-directory-excursion
|
||||||
mkdir-p
|
mkdir-p
|
||||||
install-file
|
install-file
|
||||||
|
make-file-writable
|
||||||
copy-recursively
|
copy-recursively
|
||||||
delete-file-recursively
|
delete-file-recursively
|
||||||
file-name-predicate
|
file-name-predicate
|
||||||
|
@ -262,6 +263,11 @@ (define (install-file file directory)
|
||||||
(mkdir-p directory)
|
(mkdir-p directory)
|
||||||
(copy-file file (string-append directory "/" (basename file))))
|
(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
|
(define* (copy-recursively source destination
|
||||||
#:key
|
#:key
|
||||||
(log (current-output-port))
|
(log (current-output-port))
|
||||||
|
|
Loading…
Reference in a new issue