diff mbox series

[bug#62264,core-updates,1-6/6] Add `guix index` subcommand

Message ID 87r0tm576h.fsf@gmail.com
State New
Headers show
Series Add `guix index` subcommand | expand

Commit Message

Antoine R. Dumont March 18, 2023, 4:57 p.m. UTC
Hello again,

please find enclosed the remaining patches holding the actual guix
subcommand as described in the introductory email.

Cheers,
--
tony / Antoine R. Dumont (@ardumont)

-----------------------------------------------------------------
gpg fingerprint BF00 203D 741A C9D5 46A8 BE07 52E2 E984 0D10 C3B8
diff mbox series

Patch

From 372b2b9660b8293eebd6280bb46a4ec07d4192a7 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@gmail.com>
Date: Mon, 13 Mar 2023 13:52:38 +0100
Subject: [PATCH core-updates 6/6] Allow gcroot function to exceptionally
 ignore error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored with Ludovic Courtès <ludo@gnu.org>
---
 guix/store/roots.scm  | 10 +++++++++-
 tests/store-roots.scm |  7 ++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/guix/store/roots.scm b/guix/store/roots.scm
index 222f69c5c0..c2b15c33f0 100644
--- a/guix/store/roots.scm
+++ b/guix/store/roots.scm
@@ -105,7 +105,15 @@  (define canonical-root
                                      (map (match-lambda
                                             ((file . properties)
                                              (cons (scope file) properties)))
-                                          (scandir* directory regular?)))))
+                                          (catch 'system-error
+                                            (lambda ()
+                                              (scandir* directory regular?))
+                                            (lambda args
+                                              (if (= ENOENT
+                                                     (system-error-errno
+                                                      args))
+                                                  '()
+                                                  (apply throw args))))))))
              (loop (append rest (map first sub-directories))
                    (append (map canonical-root (filter symlink? files))
                            roots)
diff --git a/tests/store-roots.scm b/tests/store-roots.scm
index 5bcf1bc87e..00a4fe7931 100644
--- a/tests/store-roots.scm
+++ b/tests/store-roots.scm
@@ -1,5 +1,5 @@ 
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019, 2023 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +21,7 @@  (define-module (test-store-deduplication)
   #:use-module (guix store)
   #:use-module (guix store roots)
   #:use-module ((guix utils) #:select (call-with-temporary-directory))
+  #:use-module ((guix config) #:select (%state-directory))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-64))
 
@@ -29,6 +30,10 @@  (define %store
 
 (test-begin "store-roots")
 
+(test-equal "gc-roots, initial"
+  (list (string-append %state-directory "/profiles"))
+  (gc-roots))
+
 (test-assert "gc-roots, regular root"
   (let* ((item (add-text-to-store %store "something"
                                   (random-text)))
-- 
2.36.1