unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Mark /gnu/store as needed for boot.
@ 2017-01-11 20:01 John Darrington
  2017-01-13  8:59 ` Chris Marusich
  2017-01-14 21:30 ` Ludovic Courtès
  0 siblings, 2 replies; 15+ messages in thread
From: John Darrington @ 2017-01-11 20:01 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/system/file-systems.scm (all-subpaths): New procedure.
(file-system-needed-for-boot?): Use it to check for ancestors
of %store-directory.
---
 gnu/system/file-systems.scm | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 4cc1221..d42f271 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -20,6 +20,7 @@
   #:use-module (ice-9 match)
   #:use-module (guix records)
   #:use-module (guix store)
+  #:use-module (guix build utils)
   #:use-module ((gnu build file-systems)
                 #:select (string->uuid uuid->string))
   #:re-export (string->uuid
@@ -95,11 +96,29 @@
   (dependencies     file-system-dependencies      ; list of <file-system>
                     (default '())))               ; or <mapped-device>
 
+
+(define (all-subpaths path)
+  "Given a directory PATH return a list of all paths which
+are ancestors of this path, including PATH itself"
+ (let loop ((path (string-split path #\/))
+	    (ac '()))
+   (if (null? path)
+       ac
+       (loop (cdr path)
+	     (cons
+	      (string-append
+	       (match ac
+		 (()  "/")
+		 ((x _ . _) (string-append x "/"))
+		 ((x . _) x))
+	       (car path))
+	      ac)))))
+
 (define-inlinable (file-system-needed-for-boot? fs)
-  "Return true if FS has the 'needed-for-boot?' flag set, or if it's the root
-file system."
+  "Return true if FS has the 'needed-for-boot?' flag set, or if it holds
+the store directory."
   (or (%file-system-needed-for-boot? fs)
-      (string=? "/" (file-system-mount-point fs))))
+      (member (file-system-mount-point fs) (all-subpaths (%store-directory)))))
 
 (define (file-system->spec fs)
   "Return a list corresponding to file-system FS that can be passed to the
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [PATCH] gnu: Mark /gnu/store as needed for boot.
@ 2017-01-11 17:48 John Darrington
  0 siblings, 0 replies; 15+ messages in thread
From: John Darrington @ 2017-01-11 17:48 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/system/file-systems.scm (all-subpaths): New procedure.
(file-system-needed-for-boot?): Use it to check for ancestors
of %store-directory.
---
 gnu/system/file-systems.scm | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 4cc1221..6789b0d 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -20,6 +20,7 @@
   #:use-module (ice-9 match)
   #:use-module (guix records)
   #:use-module (guix store)
+  #:use-module (guix build utils)
   #:use-module ((gnu build file-systems)
                 #:select (string->uuid uuid->string))
   #:re-export (string->uuid
@@ -95,11 +96,29 @@
   (dependencies     file-system-dependencies      ; list of <file-system>
                     (default '())))               ; or <mapped-device>
 
+
+(define (all-subpaths path)
+  "Given a directory PATH return a list of all paths which
+are ancestors of this path, including PATH itself"
+ (let loop ((path (string-split path #\/))
+	    (ac '()))
+   (if (null? path)
+       ac
+       (loop (cdr path)
+	     (cons
+	      (string-append
+	       (match ac
+		 (()  "/")
+		 ((x _ . _) (string-append x "/"))
+		 ((x . _) x))
+	       (car path))
+	      ac)))))
+
 (define-inlinable (file-system-needed-for-boot? fs)
-  "Return true if FS has the 'needed-for-boot?' flag set, or if it's the root
-file system."
+  "Return true if FS has the 'needed-for-boot?' flag set, or if it holds
+the store directory."
   (or (%file-system-needed-for-boot? fs)
-      (string=? "/" (file-system-mount-point fs))))
+      (member (file-system-mount-point fs) %store-directory)))
 
 (define (file-system->spec fs)
   "Return a list corresponding to file-system FS that can be passed to the
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-01-18 21:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-11 20:01 [PATCH] gnu: Mark /gnu/store as needed for boot John Darrington
2017-01-13  8:59 ` Chris Marusich
2017-01-13 11:01   ` John Darrington
2017-01-14 21:30 ` Ludovic Courtès
2017-01-15  6:32   ` John Darrington
2017-01-15  9:53     ` David Craven
2017-01-15 11:18       ` John Darrington
2017-01-15 22:24     ` Ludovic Courtès
2017-01-16 12:46       ` John Darrington
2017-01-16 22:28         ` Ludovic Courtès
2017-01-17 22:52           ` ABI break! Ludovic Courtès
2017-01-18  6:17             ` John Darrington
2017-01-18 10:56               ` David Craven
2017-01-18 21:25               ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2017-01-11 17:48 [PATCH] gnu: Mark /gnu/store as needed for boot John Darrington

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).