[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
23/62: database: 'reset-timestamps' can optionally preserve permissions.
From: |
guix-commits |
Subject: |
23/62: database: 'reset-timestamps' can optionally preserve permissions. |
Date: |
Sat, 11 Apr 2020 11:35:48 -0400 (EDT) |
janneke pushed a commit to branch wip-hurd-vm
in repository guix.
commit de7317d6ea322da80d17bf8cbaa98f837a609215
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Apr 6 15:40:30 2020 +0200
database: 'reset-timestamps' can optionally preserve permissions.
* guix/store/database.scm (reset-timestamps): Add
#:preserve-permissions? and honor it.
---
guix/store/database.scm | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 88d05dc..ef52036 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2019 Caleb Ristvedt <address@hidden>
-;;; Copyright © 2018 Ludovic Courtès <address@hidden>
+;;; Copyright © 2018, 2020 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -228,16 +228,18 @@ Every store item in REFERENCES must already be
registered."
;;; High-level interface.
;;;
-(define (reset-timestamps file)
+(define* (reset-timestamps file #:key preserve-permissions?)
"Reset the modification time on FILE and on all the files it contains, if
-it's a directory. While at it, canonicalize file permissions."
+it's a directory. Canonicalize file permissions unless PRESERVE-PERMISSIONS?
+is true."
;; Note: We're resetting to one second after the Epoch like 'guix-daemon'
;; has always done.
(let loop ((file file)
(type (stat:type (lstat file))))
(case type
((directory)
- (chmod file #o555)
+ (unless preserve-permissions?
+ (chmod file #o555))
(utime file 1 1 0 0)
(let ((parent file))
(for-each (match-lambda
@@ -254,7 +256,8 @@ it's a directory. While at it, canonicalize file
permissions."
((symlink)
(utime file 1 1 0 0 AT_SYMLINK_NOFOLLOW))
(else
- (chmod file (if (executable-file? file) #o555 #o444))
+ (unless preserve-permissions?
+ (chmod file (if (executable-file? file) #o555 #o444)))
(utime file 1 1 0 0)))))
(define* (register-path path
- branch wip-hurd-vm created (now f2c72d6), guix-commits, 2020/04/11
- 01/62: install: 'populate-root-file-system' can be passed extra directives., guix-commits, 2020/04/11
- 03/62: vm: 'qemu-image' can pass options to the 'mkfs' command., guix-commits, 2020/04/11
- 05/62: gnu: hurd: Provide our own /libexec/rc script., guix-commits, 2020/04/11
- 02/62: vm: 'qemu-image' accepts a list of extra populate directives., guix-commits, 2020/04/11
- 04/62: gnu: gnumach: Enable kernel debugger (kbd)., guix-commits, 2020/04/11
- 09/62: gnu: hurd: Record the right file name of 'login'., guix-commits, 2020/04/11
- 07/62: gnu: hurd: Use a 32-bit MiG when cross-compiling., guix-commits, 2020/04/11
- 10/62: gnu: hurd: Ensure startup scripts refer to the right programs., guix-commits, 2020/04/11
- 06/62: gnu: cross-libc: Add patch to add 'mach_print' symbol on GNU/Hurd., guix-commits, 2020/04/11
- 23/62: database: 'reset-timestamps' can optionally preserve permissions.,
guix-commits <=
- 11/62: gnu: guile@3: Disable JIT on GNU/Hurd., guix-commits, 2020/04/11
- 20/62: system: hurd: Add "/etc/shadow"., guix-commits, 2020/04/11
- 12/62: gnu: hurd: Add coreutils to startup scripts., guix-commits, 2020/04/11
- 13/62: gnu: hurd: Add util-linux to startup scripts., guix-commits, 2020/04/11
- 17/62: system: hurd: Add "/etc/passwd"., guix-commits, 2020/04/11
- 19/62: system: hurd: Add "/bin/sh" symlink., guix-commits, 2020/04/11
- 18/62: gnu: cross-libc: Add patch to allow 'gettyent' reading store file names., guix-commits, 2020/04/11
- 14/62: system: hurd: Add "/etc/fstab"., guix-commits, 2020/04/11
- 15/62: gnu: hurd: Add "hurd/sbin" to PATH., guix-commits, 2020/04/11
- 16/62: system: hurd: Add ttys symlink in "/etc/ttys"., guix-commits, 2020/04/11