guix-commits
[Top][All Lists]
Advanced

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

branch version-1.4.0 updated: installer: Log provenance data.


From: guix-commits
Subject: branch version-1.4.0 updated: installer: Log provenance data.
Date: Mon, 05 Dec 2022 09:04:17 -0500

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch version-1.4.0
in repository guix.

The following commit(s) were added to refs/heads/version-1.4.0 by this push:
     new 241772d5c0 installer: Log provenance data.
241772d5c0 is described below

commit 241772d5c068fb7c4fa69d4673174254742eb410
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Dec 5 14:57:15 2022 +0100

    installer: Log provenance data.
    
    * gnu/installer.scm (provenance-sexp): New procedure.
    (installer-program)[installer-builder]: Add 'installer-log-line' call.
---
 gnu/installer.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/installer.scm b/gnu/installer.scm
index 0e40b81224..d9b71e2ca8 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -27,6 +27,8 @@
   #:use-module (guix utils)
   #:use-module (guix ui)
   #:use-module ((guix self) #:select (make-config.scm))
+  #:use-module (guix describe)
+  #:use-module (guix channels)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (gnu installer utils)
@@ -52,6 +54,7 @@
   #:use-module (gnu system locale)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
+  #:use-module (web uri)
   #:export (installer-program))
 
 (define module-to-import?
@@ -315,6 +318,25 @@ selected keymap."
              ((installer-final-page current-installer)
               result prev-steps))))))))
 
+(define (provenance-sexp)
+  "Return an sexp representing the currently-used channels, for logging
+purposes."
+  (match (match (current-channels)
+           (() (and=> (repository->guix-channel (dirname (current-filename)))
+                      list))
+           (channels channels))
+    (#f
+     (warning (G_ "cannot determine installer provenance~%"))
+     'unknown)
+    ((channels ...)
+     (map (lambda (channel)
+            (let* ((uri (string->uri (channel-url channel)))
+                   (url (if (or (not uri) (eq? 'file (uri-scheme uri)))
+                            "local checkout"
+                            (channel-url channel))))
+             `(channel ,(channel-name channel) ,url ,(channel-commit 
channel))))
+          channels))))
+
 (define (installer-program)
   "Return a file-like object that runs the given INSTALLER."
   (define init-gettext
@@ -429,6 +451,9 @@ selected keymap."
             (define current-installer newt-installer)
             (define steps (#$steps current-installer))
 
+            (installer-log-line "installer provenance: ~s"
+                                '#$(provenance-sexp))
+
             (dynamic-wind
               (installer-init current-installer)
               (lambda ()



reply via email to

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