aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2018-04-01 23:15:08 +0200
committerLudovic Courtès <ludovic.courtes@inria.fr>2018-04-01 23:15:08 +0200
commit543709fbca4f20164b30f1dded33442c373fc9d2 (patch)
treef70893cbfb2c531624d4c8b2129fb0b9f3d2cfd2 /src
parent2fe7ff87e23b18d49bd33cffc4766b7eaa382054 (diff)
downloadcuirass-543709fbca4f20164b30f1dded33442c373fc9d2.tar
cuirass-543709fbca4f20164b30f1dded33442c373fc9d2.tar.gz
base: Do not resort to Coreutils' "chmod".
* src/cuirass/base.scm (make-writable-copy)[chmod+w]: New procedure. Replace 'system*' call with 'file-system-fold' call.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/base.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 0ae06ee..a96f640 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -37,6 +37,7 @@
#:use-module (ice-9 rdelim)
#:use-module (ice-9 receive)
#:use-module (ice-9 atomic)
+ #:use-module (ice-9 ftw)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
@@ -180,11 +181,24 @@ read-only directory."
(define (make-writable-copy source target)
"Create TARGET and make it a writable copy of directory SOURCE; delete
TARGET beforehand if it exists. Return TARGET."
+ (define (chmod+w file stat _)
+ (chmod file (logior #o200 (stat:perms stat))))
+
(mkdir-p (dirname target))
;; Remove any directory with the same name.
(false-if-exception (delete-file-recursively target))
(copy-recursively source target)
- (system* "chmod" "-R" "+w" target)
+
+ ;; Make all the files in TARGET writable.
+ (file-system-fold (const #t) ;enter?
+ chmod+w ;leaf
+ chmod+w ;down
+ (const #t) ;up
+ (const #t) ;skip
+ (const #f) ;error
+ *unspecified* ;init
+ target)
+
target)
(define (compile dir)