guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/07: self: Make (guix config) generation really stateless.


From: Ludovic Courtès
Subject: 02/07: self: Make (guix config) generation really stateless.
Date: Mon, 18 Jun 2018 17:19:59 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 45779fa676419de8838cb26b6c7a24678a2be1cd
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jun 18 22:43:44 2018 +0200

    self: Make (guix config) generation really stateless.
    
    Previously the %CONFIG-VARIABLES list would be generated based on what
    the current (guix config) contains.  Thus, it would include
    '%guix-register-program', which we recently removed, because
    existing (guix config) most likely contained that variable.  Since its
    value could differ from machine to machine, the build farm could be
    building a different config.scm, thereby preventing people from getting
    substitutes.
    
    * guix/self.scm (%config-variables): Turn into a white list instead of
    taking all the remaining variables from the current (guix config).
    * build-aux/build-self.scm (%config-variables): Likewise.
---
 build-aux/build-self.scm | 21 ++++++++++-----------
 guix/self.scm            | 24 +++++++++++-------------
 2 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index 5898b65..4de91f7 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -63,17 +63,16 @@
     %guix-home-page-url))
 
 (define %config-variables
-  ;; (guix config) variables corresponding to Guix configuration (storedir,
-  ;; localstatedir, etc.)
-  (sort (filter pair?
-                (module-map (lambda (name var)
-                              (and (not (memq name %dependency-variables))
-                                   (not (memq name %persona-variables))
-                                   (cons name (variable-ref var))))
-                            (resolve-interface '(guix config))))
-        (lambda (name+value1 name+value2)
-          (string<? (symbol->string (car name+value1))
-                    (symbol->string (car name+value2))))))
+  ;; (guix config) variables corresponding to Guix configuration.
+  (letrec-syntax ((variables (syntax-rules ()
+                               ((_)
+                                '())
+                               ((_ variable rest ...)
+                                (cons `(variable . ,variable)
+                                      (variables rest ...))))))
+    (variables %config-directory %localstatedir %state-directory
+               %store-database-directory %store-directory
+               %storedir %sysconfdir %system)))
 
 (define* (make-config.scm #:key libgcrypt zlib gzip xz bzip2
                           (package-name "GNU Guix")
diff --git a/guix/self.scm b/guix/self.scm
index 5a10f72..cce418d 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -26,9 +26,8 @@
   #:use-module (guix discovery)
   #:use-module (guix packages)
   #:use-module (guix sets)
-  #:use-module (guix utils)
   #:use-module (guix modules)
-  #:use-module (guix build utils)
+  #:use-module ((guix build utils) #:select (find-files))
   #:use-module ((guix build compile) #:select (%lightweight-optimizations))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-9)
@@ -666,17 +665,16 @@ assumed to be part of MODULES."
     %guix-home-page-url))
 
 (define %config-variables
-  ;; (guix config) variables corresponding to Guix configuration (storedir,
-  ;; localstatedir, etc.)
-  (sort (filter pair?
-                (module-map (lambda (name var)
-                              (and (not (memq name %dependency-variables))
-                                   (not (memq name %persona-variables))
-                                   (cons name (variable-ref var))))
-                            (resolve-interface '(guix config))))
-        (lambda (name+value1 name+value2)
-          (string<? (symbol->string (car name+value1))
-                    (symbol->string (car name+value2))))))
+  ;; (guix config) variables corresponding to Guix configuration.
+  (letrec-syntax ((variables (syntax-rules ()
+                               ((_)
+                                '())
+                               ((_ variable rest ...)
+                                (cons `(variable . ,variable)
+                                      (variables rest ...))))))
+    (variables %config-directory %localstatedir %state-directory
+               %store-database-directory %store-directory
+               %storedir %sysconfdir %system)))
 
 (define* (make-config.scm #:key libgcrypt zlib gzip xz bzip2
                           (package-name "GNU Guix")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]