unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 0/6] emacs: Add "M-x guix-system-generations".
@ 2016-01-10  9:53 Alex Kost
  2016-01-10  9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

This patchset adds commands for displaying system generations — an
emacs analog of 'guix system list-generations' shell command.  The
interface is the same as for "M-x guix-generations", i.e. you can look
at installed "system" packages (by pressing RET on a generation), or
compare 2 generations by pressing "=".

Patches:

[PATCH 1/6] guix system: Export <boot-parameters> accessors.

  I just exported this stuff, but perhaps it would be better to move it
  from (guix scripts system) to another module.

[PATCH 2/6] emacs: profiles: Add 'guix-system-profile'.

[PATCH 3/6] emacs: Find packages in system profiles.
[PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff'.
[PATCH 5/6] emacs: Remove 'generation' search type.

  These 3 patches are for some internal changes, related to the fact
  that system packages are installed in "system-NN-link/profile", while
  user packages are installed in "guix-profile-NN-link".

[PATCH 6/6] emacs: Add interface for system generations.

  Is it OK to update 'NEWS' file in this patch?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/6] guix system: Export <boot-parameters> accessors.
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
@ 2016-01-10  9:53 ` Alex Kost
  2016-01-12 20:25   ` Ludovic Courtès
  2016-01-10  9:53 ` [PATCH 2/6] emacs: profiles: Add 'guix-system-profile' Alex Kost
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

* guix/scripts/system.scm (read-boot-parameters, boot-parameters)
(boot-parameters?, boot-parameters-label, boot-parameters-root-device)
(boot-parameters-kernel, boot-parameters-kernel-arguments): Export.
---
 guix/scripts/system.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 1407dc7..1adeceb 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -49,7 +49,14 @@
   #:use-module (srfi srfi-37)
   #:use-module (ice-9 match)
   #:export (guix-system
-            read-operating-system))
+            read-operating-system
+            read-boot-parameters
+            boot-parameters
+            boot-parameters?
+            boot-parameters-label
+            boot-parameters-root-device
+            boot-parameters-kernel
+            boot-parameters-kernel-arguments))
 
 \f
 ;;;
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/6] emacs: profiles: Add 'guix-system-profile'.
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
  2016-01-10  9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
@ 2016-01-10  9:53 ` Alex Kost
  2016-01-12 20:25   ` Ludovic Courtès
  2016-01-10  9:53 ` [PATCH 3/6] emacs: Find packages in system profiles Alex Kost
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

* emacs/guix-profiles.el (guix-system-profile): New variable.
---
 emacs/guix-profiles.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/emacs/guix-profiles.el b/emacs/guix-profiles.el
index 2c19368..43ad1d4 100644
--- a/emacs/guix-profiles.el
+++ b/emacs/guix-profiles.el
@@ -1,6 +1,7 @@
 ;;; guix-profiles.el --- Guix profiles
 
-;; Copyright © 2014 Alex Kost <alezost@gmail.com>
+;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
+;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
 
 ;; This file is part of GNU Guix.
 
@@ -25,6 +26,10 @@
   (expand-file-name "~/.guix-profile")
   "User profile.")
 
+(defvar guix-system-profile
+  (concat guix-config-state-directory "/profiles/system")
+  "System profile.")
+
 (defvar guix-default-profile
   (concat guix-config-state-directory
           "/profiles/per-user/"
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/6] emacs: Find packages in system profiles.
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
  2016-01-10  9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
  2016-01-10  9:53 ` [PATCH 2/6] emacs: profiles: Add 'guix-system-profile' Alex Kost
@ 2016-01-10  9:53 ` Alex Kost
  2016-01-12 20:28   ` Ludovic Courtès
  2016-01-10  9:53 ` [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff' Alex Kost
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

For a usual profile, packages are placed in a profile directory itself,
but for a system profile, packages are placed in 'profile'
sub-directory.  So we need to do some special cases for system profiles
to find packages there as well.

* emacs/guix-base.el (guix-packages-profile): New procedure.
  (guix-manifest-file): Use it.  Add optional 'system?' argument.
* emacs/guix-ui-generation.el (guix-system-generation?)
  (guix-generation-current-packages-profile):  New procedures.
  (guix-generation-packages, guix-generation-insert-packages)
  (guix-generation-packages-buffer): Add optional 'system?' argument.
  (guix-profile-generation-manifest-file)
  (guix-profile-generation-packages-buffer): Adjust accordingly.
* emacs/guix-main.scm (generation-package-specifications+paths): Rename to...
  (profile->specifications+paths): ... this.  Use a single 'profile' argument.
---
 emacs/guix-base.el          | 25 ++++++++++++++++++-------
 emacs/guix-main.scm         |  9 ++++-----
 emacs/guix-ui-generation.el | 36 ++++++++++++++++++++++++++----------
 3 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index dae658e..d720a87 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -1,6 +1,6 @@
 ;;; guix-base.el --- Common definitions   -*- lexical-binding: t -*-
 
-;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
+;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -91,14 +91,25 @@ For the meaning of location, see `guix-find-location'."
   "Return the file name of a PROFILE's GENERATION."
   (format "%s-%s-link" profile generation))
 
-(defun guix-manifest-file (profile &optional generation)
+(defun guix-packages-profile (profile &optional generation system?)
+  "Return a directory where packages are installed for the
+PROFILE's GENERATION.
+
+If SYSTEM? is non-nil, then PROFILE is considered to be a system
+profile.  Unlike usual profiles, for a system profile, packages
+are placed in 'profile' subdirectory."
+  (let ((profile (if generation
+                     (guix-generation-file profile generation)
+                   profile)))
+    (if system?
+        (expand-file-name "profile" profile)
+      profile)))
+
+(defun guix-manifest-file (profile &optional generation system?)
   "Return the file name of a PROFILE's manifest.
-If GENERATION number is specified, return manifest file name for
-this generation."
+See `guix-packages-profile'."
   (expand-file-name "manifest"
-                    (if generation
-                        (guix-generation-file profile generation)
-                      profile)))
+                    (guix-packages-profile profile generation system?)))
 
 ;;;###autoload
 (defun guix-edit (id-or-name)
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 8c38e7c..5460c96 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -144,11 +144,10 @@ return two values: name and version.  For example, for SPEC
     (manifest-entries->package-specifications
      (manifest-entries manifest))))
 
-(define (generation-package-specifications+paths profile number)
-  "Return a list of package specifications and paths for generation NUMBER.
+(define (profile->specifications+paths profile)
+  "Return a list of package specifications and paths for PROFILE.
 Each element of the list is a list of the package specification and its path."
-  (let ((manifest (profile-manifest
-                   (generation-file-name profile number))))
+  (let ((manifest (profile-manifest profile)))
     (map (lambda (entry)
            (list (manifest-entry->package-specification entry)
                  (manifest-entry-item entry)))
diff --git a/emacs/guix-ui-generation.el b/emacs/guix-ui-generation.el
index aa71645..cb32e04 100644
--- a/emacs/guix-ui-generation.el
+++ b/emacs/guix-ui-generation.el
@@ -1,6 +1,6 @@
 ;;; guix-ui-generation.el --- Interface for displaying generations  -*- lexical-binding: t -*-
 
-;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
+;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -78,6 +78,18 @@ Each element from GENERATIONS is a generation number."
       'switch-to-generation* profile generation)
      operation-buffer)))
 
+(defun guix-system-generation? ()
+  "Return non-nil, if current generation is a system one."
+  (eq (guix-buffer-current-entry-type)
+      'system-generation))
+
+(defun guix-generation-current-packages-profile (&optional generation)
+  "Return a directory where packages are installed for the
+current profile's GENERATION."
+  (guix-packages-profile (guix-ui-current-profile)
+                         generation
+                         (guix-system-generation?)))
+
 \f
 ;;; Generation 'info'
 
@@ -324,14 +336,14 @@ performance."
   "Width of an output name \"column\".
 This variable is used in auxiliary buffers for comparing generations.")
 
-(defun guix-generation-packages (profile generation)
+(defun guix-generation-packages (profile generation &optional system?)
   "Return a list of sorted packages installed in PROFILE's GENERATION.
 Each element of the list is a list of the package specification
 and its store path."
   (let ((names+paths (guix-eval-read
                       (guix-make-guile-expression
-                       'generation-package-specifications+paths
-                       profile generation))))
+                       'profile->specifications+paths
+                       (guix-packages-profile profile generation system?)))))
     (sort names+paths
           (lambda (a b)
             (string< (car a) (car b))))))
@@ -360,7 +372,8 @@ Use the full PROFILE file name."
   (indent-to guix-generation-output-name-width 2)
   (insert path "\n"))
 
-(defun guix-generation-insert-packages (buffer profile generation)
+(defun guix-generation-insert-packages (buffer profile generation
+                                               &optional system?)
   "Insert package outputs installed in PROFILE's GENERATION in BUFFER."
   (with-current-buffer buffer
     (setq buffer-read-only nil
@@ -369,9 +382,9 @@ Use the full PROFILE file name."
     (mapc (lambda (name+path)
             (guix-generation-insert-package
              (car name+path) (cadr name+path)))
-          (guix-generation-packages profile generation))))
+          (guix-generation-packages profile generation system?))))
 
-(defun guix-generation-packages-buffer (profile generation)
+(defun guix-generation-packages-buffer (profile generation &optional system?)
   "Return buffer with package outputs installed in PROFILE's GENERATION.
 Create the buffer if needed."
   (let ((buf-name (guix-generation-packages-buffer-name
@@ -379,19 +392,22 @@ Create the buffer if needed."
     (or (and (null guix-generation-packages-update-buffer)
              (get-buffer buf-name))
         (let ((buf (get-buffer-create buf-name)))
-          (guix-generation-insert-packages buf profile generation)
+          (guix-generation-insert-packages buf profile generation system?)
           buf))))
 
 (defun guix-profile-generation-manifest-file (generation)
   "Return the file name of a GENERATION's manifest.
 GENERATION is a generation number of the current profile."
-  (guix-manifest-file (guix-ui-current-profile) generation))
+  (guix-manifest-file (guix-ui-current-profile)
+                      generation
+                      (guix-system-generation?)))
 
 (defun guix-profile-generation-packages-buffer (generation)
   "Insert GENERATION's package outputs in a buffer and return it.
 GENERATION is a generation number of the current profile."
   (guix-generation-packages-buffer (guix-ui-current-profile)
-                                   generation))
+                                   generation
+                                   (guix-system-generation?)))
 
 \f
 ;;; Interactive commands
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff'.
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
                   ` (2 preceding siblings ...)
  2016-01-10  9:53 ` [PATCH 3/6] emacs: Find packages in system profiles Alex Kost
@ 2016-01-10  9:53 ` Alex Kost
  2016-01-12 20:29   ` Ludovic Courtès
  2016-01-10  9:53 ` [PATCH 5/6] emacs: Remove 'generation' search type Alex Kost
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

* emacs/guix-main.scm (generation-package-specifications): Rename to...
  (profile-package-specifications): ... this.  Take a single 'profile'
  argument.
  (generation-difference): Rename to...
  (profile-difference): ... this.  Take profiles as arguments.
  (package/output-sexps): Adjust accordingly.
* emacs/guix-ui-generation.el (guix-generation-list-profiles-to-compare):
  New procedure.
  (guix-generation-list-show-added-packages)
  (guix-generation-list-show-removed-packages): Use it.
* emacs/guix-messages.el (guix-messages): Replace 'generation-diff' with
  'profile-diff'.
  (guix-message-outputs-by-diff): Adjust accordingly.
---
 emacs/guix-main.scm         | 23 +++++++++++------------
 emacs/guix-messages.el      | 21 ++++++++++-----------
 emacs/guix-ui-generation.el | 13 +++++++++----
 3 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 5460c96..dfa9cba 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -137,10 +137,9 @@ return two values: name and version.  For example, for SPEC
 (define (manifest-entries->package-specifications entries)
   (map manifest-entry->package-specification entries))
 
-(define (generation-package-specifications profile number)
-  "Return a list of package specifications for generation NUMBER."
-  (let ((manifest (profile-manifest
-                   (generation-file-name profile number))))
+(define (profile-package-specifications profile)
+  "Return a list of package specifications for PROFILE."
+  (let ((manifest (profile-manifest profile)))
     (manifest-entries->package-specifications
      (manifest-entries manifest))))
 
@@ -153,11 +152,11 @@ Each element of the list is a list of the package specification and its path."
                  (manifest-entry-item entry)))
          (manifest-entries manifest))))
 
-(define (generation-difference profile number1 number2)
-  "Return a list of package specifications for outputs installed in generation
-NUMBER1 and not installed in generation NUMBER2."
-  (let ((specs1 (generation-package-specifications profile number1))
-        (specs2 (generation-package-specifications profile number2)))
+(define (profile-difference profile1 profile2)
+  "Return a list of package specifications for outputs installed in PROFILE1
+and not installed in PROFILE2."
+  (let ((specs1 (profile-package-specifications profile1))
+        (specs2 (profile-package-specifications profile2)))
     (lset-difference string=? specs1 specs2)))
 
 (define (manifest-entries->hash-table entries)
@@ -698,11 +697,11 @@ See 'entry-sexps' for details."
                       profile))
          (manifest (profile-manifest profile))
          (patterns (if (and (eq? entry-type 'output)
-                            (eq? search-type 'generation-diff))
+                            (eq? search-type 'profile-diff))
                        (match search-vals
-                         ((g1 g2)
+                         ((p1 p2)
                           (map specification->output-pattern
-                               (generation-difference profile g1 g2)))
+                               (profile-difference p1 p2)))
                          (_ '()))
                        (apply (patterns-maker entry-type search-type)
                               manifest search-vals)))
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index eb2a76e..234d3d1 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -98,7 +98,7 @@
          val profile)
       (many "%d package outputs installed in generation %d of profile '%s'."
             count val profile))
-     (generation-diff
+     (profile-diff
       guix-message-outputs-by-diff))
 
     (generation
@@ -183,19 +183,18 @@ Try \"M-x guix-search-by-name\"."
                      "matching time period '%s' - '%s'.")
              str-beg profile time-beg time-end)))
 
-(defun guix-message-outputs-by-diff (profile entries generations)
-  "Display a message for outputs searched by GENERATIONS difference."
+(defun guix-message-outputs-by-diff (_ entries profiles)
+  "Display a message for outputs searched by PROFILES difference."
   (let* ((count (length entries))
          (str-beg (guix-message-string-entries count 'output))
-         (gen1 (car  generations))
-         (gen2 (cadr generations)))
+         (profile1 (car  profiles))
+         (profile2 (cadr profiles)))
     (cl-multiple-value-bind (new old str-action)
-        (if (> gen1 gen2)
-            (list gen1 gen2 "added to")
-          (list gen2 gen1 "removed from"))
-      (message (concat "%s %s generation %d comparing with "
-                       "generation %d of profile '%s'.")
-               str-beg str-action new old profile))))
+        (if (string-lessp profile2 profile1)
+            (list profile1 profile2 "added to")
+          (list profile2 profile1 "removed from"))
+      (message "%s %s profile '%s' comparing with profile '%s'."
+               str-beg str-action new old))))
 
 (defun guix-result-message (profile entries entry-type
                             search-type search-vals)
diff --git a/emacs/guix-ui-generation.el b/emacs/guix-ui-generation.el
index cb32e04..eebcedf 100644
--- a/emacs/guix-ui-generation.el
+++ b/emacs/guix-ui-generation.el
@@ -212,6 +212,11 @@ VAL is a boolean value."
         (user-error "2 generations should be marked for comparing")
       (sort numbers #'<))))
 
+(defun guix-generation-list-profiles-to-compare ()
+  "Return a sorted list of 2 marked generation profiles for comparing."
+  (mapcar #'guix-generation-current-packages-profile
+          (guix-generation-list-generations-to-compare)))
+
 (defun guix-generation-list-show-added-packages ()
   "List package outputs added to the latest marked generation.
 If 2 generations are marked with \\[guix-list-mark], display
@@ -221,8 +226,8 @@ installed in the other one."
   (guix-buffer-get-display-entries
    'list 'output
    (cl-list* (guix-ui-current-profile)
-             'generation-diff
-             (reverse (guix-generation-list-generations-to-compare)))
+             'profile-diff
+             (reverse (guix-generation-list-profiles-to-compare)))
    'add))
 
 (defun guix-generation-list-show-removed-packages ()
@@ -234,8 +239,8 @@ installed in the other one."
   (guix-buffer-get-display-entries
    'list 'output
    (cl-list* (guix-ui-current-profile)
-             'generation-diff
-             (guix-generation-list-generations-to-compare))
+             'profile-diff
+             (guix-generation-list-profiles-to-compare))
    'add))
 
 (defun guix-generation-list-compare (diff-fun gen-fun)
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/6] emacs: Remove 'generation' search type.
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
                   ` (3 preceding siblings ...)
  2016-01-10  9:53 ` [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff' Alex Kost
@ 2016-01-10  9:53 ` Alex Kost
  2016-01-12 20:31   ` Ludovic Courtès
  2016-01-10  9:53 ` [PATCH 6/6] emacs: Add interface for system generations Alex Kost
  2016-01-12 20:23 ` [PATCH 0/6] emacs: Add "M-x guix-system-generations" Ludovic Courtès
  6 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

Use 'installed' search type instead.

* emacs/guix-main.scm (%patterns-makers): Remove 'generation'.
  (package/output-sexps): Adjust accordingly.
* emacs/guix-ui-generation.el (guix-generation-info-insert-number):
  Replace 'generation' search with 'installed'.
  (guix-generation-list-show-packages): Likewise.
* emacs/guix-messages.el (guix-messages): Remove 'generation'.
---
 emacs/guix-main.scm         |  7 +------
 emacs/guix-messages.el      | 16 +---------------
 emacs/guix-ui-generation.el |  9 +++++----
 3 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index dfa9cba..1199679 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -668,7 +668,6 @@ ENTRIES is a list of installed manifest entries."
        (id               . ,(apply-to-rest ids->package-patterns))
        (name             . ,(apply-to-rest specifications->package-patterns))
        (installed        . ,manifest-package-proc)
-       (generation       . ,manifest-package-proc)
        (obsolete         . ,(apply-to-first obsolete-package-patterns))
        (regexp           . ,regexp-proc)
        (all-available    . ,all-proc)
@@ -677,7 +676,6 @@ ENTRIES is a list of installed manifest entries."
        (id               . ,(apply-to-rest ids->output-patterns))
        (name             . ,(apply-to-rest specifications->output-patterns))
        (installed        . ,manifest-output-proc)
-       (generation       . ,manifest-output-proc)
        (obsolete         . ,(apply-to-first obsolete-output-patterns))
        (regexp           . ,regexp-proc)
        (all-available    . ,all-proc)
@@ -692,10 +690,7 @@ ENTRIES is a list of installed manifest entries."
                               search-type search-vals)
   "Return information about packages or package outputs.
 See 'entry-sexps' for details."
-  (let* ((profile (if (eq? search-type 'generation)
-                      (generation-file-name profile (car search-vals))
-                      profile))
-         (manifest (profile-manifest profile))
+  (let* ((manifest (profile-manifest profile))
          (patterns (if (and (eq? entry-type 'output)
                             (eq? search-type 'profile-diff))
                        (match search-vals
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index 234d3d1..9f6d833 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -55,14 +55,7 @@
      (obsolete
       (0 "No obsolete packages in profile '%s'." profile)
       (1 "A single obsolete package in profile '%s'." profile)
-      (many "%d obsolete packages in profile '%s'." count profile))
-     (generation
-      (0 "No packages installed in generation %d of profile '%s'."
-         val profile)
-      (1 "A single package installed in generation %d of profile '%s'."
-         val profile)
-      (many "%d packages installed in generation %d of profile '%s'."
-            count val profile)))
+      (many "%d obsolete packages in profile '%s'." count profile)))
 
     (output
      (id
@@ -91,13 +84,6 @@
       (0 "No obsolete package outputs in profile '%s'." profile)
       (1 "A single obsolete package output in profile '%s'." profile)
       (many "%d obsolete package outputs in profile '%s'." count profile))
-     (generation
-      (0 "No package outputs installed in generation %d of profile '%s'."
-         val profile)
-      (1 "A single package output installed in generation %d of profile '%s'."
-         val profile)
-      (many "%d package outputs installed in generation %d of profile '%s'."
-            count val profile))
      (profile-diff
       guix-message-outputs-by-diff))
 
diff --git a/emacs/guix-ui-generation.el b/emacs/guix-ui-generation.el
index eebcedf..5d55c4c 100644
--- a/emacs/guix-ui-generation.el
+++ b/emacs/guix-ui-generation.el
@@ -127,8 +127,9 @@ current profile's GENERATION."
    (lambda (btn)
      (guix-buffer-get-display-entries
       'list guix-package-list-type
-      (list (guix-ui-current-profile)
-            'generation (button-get btn 'number))
+      (list (guix-generation-current-packages-profile
+             (button-get btn 'number))
+            'installed)
       'add))
    "Show installed packages for this generation"
    'number number)
@@ -202,8 +203,8 @@ VAL is a boolean value."
   "List installed packages for the generation at point."
   (interactive)
   (guix-package-get-display
-   (guix-ui-current-profile)
-   'generation (guix-list-current-id)))
+   (guix-generation-current-packages-profile (guix-list-current-id))
+   'installed))
 
 (defun guix-generation-list-generations-to-compare ()
   "Return a sorted list of 2 marked generations for comparing."
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 6/6] emacs: Add interface for system generations.
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
                   ` (4 preceding siblings ...)
  2016-01-10  9:53 ` [PATCH 5/6] emacs: Remove 'generation' search type Alex Kost
@ 2016-01-10  9:53 ` Alex Kost
  2016-01-12 20:35   ` Ludovic Courtès
  2016-01-12 20:23 ` [PATCH 0/6] emacs: Add "M-x guix-system-generations" Ludovic Courtès
  6 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-10  9:53 UTC (permalink / raw)
  To: guix-devel

* emacs/guix-main.scm (system-generation-boot-parameters)
(system-generation-param-alist, system-generation-sexps): New procedures.
(entries): Add 'system-generation' entry type.
* emacs/guix-messages.el (guix-result-message): Use the same messages
  for 'generation' and 'system-generation' entry types.
* emacs/guix-ui-system-generation.el: New file.
* emacs.am (ELFILES): Add it.
* doc/emacs.texi (Emacs Commands): Document new commands.
* NEWS: Mention new interface.
---
 NEWS                               |   1 +
 doc/emacs.texi                     |   8 +++
 emacs.am                           |   1 +
 emacs/guix-main.scm                |  36 +++++++++++++
 emacs/guix-messages.el             |   5 +-
 emacs/guix-ui-system-generation.el | 105 +++++++++++++++++++++++++++++++++++++
 6 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 emacs/guix-ui-system-generation.el

diff --git a/NEWS b/NEWS
index c35c7d6..0084394 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Please send Guix bug reports to bug-guix@gnu.org.
 
 ** Package management
 
+*** Emacs interface for system generations
 *** Emacs interface for hydra.gnu.org
 *** Changes in Emacs interface variables
 In the following names, BUFFER-TYPE means "info" or "list";
diff --git a/doc/emacs.texi b/doc/emacs.texi
index ea340b1..b2a3d47 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -191,6 +191,14 @@ date/time prompt,,, org, The Org Manual}).
 
 @end table
 
+Analogously on GuixSD you can also display system generations:
+
+@table @kbd
+@item M-x guix-system-generations
+@item M-x guix-last-system-generations
+@item M-x guix-system-generations-by-time
+@end table
+
 You can also invoke the @command{guix pull} command (@pxref{Invoking
 guix pull}) from Emacs using:
 
diff --git a/emacs.am b/emacs.am
index 85165b9..d0d4dfb 100644
--- a/emacs.am
+++ b/emacs.am
@@ -47,6 +47,7 @@ ELFILES =					\
   emacs/guix-ui.el				\
   emacs/guix-ui-package.el			\
   emacs/guix-ui-generation.el			\
+  emacs/guix-ui-system-generation.el		\
   emacs/guix-utils.el
 
 if HAVE_EMACS
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 1199679..4baf2df 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -61,6 +61,7 @@
  (guix scripts lint)
  (guix scripts package)
  (guix scripts pull)
+ (guix scripts system)
  (gnu packages))
 
 (define-syntax-rule (first-or-false lst)
@@ -758,6 +759,38 @@ See 'entry-sexps' for details."
                                     params)))
     (map ->sexp generations)))
 
+(define system-generation-boot-parameters
+  (memoize
+   (lambda (profile generation)
+     "Return boot parameters for PROFILE's system GENERATION."
+     (let* ((gen-file   (generation-file-name profile generation))
+            (param-file (string-append gen-file "/parameters")))
+       (call-with-input-file param-file read-boot-parameters)))))
+
+(define (system-generation-param-alist profile)
+  "Return an alist of system generation parameters and procedures for
+PROFILE."
+  (append (generation-param-alist profile)
+          `((label       . ,(lambda (gen)
+                              (boot-parameters-label
+                               (system-generation-boot-parameters
+                                profile gen))))
+            (root-device . ,(lambda (gen)
+                              (boot-parameters-root-device
+                               (system-generation-boot-parameters
+                                profile gen))))
+            (kernel      . ,(lambda (gen)
+                              (boot-parameters-kernel
+                               (system-generation-boot-parameters
+                                profile gen)))))))
+
+(define (system-generation-sexps profile params search-type search-vals)
+  "Return an alist with information about system generations."
+  (let ((generations (find-generations profile search-type search-vals))
+        (->sexp (object-transformer (system-generation-param-alist profile)
+                                    params)))
+    (map ->sexp generations)))
+
 \f
 ;;; Getting package/output/generation entries (alists).
 
@@ -802,6 +835,9 @@ parameter/value pairs."
     ((generation)
      (generation-sexps profile params
                        search-type search-vals))
+    ((system-generation)
+     (system-generation-sexps profile params
+                              search-type search-vals))
     (else (entry-type-error entry-type))))
 
 \f
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index 9f6d833..c4f15dc 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -186,7 +186,10 @@ Try \"M-x guix-search-by-name\"."
                             search-type search-vals)
   "Display an appropriate message after displaying ENTRIES."
   (let* ((type-spec (guix-assq-value guix-messages
-                                     entry-type search-type))
+                                     (if (eq entry-type 'system-generation)
+                                         'generation
+                                       entry-type)
+                                     search-type))
          (fun-or-count-spec (car type-spec)))
     (if (functionp fun-or-count-spec)
         (funcall fun-or-count-spec profile entries search-vals)
diff --git a/emacs/guix-ui-system-generation.el b/emacs/guix-ui-system-generation.el
new file mode 100644
index 0000000..d79f3bc
--- /dev/null
+++ b/emacs/guix-ui-system-generation.el
@@ -0,0 +1,105 @@
+;;; guix-ui-system-generation.el --- Interface for displaying system generations  -*- lexical-binding: t -*-
+
+;; Copyright © 2016 Alex Kost <alezost@gmail.com>
+
+;; This file is part of GNU Guix.
+
+;; GNU Guix is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Guix is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file provides an interface for displaying system generations
+;; in 'list' and 'info' buffers, and commands for working with them.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'guix-list)
+(require 'guix-ui)
+(require 'guix-ui-generation)
+(require 'guix-profiles)
+
+(guix-ui-define-entry-type system-generation)
+
+(defun guix-system-generation-get-display (search-type &rest search-values)
+  "Search for system generations and show results.
+See `guix-ui-get-entries' for the meaning of SEARCH-TYPE and
+SEARCH-VALUES."
+  (apply #'guix-list-get-display-entries
+         'system-generation
+         guix-system-profile
+         search-type search-values))
+
+\f
+;;; System generation 'info'
+
+(guix-ui-info-define-interface system-generation
+  :buffer-name "*Guix Generation Info*"
+  :format '((number format guix-generation-info-insert-number)
+            (label format (format))
+            (prev-number format (format))
+            (current format guix-generation-info-insert-current)
+            (path format (format guix-file))
+            (time format (time))
+            (root-device format (format))
+            (kernel format (format guix-file)))
+  :titles guix-generation-info-titles)
+
+\f
+;;; System generation 'list'
+
+;; FIXME It is better to make `guix-generation-list-shared-map' with
+;; common keys for both usual and system generations.
+(defvar guix-system-generation-list-mode-map
+  (copy-keymap guix-generation-list-mode-map)
+  "Keymap for `guix-system-generation-list-mode' buffers.")
+
+(guix-ui-list-define-interface system-generation
+  :buffer-name "*Guix Generation List*"
+  :format '((number nil 5 guix-list-sort-numerically-0 :right-align t)
+            (current guix-generation-list-get-current 10 t)
+            (label nil 40 t)
+            (time guix-list-get-time 20 t)
+            (path guix-list-get-file-path 30 t))
+  :titles guix-generation-list-titles
+  :sort-key '(number . t)
+  :marks '((delete . ?D)))
+
+\f
+;;; Interactive commands
+
+;;;###autoload
+(defun guix-system-generations ()
+  "Display information about system generations."
+  (interactive)
+  (guix-system-generation-get-display 'all))
+
+;;;###autoload
+(defun guix-last-system-generations (number)
+  "Display information about last NUMBER of system generations."
+  (interactive "nThe number of last generations: ")
+  (guix-system-generation-get-display 'last number))
+
+;;;###autoload
+(defun guix-system-generations-by-time (from to)
+  "Display information about system generations created between FROM and TO."
+  (interactive
+   (list (guix-read-date "Find generations (from): ")
+         (guix-read-date "Find generations (to): ")))
+  (guix-system-generation-get-display
+   'time (float-time from) (float-time to)))
+
+(provide 'guix-ui-system-generation)
+
+;;; guix-ui-system-generation.el ends here
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/6] emacs: Add "M-x guix-system-generations".
  2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
                   ` (5 preceding siblings ...)
  2016-01-10  9:53 ` [PATCH 6/6] emacs: Add interface for system generations Alex Kost
@ 2016-01-12 20:23 ` Ludovic Courtès
  6 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:23 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> This patchset adds commands for displaying system generations — an
> emacs analog of 'guix system list-generations' shell command.  The
> interface is the same as for "M-x guix-generations", i.e. you can look
> at installed "system" packages (by pressing RET on a generation), or
> compare 2 generations by pressing "=".

Awesome!

> Patches:
>
> [PATCH 1/6] guix system: Export <boot-parameters> accessors.
>
>   I just exported this stuff, but perhaps it would be better to move it
>   from (guix scripts system) to another module.
>
> [PATCH 2/6] emacs: profiles: Add 'guix-system-profile'.
>
> [PATCH 3/6] emacs: Find packages in system profiles.
> [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff'.
> [PATCH 5/6] emacs: Remove 'generation' search type.
>
>   These 3 patches are for some internal changes, related to the fact
>   that system packages are installed in "system-NN-link/profile", while
>   user packages are installed in "guix-profile-NN-link".
>
> [PATCH 6/6] emacs: Add interface for system generations.
>
>   Is it OK to update 'NEWS' file in this patch?

Sure.

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/6] guix system: Export <boot-parameters> accessors.
  2016-01-10  9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
@ 2016-01-12 20:25   ` Ludovic Courtès
  2016-01-13 20:44     ` Alex Kost
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:25 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> * guix/scripts/system.scm (read-boot-parameters, boot-parameters)
> (boot-parameters?, boot-parameters-label, boot-parameters-root-device)
> (boot-parameters-kernel, boot-parameters-kernel-arguments): Export.

LGTM.

Eventually (as a replacement of this patch or as a subsequent patch, as
you prefer) we should move these to (gnu system) since this is where we
create the ‘boot-parameters’ sexp.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2/6] emacs: profiles: Add 'guix-system-profile'.
  2016-01-10  9:53 ` [PATCH 2/6] emacs: profiles: Add 'guix-system-profile' Alex Kost
@ 2016-01-12 20:25   ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:25 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> * emacs/guix-profiles.el (guix-system-profile): New variable.

OK!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] emacs: Find packages in system profiles.
  2016-01-10  9:53 ` [PATCH 3/6] emacs: Find packages in system profiles Alex Kost
@ 2016-01-12 20:28   ` Ludovic Courtès
  2016-01-13 20:45     ` Alex Kost
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:28 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1799 bytes --]

Alex Kost <alezost@gmail.com> skribis:

> For a usual profile, packages are placed in a profile directory itself,
> but for a system profile, packages are placed in 'profile'
> sub-directory.  So we need to do some special cases for system profiles
> to find packages there as well.
>
> * emacs/guix-base.el (guix-packages-profile): New procedure.
>   (guix-manifest-file): Use it.  Add optional 'system?' argument.
> * emacs/guix-ui-generation.el (guix-system-generation?)
>   (guix-generation-current-packages-profile):  New procedures.
>   (guix-generation-packages, guix-generation-insert-packages)
>   (guix-generation-packages-buffer): Add optional 'system?' argument.
>   (guix-profile-generation-manifest-file)
>   (guix-profile-generation-packages-buffer): Adjust accordingly.
> * emacs/guix-main.scm (generation-package-specifications+paths): Rename to...
>   (profile->specifications+paths): ... this.  Use a single 'profile' argument.

[...]

> +(defun guix-packages-profile (profile &optional generation system?)
> +  "Return a directory where packages are installed for the
> +PROFILE's GENERATION.
> +
> +If SYSTEM? is non-nil, then PROFILE is considered to be a system
> +profile.  Unlike usual profiles, for a system profile, packages
> +are placed in 'profile' subdirectory."
> +  (let ((profile (if generation
> +                     (guix-generation-file profile generation)
> +                   profile)))
> +    (if system?
> +        (expand-file-name "profile" profile)
> +      profile)))

It seems you’re calling /run/current-system the system profile, which
leads to the ‘system?’ Boolean here, but the system profile really is
/run/current-system/profile.

I had overlooked it, but wouldn’t it be easier if patch #2 did:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 118 bytes --]

+(defvar guix-system-profile
+  (concat guix-config-state-directory "/profiles/system/profile")
+  "System profile.")

[-- Attachment #3: Type: text/plain, Size: 17 bytes --]


?

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff'.
  2016-01-10  9:53 ` [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff' Alex Kost
@ 2016-01-12 20:29   ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:29 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> * emacs/guix-main.scm (generation-package-specifications): Rename to...
>   (profile-package-specifications): ... this.  Take a single 'profile'
>   argument.
>   (generation-difference): Rename to...
>   (profile-difference): ... this.  Take profiles as arguments.
>   (package/output-sexps): Adjust accordingly.
> * emacs/guix-ui-generation.el (guix-generation-list-profiles-to-compare):
>   New procedure.
>   (guix-generation-list-show-added-packages)
>   (guix-generation-list-show-removed-packages): Use it.
> * emacs/guix-messages.el (guix-messages): Replace 'generation-diff' with
>   'profile-diff'.
>   (guix-message-outputs-by-diff): Adjust accordingly.

LGTM.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/6] emacs: Remove 'generation' search type.
  2016-01-10  9:53 ` [PATCH 5/6] emacs: Remove 'generation' search type Alex Kost
@ 2016-01-12 20:31   ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:31 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Use 'installed' search type instead.
>
> * emacs/guix-main.scm (%patterns-makers): Remove 'generation'.
>   (package/output-sexps): Adjust accordingly.
> * emacs/guix-ui-generation.el (guix-generation-info-insert-number):
>   Replace 'generation' search with 'installed'.
>   (guix-generation-list-show-packages): Likewise.
> * emacs/guix-messages.el (guix-messages): Remove 'generation'.

I guess it’s OK.  ;-)

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 6/6] emacs: Add interface for system generations.
  2016-01-10  9:53 ` [PATCH 6/6] emacs: Add interface for system generations Alex Kost
@ 2016-01-12 20:35   ` Ludovic Courtès
  2016-01-13 20:56     ` Alex Kost
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-12 20:35 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> * emacs/guix-main.scm (system-generation-boot-parameters)
> (system-generation-param-alist, system-generation-sexps): New procedures.
> (entries): Add 'system-generation' entry type.
> * emacs/guix-messages.el (guix-result-message): Use the same messages
>   for 'generation' and 'system-generation' entry types.
> * emacs/guix-ui-system-generation.el: New file.
> * emacs.am (ELFILES): Add it.
> * doc/emacs.texi (Emacs Commands): Document new commands.
> * NEWS: Mention new interface.

[...]

> +Analogously on GuixSD you can also display system generations:
> +
> +@table @kbd
> +@item M-x guix-system-generations
> +@item M-x guix-last-system-generations
> +@item M-x guix-system-generations-by-time
> +@end table

As simple as this.  :-)

And I guess it’s also possible to select generations, delete them, and
switch to a specific one, as with M-x guix-generations?

Though maybe it would have to use
“sudo:localhost:/run/current-system/profile” (via Tramp) to be able to
modify things.  Maybe it could somehow offer to gain root privileges
when performing an action?

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/6] guix system: Export <boot-parameters> accessors.
  2016-01-12 20:25   ` Ludovic Courtès
@ 2016-01-13 20:44     ` Alex Kost
  2016-01-13 22:33       ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-13 20:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

Ludovic Courtès (2016-01-12 23:25 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> * guix/scripts/system.scm (read-boot-parameters, boot-parameters)
>> (boot-parameters?, boot-parameters-label, boot-parameters-root-device)
>> (boot-parameters-kernel, boot-parameters-kernel-arguments): Export.
>
> LGTM.
>
> Eventually (as a replacement of this patch or as a subsequent patch, as
> you prefer) we should move these to (gnu system) since this is where we
> create the ‘boot-parameters’ sexp.

Great, I would like to make a replacement.  OK for the attached patch?

(I exported <boot-parameters> because it is used by (guix scripts system))


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Move-boot-parameters-to-gnu-system.patch --]
[-- Type: text/x-patch, Size: 4026 bytes --]

From ac344e3f17741c439aa15a642f1872fd2c7bfd9f Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 8 Jan 2016 02:48:17 +0300
Subject: [PATCH] Move <boot-parameters> to (gnu system).

* guix/scripts/system.scm (<boot-parameters>, boot-parameters)
  (boot-parameters?, boot-parameters-label, boot-parameters-root-device)
  (boot-parameters-kernel, boot-parameters-kernel-arguments):
  (read-boot-parameters) Move to...
* gnu/system.scm: ... here. Export them.
---
 gnu/system.scm          | 42 ++++++++++++++++++++++++++++++++++++++++++
 guix/scripts/system.scm | 33 ---------------------------------
 2 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index 4aedb7e..2600224 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -88,6 +88,15 @@
             operating-system-locale-directory
             operating-system-boot-script
 
+            <boot-parameters>
+            boot-parameters
+            boot-parameters?
+            boot-parameters-label
+            boot-parameters-root-device
+            boot-parameters-kernel
+            boot-parameters-kernel-arguments
+            read-boot-parameters
+
             local-host-aliases
             %setuid-programs
             %base-packages
@@ -709,4 +718,37 @@ this file is the reconstruction of GRUB menu entries for old configurations."
                                     #$(operating-system-kernel-arguments os))
                                    (initrd #$initrd)))))
 
+\f
+;;;
+;;; Boot parameters
+;;;
+
+(define-record-type* <boot-parameters>
+  boot-parameters make-boot-parameters boot-parameters?
+  (label            boot-parameters-label)
+  (root-device      boot-parameters-root-device)
+  (kernel           boot-parameters-kernel)
+  (kernel-arguments boot-parameters-kernel-arguments))
+
+(define (read-boot-parameters port)
+  "Read boot parameters from PORT and return the corresponding
+<boot-parameters> object or #f if the format is unrecognized."
+  (match (read port)
+    (('boot-parameters ('version 0)
+                       ('label label) ('root-device root)
+                       ('kernel linux)
+                       rest ...)
+     (boot-parameters
+      (label label)
+      (root-device root)
+      (kernel linux)
+      (kernel-arguments
+       (match (assq 'kernel-arguments rest)
+         ((_ args) args)
+         (#f       '())))))                       ;the old format
+    (x                                            ;unsupported format
+     (warning (_ "unrecognized boot parameters for '~a'~%")
+              system)
+     #f)))
+
 ;;; system.scm ends here
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 1407dc7..a45f07e 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -191,39 +191,6 @@ the ownership of '~a' may be incorrect!~%")
 
 \f
 ;;;
-;;; Boot parameters
-;;;
-
-(define-record-type* <boot-parameters>
-  boot-parameters make-boot-parameters boot-parameters?
-  (label            boot-parameters-label)
-  (root-device      boot-parameters-root-device)
-  (kernel           boot-parameters-kernel)
-  (kernel-arguments boot-parameters-kernel-arguments))
-
-(define (read-boot-parameters port)
-  "Read boot parameters from PORT and return the corresponding
-<boot-parameters> object or #f if the format is unrecognized."
-  (match (read port)
-    (('boot-parameters ('version 0)
-                       ('label label) ('root-device root)
-                       ('kernel linux)
-                       rest ...)
-     (boot-parameters
-      (label label)
-      (root-device root)
-      (kernel linux)
-      (kernel-arguments
-       (match (assq 'kernel-arguments rest)
-         ((_ args) args)
-         (#f       '())))))                       ;the old format
-    (x                                            ;unsupported format
-     (warning (_ "unrecognized boot parameters for '~a'~%")
-              system)
-     #f)))
-
-\f
-;;;
 ;;; Reconfiguration.
 ;;;
 
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] emacs: Find packages in system profiles.
  2016-01-12 20:28   ` Ludovic Courtès
@ 2016-01-13 20:45     ` Alex Kost
  2016-01-13 22:42       ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-13 20:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-01-12 23:28 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> For a usual profile, packages are placed in a profile directory itself,
>> but for a system profile, packages are placed in 'profile'
>> sub-directory.  So we need to do some special cases for system profiles
>> to find packages there as well.
>
> [...]
>
>> +(defun guix-packages-profile (profile &optional generation system?)
>> +  "Return a directory where packages are installed for the
>> +PROFILE's GENERATION.
>> +
>> +If SYSTEM? is non-nil, then PROFILE is considered to be a system
>> +profile.  Unlike usual profiles, for a system profile, packages
>> +are placed in 'profile' subdirectory."
>> +  (let ((profile (if generation
>> +                     (guix-generation-file profile generation)
>> +                   profile)))
>> +    (if system?
>> +        (expand-file-name "profile" profile)
>> +      profile)))
>
> It seems you’re calling /run/current-system the system profile, which
> leads to the ‘system?’ Boolean here, but the system profile really is
> /run/current-system/profile.

As we need to work with generations, I use "/var/guix/profiles/system"
instead of a "/run/current-system" link.  But you are right, I called it
“system profile”.

I think using "/var/guix/profiles/system/profile" wouldn't help to
remove ‘system?’ boolean.  For example:

  (guix-packages-profile "/var/guix/profiles/per-user/me/guix-profile" 3)
  => "/var/guix/profiles/per-user/me/guix-profile-3-link"

  (guix-packages-profile "/var/guix/profiles/system/profile" 3)
  => "/var/guix/profiles/system/profile-3-link"

The first one is correct, but the second should be:
  => "/var/guix/profiles/system-3-link/profile"

As you can see we need to distinguish system and usual profiles because
packages are placed in different places for them
("system-NN-link/profile" and "usual-NN-link" without "profile" subdir),
that's why I added ‘system?’ argument.  I don't see how it can be
avoided.

> I had overlooked it, but wouldn’t it be easier if patch #2 did:
>
> +(defvar guix-system-profile
> +  (concat guix-config-state-directory "/profiles/system/profile")
> +  "System profile.")
>
> ?
Not really.

Both "/var/guix/profiles/system" (which I called “system profile”) and
"/var/guix/profiles/system/profile" (which I called “packages profile”)
are needed.  The former — for finding generations, and the latter — for
finding packages.

I actually need "/var/guix/profiles/system" in the first place, so if
‘guix-system-profile’ is not an appropriate name for this variable, it
should be renamed (what name do you suggest?).

And about name confusion: now I see that “profile” should be used only
for a directory (symlink) with packages.  But I always thought that a
directory that has generations can also be named a “profile” (apparently
cannot), especially taking into account ‘profile-generations’ procedure
from (guix profiles) module:

  (profile-generations "/var/guix/profiles/system")

That's why ^^^ I called "/var/guix/profiles/system" a system profile.

-- 
Alex

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 6/6] emacs: Add interface for system generations.
  2016-01-12 20:35   ` Ludovic Courtès
@ 2016-01-13 20:56     ` Alex Kost
  2016-01-13 22:44       ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-13 20:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-01-12 23:35 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> * emacs/guix-main.scm (system-generation-boot-parameters)
>> (system-generation-param-alist, system-generation-sexps): New procedures.
>> (entries): Add 'system-generation' entry type.
>> * emacs/guix-messages.el (guix-result-message): Use the same messages
>>   for 'generation' and 'system-generation' entry types.
>> * emacs/guix-ui-system-generation.el: New file.
>> * emacs.am (ELFILES): Add it.
>> * doc/emacs.texi (Emacs Commands): Document new commands.
>> * NEWS: Mention new interface.
>
> [...]
>
>> +Analogously on GuixSD you can also display system generations:
>> +
>> +@table @kbd
>> +@item M-x guix-system-generations
>> +@item M-x guix-last-system-generations
>> +@item M-x guix-system-generations-by-time
>> +@end table
>
> As simple as this.  :-)
>
> And I guess it’s also possible to select generations, delete them, and
> switch to a specific one, as with M-x guix-generations?

Well yes, but only if emacs was started with root privileges.  At first
I was going to remove support for deleting/switching system generations
because of this, but then I left it, as I thought there might exist
users who run emacs from "root" for some reason, and such manipulating
system generations may be useful for them.

> Though maybe it would have to use
> “sudo:localhost:/run/current-system/profile” (via Tramp) to be able to
> modify things.  Maybe it could somehow offer to gain root privileges
> when performing an action?

I don't see how it can be done, since we use a guile REPL to perform
such actions (for example, ‘delete-generations’ procedure from (guix
scripts package) module).  But the REPL is started with the same
privileges as emacs.

-- 
Alex

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/6] guix system: Export <boot-parameters> accessors.
  2016-01-13 20:44     ` Alex Kost
@ 2016-01-13 22:33       ` Ludovic Courtès
  2016-01-14  8:34         ` Alex Kost
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-13 22:33 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-01-12 23:25 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> * guix/scripts/system.scm (read-boot-parameters, boot-parameters)
>>> (boot-parameters?, boot-parameters-label, boot-parameters-root-device)
>>> (boot-parameters-kernel, boot-parameters-kernel-arguments): Export.
>>
>> LGTM.
>>
>> Eventually (as a replacement of this patch or as a subsequent patch, as
>> you prefer) we should move these to (gnu system) since this is where we
>> create the ‘boot-parameters’ sexp.
>
> Great, I would like to make a replacement.  OK for the attached patch?
>
> (I exported <boot-parameters> because it is used by (guix scripts system))

I usually avoid exporting record type descriptors (RTDs) like
<boot-parameters> because then, if you change the layout of fields, you
have to update every ‘match’ clause out there, and it can be tedious and
error-prone.  Also, if the RTD is exported, then it’s trivial for other
modules to forge records of that type.

Could you instead rewrite the two occurrences in (guix system scripts)
so they use the ‘boot-parameters-XYZ’ accessors instead of ‘match’?  A
bit more verbose, but safer.

Sorry that I didn’t clarify this before!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] emacs: Find packages in system profiles.
  2016-01-13 20:45     ` Alex Kost
@ 2016-01-13 22:42       ` Ludovic Courtès
  2016-01-14  8:38         ` Alex Kost
  0 siblings, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-13 22:42 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-01-12 23:28 +0300) wrote:

[...]

>> It seems you’re calling /run/current-system the system profile, which
>> leads to the ‘system?’ Boolean here, but the system profile really is
>> /run/current-system/profile.
>
> As we need to work with generations, I use "/var/guix/profiles/system"
> instead of a "/run/current-system" link.  But you are right, I called it
> “system profile”.
>
> I think using "/var/guix/profiles/system/profile" wouldn't help to
> remove ‘system?’ boolean.  For example:
>
>   (guix-packages-profile "/var/guix/profiles/per-user/me/guix-profile" 3)
>   => "/var/guix/profiles/per-user/me/guix-profile-3-link"
>
>   (guix-packages-profile "/var/guix/profiles/system/profile" 3)
>   => "/var/guix/profiles/system/profile-3-link"
>
> The first one is correct, but the second should be:
>   => "/var/guix/profiles/system-3-link/profile"
>
> As you can see we need to distinguish system and usual profiles because
> packages are placed in different places for them
> ("system-NN-link/profile" and "usual-NN-link" without "profile" subdir),
> that's why I added ‘system?’ argument.  I don't see how it can be
> avoided.

Oh you’re right, got it.

>> I had overlooked it, but wouldn’t it be easier if patch #2 did:
>>
>> +(defvar guix-system-profile
>> +  (concat guix-config-state-directory "/profiles/system/profile")
>> +  "System profile.")
>>
>> ?
> Not really.
>
> Both "/var/guix/profiles/system" (which I called “system profile”) and
> "/var/guix/profiles/system/profile" (which I called “packages profile”)
> are needed.  The former — for finding generations, and the latter — for
> finding packages.
>
> I actually need "/var/guix/profiles/system" in the first place, so if
> ‘guix-system-profile’ is not an appropriate name for this variable, it
> should be renamed (what name do you suggest?).

Indeed, it’s confusing.  I don’t have a better name to suggest, though.

> And about name confusion: now I see that “profile” should be used only
> for a directory (symlink) with packages.  But I always thought that a
> directory that has generations can also be named a “profile” (apparently
> cannot), especially taking into account ‘profile-generations’ procedure
> from (guix profiles) module:
>
>   (profile-generations "/var/guix/profiles/system")
>
> That's why ^^^ I called "/var/guix/profiles/system" a system profile.

Initially, I would have said that as long as FOO/manifest exists, FOO
can be called a profile.  That’s the definition of a “profile” in the
sense of (guix profiles).

Like a profile, /var/guix/profiles/system has generations, but unlike
“real profiles”, it is not created by ‘profile-derivation’.

The solution in this patch looks good, after all!

Thanks for explaining,
Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 6/6] emacs: Add interface for system generations.
  2016-01-13 20:56     ` Alex Kost
@ 2016-01-13 22:44       ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-13 22:44 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-01-12 23:35 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> * emacs/guix-main.scm (system-generation-boot-parameters)
>>> (system-generation-param-alist, system-generation-sexps): New procedures.
>>> (entries): Add 'system-generation' entry type.
>>> * emacs/guix-messages.el (guix-result-message): Use the same messages
>>>   for 'generation' and 'system-generation' entry types.
>>> * emacs/guix-ui-system-generation.el: New file.
>>> * emacs.am (ELFILES): Add it.
>>> * doc/emacs.texi (Emacs Commands): Document new commands.
>>> * NEWS: Mention new interface.
>>
>> [...]
>>
>>> +Analogously on GuixSD you can also display system generations:
>>> +
>>> +@table @kbd
>>> +@item M-x guix-system-generations
>>> +@item M-x guix-last-system-generations
>>> +@item M-x guix-system-generations-by-time
>>> +@end table
>>
>> As simple as this.  :-)
>>
>> And I guess it’s also possible to select generations, delete them, and
>> switch to a specific one, as with M-x guix-generations?
>
> Well yes, but only if emacs was started with root privileges.  At first
> I was going to remove support for deleting/switching system generations
> because of this, but then I left it, as I thought there might exist
> users who run emacs from "root" for some reason, and such manipulating
> system generations may be useful for them.

Sounds reasonable.

>> Though maybe it would have to use
>> “sudo:localhost:/run/current-system/profile” (via Tramp) to be able to
>> modify things.  Maybe it could somehow offer to gain root privileges
>> when performing an action?
>
> I don't see how it can be done, since we use a guile REPL to perform
> such actions (for example, ‘delete-generations’ procedure from (guix
> scripts package) module).  But the REPL is started with the same
> privileges as emacs.

Oh right.  We could use elisp code to delete the symlink (that would
allow us to use Tramp), but it’s probably not worth bothering.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/6] guix system: Export <boot-parameters> accessors.
  2016-01-13 22:33       ` Ludovic Courtès
@ 2016-01-14  8:34         ` Alex Kost
  2016-01-14 13:25           ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-14  8:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

Ludovic Courtès (2016-01-14 01:33 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Ludovic Courtès (2016-01-12 23:25 +0300) wrote:
>>
>>> Alex Kost <alezost@gmail.com> skribis:
>>>
>>>> * guix/scripts/system.scm (read-boot-parameters, boot-parameters)
>>>> (boot-parameters?, boot-parameters-label, boot-parameters-root-device)
>>>> (boot-parameters-kernel, boot-parameters-kernel-arguments): Export.
>>>
>>> LGTM.
>>>
>>> Eventually (as a replacement of this patch or as a subsequent patch, as
>>> you prefer) we should move these to (gnu system) since this is where we
>>> create the ‘boot-parameters’ sexp.
>>
>> Great, I would like to make a replacement.  OK for the attached patch?
>>
>> (I exported <boot-parameters> because it is used by (guix scripts system))
>
> I usually avoid exporting record type descriptors (RTDs) like
> <boot-parameters> because then, if you change the layout of fields, you
> have to update every ‘match’ clause out there, and it can be tedious and
> error-prone.  Also, if the RTD is exported, then it’s trivial for other
> modules to forge records of that type.
>
> Could you instead rewrite the two occurrences in (guix system scripts)
> so they use the ‘boot-parameters-XYZ’ accessors instead of ‘match’?  A
> bit more verbose, but safer.
>
> Sorry that I didn’t clarify this before!

Sure, I should have guessed to do it without clarifying.  The updated
patch is attached.


[-- Attachment #2: 0001-Move-boot-parameters-to-gnu-system.patch --]
[-- Type: text/x-patch, Size: 7983 bytes --]

From df626fd61b5611b2174a792fd5736d696bd307c1 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 8 Jan 2016 02:48:17 +0300
Subject: [PATCH] Move <boot-parameters> to (gnu system).

* guix/scripts/system.scm (previous-grub-entries)
  (display-system-generation): Use accessors instead of matching
  <boot-parameters>.
  (boot-parameters, boot-parameters?, boot-parameters-label)
  (boot-parameters-root-device, boot-parameters-kernel)
  (boot-parameters-kernel-arguments, read-boot-parameters): Move to...
* gnu/system.scm: ... here. Export them.
---
 gnu/system.scm          | 41 ++++++++++++++++++++++++
 guix/scripts/system.scm | 85 ++++++++++++++++---------------------------------
 2 files changed, 68 insertions(+), 58 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index 4aedb7e..ee0280c 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -88,6 +88,14 @@
             operating-system-locale-directory
             operating-system-boot-script
 
+            boot-parameters
+            boot-parameters?
+            boot-parameters-label
+            boot-parameters-root-device
+            boot-parameters-kernel
+            boot-parameters-kernel-arguments
+            read-boot-parameters
+
             local-host-aliases
             %setuid-programs
             %base-packages
@@ -709,4 +717,37 @@ this file is the reconstruction of GRUB menu entries for old configurations."
                                     #$(operating-system-kernel-arguments os))
                                    (initrd #$initrd)))))
 
+\f
+;;;
+;;; Boot parameters
+;;;
+
+(define-record-type* <boot-parameters>
+  boot-parameters make-boot-parameters boot-parameters?
+  (label            boot-parameters-label)
+  (root-device      boot-parameters-root-device)
+  (kernel           boot-parameters-kernel)
+  (kernel-arguments boot-parameters-kernel-arguments))
+
+(define (read-boot-parameters port)
+  "Read boot parameters from PORT and return the corresponding
+<boot-parameters> object or #f if the format is unrecognized."
+  (match (read port)
+    (('boot-parameters ('version 0)
+                       ('label label) ('root-device root)
+                       ('kernel linux)
+                       rest ...)
+     (boot-parameters
+      (label label)
+      (root-device root)
+      (kernel linux)
+      (kernel-arguments
+       (match (assq 'kernel-arguments rest)
+         ((_ args) args)
+         (#f       '())))))                       ;the old format
+    (x                                            ;unsupported format
+     (warning (_ "unrecognized boot parameters for '~a'~%")
+              system)
+     #f)))
+
 ;;; system.scm ends here
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 1407dc7..564ed02 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -191,39 +192,6 @@ the ownership of '~a' may be incorrect!~%")
 
 \f
 ;;;
-;;; Boot parameters
-;;;
-
-(define-record-type* <boot-parameters>
-  boot-parameters make-boot-parameters boot-parameters?
-  (label            boot-parameters-label)
-  (root-device      boot-parameters-root-device)
-  (kernel           boot-parameters-kernel)
-  (kernel-arguments boot-parameters-kernel-arguments))
-
-(define (read-boot-parameters port)
-  "Read boot parameters from PORT and return the corresponding
-<boot-parameters> object or #f if the format is unrecognized."
-  (match (read port)
-    (('boot-parameters ('version 0)
-                       ('label label) ('root-device root)
-                       ('kernel linux)
-                       rest ...)
-     (boot-parameters
-      (label label)
-      (root-device root)
-      (kernel linux)
-      (kernel-arguments
-       (match (assq 'kernel-arguments rest)
-         ((_ args) args)
-         (#f       '())))))                       ;the old format
-    (x                                            ;unsupported format
-     (warning (_ "unrecognized boot parameters for '~a'~%")
-              system)
-     #f)))
-
-\f
-;;;
 ;;; Reconfiguration.
 ;;;
 
@@ -285,22 +253,24 @@ it atomically, and then run OS's activation script."
   "Return a list of 'menu-entry' for the generations of PROFILE."
   (define (system->grub-entry system number time)
     (unless-file-not-found
-     (let ((file (string-append system "/parameters")))
-       (match (call-with-input-file file read-boot-parameters)
-         (($ <boot-parameters> label root kernel kernel-arguments)
-          (menu-entry
-           (label (string-append label " (#"
-                                 (number->string number) ", "
-                                 (seconds->string time) ")"))
-           (linux kernel)
-           (linux-arguments
-            (cons* (string-append "--root=" root)
-                   #~(string-append "--system=" #$system)
-                   #~(string-append "--load=" #$system "/boot")
-                   kernel-arguments))
-           (initrd #~(string-append #$system "/initrd"))))
-         (#f                                      ;invalid format
-          #f)))))
+     (let* ((file             (string-append system "/parameters"))
+            (params           (call-with-input-file file
+                                read-boot-parameters))
+            (label            (boot-parameters-label params))
+            (root             (boot-parameters-root-device params))
+            (kernel           (boot-parameters-kernel params))
+            (kernel-arguments (boot-parameters-kernel-arguments params)))
+       (menu-entry
+        (label (string-append label " (#"
+                              (number->string number) ", "
+                              (seconds->string time) ")"))
+        (linux kernel)
+        (linux-arguments
+         (cons* (string-append "--root=" root)
+                #~(string-append "--system=" #$system)
+                #~(string-append "--load=" #$system "/boot")
+                kernel-arguments))
+        (initrd #~(string-append #$system "/initrd"))))))
 
   (let* ((numbers (generation-numbers profile))
          (systems (map (cut generation-file-name profile <>)
@@ -366,18 +336,17 @@ list of services."
   (unless (zero? number)
     (let* ((generation (generation-file-name profile number))
            (param-file (string-append generation "/parameters"))
-           (params     (call-with-input-file param-file read-boot-parameters)))
+           (params     (call-with-input-file param-file read-boot-parameters))
+           (label      (boot-parameters-label params))
+           (root       (boot-parameters-root-device params))
+           (kernel     (boot-parameters-kernel params)))
       (display-generation profile number)
       (format #t (_ "  file name: ~a~%") generation)
       (format #t (_ "  canonical file name: ~a~%") (readlink* generation))
-      (match params
-        (($ <boot-parameters> label root kernel)
-         ;; TRANSLATORS: Please preserve the two-space indentation.
-         (format #t (_ "  label: ~a~%") label)
-         (format #t (_ "  root device: ~a~%") root)
-         (format #t (_ "  kernel: ~a~%") kernel))
-        (_
-         #f)))))
+      ;; TRANSLATORS: Please preserve the two-space indentation.
+      (format #t (_ "  label: ~a~%") label)
+      (format #t (_ "  root device: ~a~%") root)
+      (format #t (_ "  kernel: ~a~%") kernel))))
 
 (define* (list-generations pattern #:optional (profile %system-profile))
   "Display in a human-readable format all the system generations matching
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] emacs: Find packages in system profiles.
  2016-01-13 22:42       ` Ludovic Courtès
@ 2016-01-14  8:38         ` Alex Kost
  2016-01-14 13:27           ` Ludovic Courtès
  0 siblings, 1 reply; 24+ messages in thread
From: Alex Kost @ 2016-01-14  8:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-01-14 01:42 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Ludovic Courtès (2016-01-12 23:28 +0300) wrote:
>
> [...]
>
>>> I had overlooked it, but wouldn’t it be easier if patch #2 did:
>>>
>>> +(defvar guix-system-profile
>>> +  (concat guix-config-state-directory "/profiles/system/profile")
>>> +  "System profile.")
>>>
>>> ?
>> Not really.
>>
>> Both "/var/guix/profiles/system" (which I called “system profile”) and
>> "/var/guix/profiles/system/profile" (which I called “packages profile”)
>> are needed.  The former — for finding generations, and the latter — for
>> finding packages.
>>
>> I actually need "/var/guix/profiles/system" in the first place, so if
>> ‘guix-system-profile’ is not an appropriate name for this variable, it
>> should be renamed (what name do you suggest?).
>
> Indeed, it’s confusing.  I don’t have a better name to suggest, though.

BTW I've just noticed that '%system-profile' from (guix scripts system)
has the same value, so "/var/guix/profiles/system" can be called a
“system profile” after all I think ;-)

>> And about name confusion: now I see that “profile” should be used only
>> for a directory (symlink) with packages.  But I always thought that a
>> directory that has generations can also be named a “profile” (apparently
>> cannot), especially taking into account ‘profile-generations’ procedure
>> from (guix profiles) module:
>>
>>   (profile-generations "/var/guix/profiles/system")
>>
>> That's why ^^^ I called "/var/guix/profiles/system" a system profile.
>
> Initially, I would have said that as long as FOO/manifest exists, FOO
> can be called a profile.  That’s the definition of a “profile” in the
> sense of (guix profiles).
>
> Like a profile, /var/guix/profiles/system has generations, but unlike
> “real profiles”, it is not created by ‘profile-derivation’.
>
> The solution in this patch looks good, after all!

Great, thanks!

-- 
Alex

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/6] guix system: Export <boot-parameters> accessors.
  2016-01-14  8:34         ` Alex Kost
@ 2016-01-14 13:25           ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-14 13:25 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From df626fd61b5611b2174a792fd5736d696bd307c1 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Fri, 8 Jan 2016 02:48:17 +0300
> Subject: [PATCH] Move <boot-parameters> to (gnu system).
>
> * guix/scripts/system.scm (previous-grub-entries)
>   (display-system-generation): Use accessors instead of matching
>   <boot-parameters>.
>   (boot-parameters, boot-parameters?, boot-parameters-label)
>   (boot-parameters-root-device, boot-parameters-kernel)
>   (boot-parameters-kernel-arguments, read-boot-parameters): Move to...
> * gnu/system.scm: ... here. Export them.

Perfect, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] emacs: Find packages in system profiles.
  2016-01-14  8:38         ` Alex Kost
@ 2016-01-14 13:27           ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2016-01-14 13:27 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-01-14 01:42 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> Ludovic Courtès (2016-01-12 23:28 +0300) wrote:
>>
>> [...]
>>
>>>> I had overlooked it, but wouldn’t it be easier if patch #2 did:
>>>>
>>>> +(defvar guix-system-profile
>>>> +  (concat guix-config-state-directory "/profiles/system/profile")
>>>> +  "System profile.")
>>>>
>>>> ?
>>> Not really.
>>>
>>> Both "/var/guix/profiles/system" (which I called “system profile”) and
>>> "/var/guix/profiles/system/profile" (which I called “packages profile”)
>>> are needed.  The former — for finding generations, and the latter — for
>>> finding packages.
>>>
>>> I actually need "/var/guix/profiles/system" in the first place, so if
>>> ‘guix-system-profile’ is not an appropriate name for this variable, it
>>> should be renamed (what name do you suggest?).
>>
>> Indeed, it’s confusing.  I don’t have a better name to suggest, though.
>
> BTW I've just noticed that '%system-profile' from (guix scripts system)
> has the same value, so "/var/guix/profiles/system" can be called a
> “system profile” after all I think ;-)

I think so.  I guess that shows that I had already been a victim (and a
perpetrator?) of this confusion.  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-01-14 13:27 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-10  9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
2016-01-10  9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
2016-01-12 20:25   ` Ludovic Courtès
2016-01-13 20:44     ` Alex Kost
2016-01-13 22:33       ` Ludovic Courtès
2016-01-14  8:34         ` Alex Kost
2016-01-14 13:25           ` Ludovic Courtès
2016-01-10  9:53 ` [PATCH 2/6] emacs: profiles: Add 'guix-system-profile' Alex Kost
2016-01-12 20:25   ` Ludovic Courtès
2016-01-10  9:53 ` [PATCH 3/6] emacs: Find packages in system profiles Alex Kost
2016-01-12 20:28   ` Ludovic Courtès
2016-01-13 20:45     ` Alex Kost
2016-01-13 22:42       ` Ludovic Courtès
2016-01-14  8:38         ` Alex Kost
2016-01-14 13:27           ` Ludovic Courtès
2016-01-10  9:53 ` [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff' Alex Kost
2016-01-12 20:29   ` Ludovic Courtès
2016-01-10  9:53 ` [PATCH 5/6] emacs: Remove 'generation' search type Alex Kost
2016-01-12 20:31   ` Ludovic Courtès
2016-01-10  9:53 ` [PATCH 6/6] emacs: Add interface for system generations Alex Kost
2016-01-12 20:35   ` Ludovic Courtès
2016-01-13 20:56     ` Alex Kost
2016-01-13 22:44       ` Ludovic Courtès
2016-01-12 20:23 ` [PATCH 0/6] emacs: Add "M-x guix-system-generations" Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).