From 637db76d7ad1af5323a6a6b87b8a6a2e6dfed754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 24 Mar 2020 18:12:30 +0100 Subject: [PATCH] guix system: Fix mistaken 'guix pull' warning upon 'reconfigure'. Fixes . Reported by Florian Pelz . * guix/scripts/system.scm (maybe-suggest-running-guix-pull): Check whether 'current-profile' returns true instead of checking for the existence of ~root/.config/guix/current. That way, "sudo guix system reconfigure" no longer emits a warning in that case. --- guix/scripts/system.scm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 8d1938281a..61a3c95dbd 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -27,6 +27,7 @@ #:use-module ((guix status) #:select (with-status-verbosity)) #:use-module (guix store) #:autoload (guix store database) (register-path) + #:use-module (guix describe) #:use-module (guix grafts) #:use-module (guix gexp) #:use-module (guix derivations) @@ -718,16 +719,11 @@ checking this by themselves in their 'check' procedure." (define (maybe-suggest-running-guix-pull) "Suggest running 'guix pull' if this has never been done before." - ;; The reason for this is that the 'guix' binding that we see here comes - ;; from either ~/.config/latest or, if it's missing, from the - ;; globally-installed Guix, which is necessarily older. See - ;; for - ;; a discussion. - (define latest - (string-append (config-directory) "/current")) - - (unless (file-exists? latest) - (warning (G_ "~a not found: 'guix pull' was never run~%") latest) + ;; Check whether we're running a 'guix pull'-provided 'guix' command. When + ;; 'current-profile' returns #f, we may be running the globally-installed + ;; 'guix' and thus run the risk of deploying an older 'guix'. See + ;; + (unless (or (current-profile) (getenv "GUIX_UNINSTALLED")) (warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%")) (warning (G_ "Failing to do that may downgrade your system!~%"))))