~ruther/guix-local

105d0d26648e6b3c221ac287bdd5b06c29a3c5b9 — Ludovic Courtès 5 months ago ecf964c
pull: Remove old code to migrate generations to /var/guix/profiles.

This code was added in 2018 (commit 795d430d90e41eb172315bfccf79c9f13fc0ebfa)
to move profile generations created before that from ~/.config/guix to
/var/guix/profiles.  It has long become useless.

* guix/scripts/pull.scm (migrate-generations): Remove.
(ensure-default-profile): Remove call to ‘migrate-generations’.

Change-Id: I43d3860995be300a065814db6c0482514035bda9
1 files changed, 0 insertions(+), 34 deletions(-)

M guix/scripts/pull.scm
M guix/scripts/pull.scm => guix/scripts/pull.scm +0 -34
@@ 512,43 512,9 @@ true, display what would be built without actually building it."
  ;; The user-friendly name of %CURRENT-PROFILE.
  (string-append (config-directory #:ensure? #f) "/current"))

(define (migrate-generations profile directory)
  "Migrate the generations of PROFILE to DIRECTORY."
  (format (current-error-port)
          (G_ "Migrating profile generations to '~a'...~%")
          %profile-directory)
  (let ((current (generation-number profile)))
    (for-each (lambda (generation)
                (let ((source (generation-file-name profile generation))
                      (target (string-append directory "/current-guix-"
                                             (number->string generation)
                                             "-link")))
                  ;; Note: Don't use 'rename-file' as SOURCE and TARGET might
                  ;; live on different file systems.
                  (symlink (readlink source) target)
                  (delete-file source)))
              (profile-generations profile))
    (symlink (string-append "current-guix-"
                            (number->string current) "-link")
             (string-append directory "/current-guix"))))

(define (ensure-default-profile)
  (ensure-profile-directory)

  ;; In 0.15.0+ we'd create ~/.config/guix/current-[0-9]*-link symlinks.  Move
  ;; them to %PROFILE-DIRECTORY.
  ;;
  ;; XXX: Ubuntu's 'sudo' preserves $HOME by default, and thus the second
  ;; condition below is always false when one runs "sudo guix pull".  As a
  ;; workaround, skip this code when $SUDO_USER is set.  See
  ;; <https://bugs.gnu.org/36785>.
  (unless (or (getenv "SUDO_USER")
              (not (file-exists? %user-profile-directory))
              (string=? %profile-directory
                        (dirname
                         (canonicalize-profile %user-profile-directory))))
    (migrate-generations %user-profile-directory %profile-directory))

  ;; Make sure ~/.config/guix/current points to /var/guix/profiles/….
  (let ((link %user-profile-directory))
    (unless (equal? (false-if-exception (readlink link))