Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-11 Thread Ludovic Courtès
Alex Kost  skribis:

> OK, I have not pushed anything yet, as the commits were changed a bit.
> I'm attaching all 3 patches for adding “Switch to generation” support.
> Everything seems OK now (at least “make check” does not fail anymore),
> so if you don't have final comments, I would like to commit them.
> Thanks for the patience.

Looks good from a quick skim, go ahead!

Thanks,
Ludo’.



Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-10 Thread Alex Kost
Ludovic Courtès (2014-10-10 16:15 +0400) wrote:

> Alex Kost  skribis:
>
>> Ludovic Courtès (2014-10-10 02:08 +0400) wrote:
>
> [...]
>
>>> This is bikeshedding, but I would make a hierarchy like this:
>>>
>>>  &profile-error, with ‘profile’ field
>>> ^
>>>.———–+———–.
>>>| |
>>>   &profile-not-found-error&missing-generation-error, with 
>>> ‘generation’ field
>>
>> Thank you for the idea btw, I like it.  So the question is: should the
>> parent &profile-error be handled as well?  If yes, what message to use?
>
> Let’s ignore it for now, it Shouldn’t Happen™.

OK, that's what I thought.

>> 2. And another question: the current error for generation would look
>> like this:
>>
>>   generation 18 does not exist
>>
>> Is it OK or should I use ‘generation-file-name’ there and make it:
>>
>>   generation '/some/path/to/profile/generation-18-link' does not exist
>
> I prefer “generation 18 does not exist”, or maybe “generation 18 of
> ‘/some/profile’ does not exist”.  WDYT?

I agree, mentioning a profile would be better.  I modified the patch for
that.

>> The problem now is I can't add ‘switch-to-generation’ procedure to (guix
>> profiles) as it uses ‘_’ and ‘switch-symlinks’ from (guix ui) which is
>> not “#:use-module”-ed anymore.  This patch is also attached.  What to do
>> about it?  I think moving ‘switch-to-generation’ to (guix ui) is not
>> good or is it?
>
> Yeah, a you suggested on IRC, let’s just leave it in (guix scripts
> package) until we have a better idea.  :-)
[...]

OK, I have not pushed anything yet, as the commits were changed a bit.
I'm attaching all 3 patches for adding “Switch to generation” support.
Everything seems OK now (at least “make check” does not fail anymore),
so if you don't have final comments, I would like to commit them.
Thanks for the patience.

>From 899165ece24d597a1e3c52cc417eb08e7438b061 Mon Sep 17 00:00:00 2001
From: Alex Kost 
Date: Wed, 8 Oct 2014 17:29:01 +0400
Subject: [PATCH 1/3] profiles: Add condition types for profiles and
 generations.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès.

* guix/profiles.scm (&profile-error, &profile-not-found-error,
  &missing-generation-error): New condition types.
* guix/ui.scm (call-with-error-handling): Handle new types.
* guix/scripts/package.scm (roll-back, guix-package): Raise
  '&profile-not-found-error' where needed.
---
 guix/profiles.scm| 29 -
 guix/scripts/package.scm | 18 ++
 guix/ui.scm  |  8 
 3 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index f2eb754..793af24 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -34,7 +34,18 @@
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
-  #:export (manifest make-manifest
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
+  #:export (&profile-error
+profile-error?
+profile-error-profile
+&profile-not-found-error
+profile-not-found-error?
+&missing-generation-error
+missing-generation-error?
+missing-generation-error-generation
+
+manifest make-manifest
 manifest?
 manifest-entries
 
@@ -82,6 +93,22 @@
 

 ;;;
+;;; Condition types.
+;;;
+
+(define-condition-type &profile-error &error
+  profile-error?
+  (profile profile-error-profile))
+
+(define-condition-type &profile-not-found-error &profile-error
+  profile-not-found-error?)
+
+(define-condition-type &missing-generation-error &profile-error
+  missing-generation-error?
+  (generation missing-generation-error-generation))
+
+
+;;;
 ;;; Manifests.
 ;;;
 
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 031f71a..ab9d303 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -38,6 +38,8 @@
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (srfi srfi-37)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
@@ -109,8 +111,8 @@ return PROFILE unchanged.  The goal is to treat '-p ~/.guix-profile' as if
  (previous-number (previous-generation-number profile number))
  (previous-generation (generation-file-name profile previous-number)))
 (cond ((not (file-exists? profile)) ; invalid profile
-   (leave (_ "profile '~a' does not exist~%")
-  profile))
+   (raise (condition (&profile-not-found-error
+  (profile profile)
   ((zero? number)   ; empty profile
(format (current-error-port)
(_ "

Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-10 Thread Ludovic Courtès
Alex Kost  skribis:

> Ludovic Courtès (2014-10-10 02:08 +0400) wrote:

[...]

>> This is bikeshedding, but I would make a hierarchy like this:
>>
>>  &profile-error, with ‘profile’ field
>> ^
>>.———–+———–.
>>| |
>>   &profile-not-found-error&missing-generation-error, with 
>> ‘generation’ field
>
> Thank you for the idea btw, I like it.  So the question is: should the
> parent &profile-error be handled as well?  If yes, what message to use?

Let’s ignore it for now, it Shouldn’t Happen™.

> 2. And another question: the current error for generation would look
> like this:
>
>   generation 18 does not exist
>
> Is it OK or should I use ‘generation-file-name’ there and make it:
>
>   generation '/some/path/to/profile/generation-18-link' does not exist

I prefer “generation 18 does not exist”, or maybe “generation 18 of
‘/some/profile’ does not exist”.  WDYT?

> The problem now is I can't add ‘switch-to-generation’ procedure to (guix
> profiles) as it uses ‘_’ and ‘switch-symlinks’ from (guix ui) which is
> not “#:use-module”-ed anymore.  This patch is also attached.  What to do
> about it?  I think moving ‘switch-to-generation’ to (guix ui) is not
> good or is it?

Yeah, a you suggested on IRC, let’s just leave it in (guix scripts
package) until we have a better idea.  :-)

> From af9d9869f2430dd3e20885e685867c6843ba4279 Mon Sep 17 00:00:00 2001
> From: Alex Kost 
> Date: Wed, 8 Oct 2014 17:29:01 +0400
> Subject: [PATCH 1/3] profiles: Add condition types for profiles and
>  generations.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Suggested by Ludovic Courtès.
>
> * guix/profiles.scm (&profile-error, &profile-not-found-error,
>   &missing-generation-error): New condition types.
> * guix/ui.scm (call-with-error-handling): Handle new types.
> * guix/scripts/package.scm (roll-back, guix-package): Raise
>   '&profile-not-found-error' where needed.

Perfect!

> From da49a2b7af5295c3c72b7e4590219cbac827877b Mon Sep 17 00:00:00 2001
> From: Alex Kost 
> Date: Wed, 8 Oct 2014 00:39:42 +0400
> Subject: [PATCH 2/3] profiles: Add procedures for switching generations.
>
> * guix/scripts/package.scm (switch-to-previous-generation): Move to...
> * guix/profiles.scm: ... here. Use 'switch-to-generation'.
>   (relative-generation): New procedure.
>   (previous-generation-number): Use it.
>   (switch-to-generation): New procedure.

Perfect as well, OK to commit.

Thanks,
Ludo’.



Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-10 Thread Alex Kost
Ludovic Courtès (2014-10-10 02:08 +0400) wrote:

> l...@gnu.org (Ludovic Courtès) skribis:
>
>> There’s:
>>
>>   (guix store) -> (guix nar) -> (guix ui) -> (guix store) ...
>
> Commit 0363991 fixes that.
>
> (Now we must make sure we don’t reintroduce cycles in these modules;
> probably we should integrate Mark’s cycle detection script somehow.)
>
> With that I was able to apply the patch you posted.
>
> Thanks, and sorry for the mess!

Thank you for fixing that and sorry that I didn't reply to you on #guix
yesterday (I was away).

Now there shouldn't be problems with adding new condition types to (guix
profiles).  The patch is attached and “make check” was successful on
that.  2 little questions:

1. As you suggested I made a hierarchy of conditions:

> This is bikeshedding, but I would make a hierarchy like this:
>
>  &profile-error, with ‘profile’ field
> ^
>.———–+———–.
>| |
>   &profile-not-found-error&missing-generation-error, with 
> ‘generation’ field

Thank you for the idea btw, I like it.  So the question is: should the
parent &profile-error be handled as well?  If yes, what message to use?

2. And another question: the current error for generation would look
like this:

  generation 18 does not exist

Is it OK or should I use ‘generation-file-name’ there and make it:

  generation '/some/path/to/profile/generation-18-link' does not exist



The problem now is I can't add ‘switch-to-generation’ procedure to (guix
profiles) as it uses ‘_’ and ‘switch-symlinks’ from (guix ui) which is
not “#:use-module”-ed anymore.  This patch is also attached.  What to do
about it?  I think moving ‘switch-to-generation’ to (guix ui) is not
good or is it?  Perhaps it would be better to move ‘switch-symlinks’ and
all ‘_’, ‘N_’, … stuff to (guix utils)?  But what do I know, it's up to
you again (I feel guilty that I have to bother you again).

>From af9d9869f2430dd3e20885e685867c6843ba4279 Mon Sep 17 00:00:00 2001
From: Alex Kost 
Date: Wed, 8 Oct 2014 17:29:01 +0400
Subject: [PATCH 1/3] profiles: Add condition types for profiles and
 generations.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès.

* guix/profiles.scm (&profile-error, &profile-not-found-error,
  &missing-generation-error): New condition types.
* guix/ui.scm (call-with-error-handling): Handle new types.
* guix/scripts/package.scm (roll-back, guix-package): Raise
  '&profile-not-found-error' where needed.
---
 guix/profiles.scm| 29 -
 guix/scripts/package.scm | 18 ++
 guix/ui.scm  |  7 +++
 3 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index f2eb754..793af24 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -34,7 +34,18 @@
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
-  #:export (manifest make-manifest
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
+  #:export (&profile-error
+profile-error?
+profile-error-profile
+&profile-not-found-error
+profile-not-found-error?
+&missing-generation-error
+missing-generation-error?
+missing-generation-error-generation
+
+manifest make-manifest
 manifest?
 manifest-entries
 
@@ -82,6 +93,22 @@
 

 ;;;
+;;; Condition types.
+;;;
+
+(define-condition-type &profile-error &error
+  profile-error?
+  (profile profile-error-profile))
+
+(define-condition-type &profile-not-found-error &profile-error
+  profile-not-found-error?)
+
+(define-condition-type &missing-generation-error &profile-error
+  missing-generation-error?
+  (generation missing-generation-error-generation))
+
+
+;;;
 ;;; Manifests.
 ;;;
 
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 031f71a..ab9d303 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -38,6 +38,8 @@
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (srfi srfi-37)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
@@ -109,8 +111,8 @@ return PROFILE unchanged.  The goal is to treat '-p ~/.guix-profile' as if
  (previous-number (previous-generation-number profile number))
  (previous-generation (generation-file-name profile previous-number)))
 (cond ((not (file-exists? profile)) ; invalid profile
-   (leave (_ "profile '~a' does not exist~%")
-  profile))
+   (raise (condition (&profile-not-found-error
+  (profile profile)
   ((zero? number)   ; empty profile

Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-09 Thread Ludovic Courtès
l...@gnu.org (Ludovic Courtès) skribis:

> There’s:
>
>   (guix store) -> (guix nar) -> (guix ui) -> (guix store) ...

Commit 0363991 fixes that.

(Now we must make sure we don’t reintroduce cycles in these modules;
probably we should integrate Mark’s cycle detection script somehow.)

With that I was able to apply the patch you posted.

Thanks, and sorry for the mess!

Ludo’.



Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-09 Thread Ludovic Courtès
Alex Kost  skribis:

> Ludovic Courtès (2014-10-08 23:55 +0400) wrote:

[...]

>> However, back to the initial problem, is this a problem if the error
>> conditions are defined in (guix profiles), which is then imported by
>> (guix ui)?  This is suboptimal, but this kind of circular reference
>> shouldn’t cause any troubles.
>
> Do you mean to "#:select" condition types in (guix ui)?

No, because #:select basically prevents circular references.

> What about making an auxiliary (guix conditions) module with all
> existing condition types, and use it where needed?  I could try to work
> on it if it sounds reasonable.  WDYT?

Hmm yes, but only as a last resort.

I’ve spent some time trying to better understand the problem, but failed
(we desperately need tools in Guile do to this sort of things.)  Another
part of the problem is that (guix monads) uses other modules’ bindings
at the top-level.

Mark, any ideas?

Alex, is there a way we can backtrack a bit and move forward in the
meantime?

Ludo’.



Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-08 Thread Alex Kost
Ludovic Courtès (2014-10-08 23:55 +0400) wrote:

> Alex Kost  skribis:

[...]

> This is another circularity issue.  :-/
>
> There’s:
>
>   (guix store) -> (guix nar) -> (guix ui) -> (guix store) ...
>
> This shouldn’t be a problem, except that occasional uses of #:select
> trigger a bug (see .)

Ouch, thanks for the explanation.

> I’ve fiddled a bit on top of your patch, but couldn’t find any simple
> fix.
>
> However, back to the initial problem, is this a problem if the error
> conditions are defined in (guix profiles), which is then imported by
> (guix ui)?  This is suboptimal, but this kind of circular reference
> shouldn’t cause any troubles.

Do you mean to "#:select" condition types in (guix ui)?  I tried but it
failed for me even on “make” (the patch I tried and the make output are
attached).  So it looks like even selecting from (guix profile) won't
work in (guix ui) or did I miss something?

What about making an auxiliary (guix conditions) module with all
existing condition types, and use it where needed?  I could try to work
on it if it sounds reasonable.  WDYT?

>From 6b1c3edea51abb464f4265f36f25c5e314731ac2 Mon Sep 17 00:00:00 2001
From: Alex Kost 
Date: Wed, 8 Oct 2014 17:29:01 +0400
Subject: [PATCH] profiles: Add condition types for profiles and generations.

* guix/profiles.scm (&profile-error, &profile-not-found-error,
  &missing-generation-error): New condition types.
* guix/ui.scm (call-with-error-handling): Handle new types.
* guix/scripts/package.scm (roll-back, guix-package): Raise
  '&profile-not-found-error' where needed.
---
 guix/profiles.scm| 29 -
 guix/scripts/package.scm | 18 ++
 guix/ui.scm  | 12 
 3 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 18733a6..b1fa50e 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -35,7 +35,18 @@
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
-  #:export (manifest make-manifest
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
+  #:export (&profile-error
+profile-error?
+profile-error-profile
+&profile-not-found-error
+profile-not-found-error?
+&missing-generation-error
+missing-generation-error?
+missing-generation-error-generation
+
+manifest make-manifest
 manifest?
 manifest-entries
 
@@ -84,6 +95,22 @@
 

 ;;;
+;;; Condition types.
+;;;
+
+(define-condition-type &profile-error &error
+  profile-error?
+  (profile profile-error-profile))
+
+(define-condition-type &profile-not-found-error &profile-error
+  profile-not-found-error?)
+
+(define-condition-type &missing-generation-error &profile-error
+  missing-generation-error?
+  (generation missing-generation-error-generation))
+
+
+;;;
 ;;; Manifests.
 ;;;
 
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index fc9c37b..9f3ed3a 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -38,6 +38,8 @@
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (srfi srfi-37)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
@@ -109,8 +111,8 @@ return PROFILE unchanged.  The goal is to treat '-p ~/.guix-profile' as if
  (previous-number (previous-generation-number profile number))
  (previous-generation (generation-file-name profile previous-number)))
 (cond ((not (file-exists? profile)) ; invalid profile
-   (leave (_ "profile '~a' does not exist~%")
-  profile))
+   (raise (condition (&profile-not-found-error
+  (profile profile)
   ((zero? number)   ; empty profile
(format (current-error-port)
(_ "nothing to do: already at the empty profile~%")))
@@ -723,8 +725,8 @@ more information.~%"))
 (match-lambda
  (('delete-generations . pattern)
   (cond ((not (file-exists? profile)) ; XXX: race condition
- (leave (_ "profile '~a' does not exist~%")
-profile))
+ (raise (condition (&profile-not-found-error
+(profile profile)
 ((string-null? pattern)
  (delete-generations
   (%store) profile
@@ -833,8 +835,8 @@ more information.~%"))
  (newline)))
 
  (cond ((not (file-exists? profile)) ; XXX: race condition
-(leave (_ "profile '~a' does not exist~%")
-   profile))
+(raise (condition (&profile-not-found-error
+   (profile profi

Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-08 Thread Ludovic Courtès
Alex Kost  skribis:

>?: 16 [primitive-load-path "guix/profiles" ...]
> In guix/profiles.scm:
>   21: 15 [#]
> In ice-9/boot-9.scm:
> 2951: 14 [define-module* (guix profiles) #:filename ...]
> 2926: 13 [resolve-imports (((guix utils)) ((guix records)) ((guix 
> derivations)) ...)]
> 2864: 12 [resolve-interface (guix gexp) #:select ...]
> 2789: 11 [# autoload version #:key ensure)> # ...]
> 3065: 10 [try-module-autoload (guix gexp) #f]
> 2401: 9 [save-module-excursion # ice-9/boot-9.scm:3066:17 ()>]
> 3085: 8 [#]
> In unknown file:
>?: 7 [primitive-load-path "guix/gexp" ...]
> In guix/gexp.scm:
>   19: 6 [#]
> In ice-9/boot-9.scm:
> 2951: 5 [define-module* (guix gexp) #:filename ...]
> 2926: 4 [resolve-imports ((# # #) (#) (# # #) (#) ...)]
> 2877: 3 [resolve-interface (guix store) #:select ...]
>  768: 2 [for-each # #]
> 2883: 1 [# 
> direct-store-path?]
> In unknown file:
>?: 0 [scm-error misc-error #f ...]
>
> ERROR: In procedure scm-error:
> ERROR: no binding `direct-store-path?' in module (guix store)

This is another circularity issue.  :-/

There’s:

  (guix store) -> (guix nar) -> (guix ui) -> (guix store) ...

This shouldn’t be a problem, except that occasional uses of #:select
trigger a bug (see .)

I’ve fiddled a bit on top of your patch, but couldn’t find any simple
fix.

However, back to the initial problem, is this a problem if the error
conditions are defined in (guix profiles), which is then imported by
(guix ui)?  This is suboptimal, but this kind of circular reference
shouldn’t cause any troubles.

HTH,
Ludo’.



Re: ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-08 Thread Alex Kost
Sorry, I've found that the patch I sent is not cleanly applied to the
latest master checkout.  The modified patch is attached.

It seems the fail happens only if there is

  #:use-module (guix profiles)

in (guix ui).  If (guix profiles) is not used, there are no problems.
I'm stuck.

>From 480c22f37437ce138d4fe822f5b1c15f1f65be0e Mon Sep 17 00:00:00 2001
From: Alex Kost 
Date: Wed, 8 Oct 2014 17:15:49 +0400
Subject: [PATCH] ui: Move 'show-manifest-transaction' from (guix profiles).

* guix/profiles.scm: Do not use (guix ui) module.
  (right-arrow, manifest-show-transaction): Move and rename to...
* guix/ui.scm (right-arrow, show-manifest-transaction): ... here.
* tests/profiles.scm ("manifest-show-transaction"): Move to...
* tests/ui.scm ("show-manifest-transaction"): ... here.
  (guile-1.8.8, guile-2.0.9): New variables.
* emacs/guix-main.scm (process-package-actions): Rename
  'manifest-show-transaction' to 'show-manifest-transaction'.
* guix/scripts/package.scm (guix-package): Likewise.
---
 emacs/guix-main.scm  |  2 +-
 guix/profiles.scm| 93 
 guix/scripts/package.scm |  2 +-
 guix/ui.scm  | 93 
 tests/profiles.scm   | 17 -
 tests/ui.scm | 32 +
 6 files changed, 127 insertions(+), 112 deletions(-)

diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index b85bb5c..fe599fb 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -797,7 +797,7 @@ OUTPUTS is a list of package outputs (may be an empty list)."
(new-profile (derivation->output-path derivation)))
   (set-build-options store
  #:use-substitutes? use-substitutes?)
-  (manifest-show-transaction store manifest transaction
+  (show-manifest-transaction store manifest transaction
  #:dry-run? dry-run?)
   (show-what-to-build store derivations
   #:use-substitutes? use-substitutes?
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 18733a6..f2eb754 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -19,7 +19,6 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix profiles)
-  #:use-module (guix ui)
   #:use-module (guix utils)
   #:use-module (guix records)
   #:use-module (guix derivations)
@@ -63,7 +62,6 @@
 manifest-transaction-remove
 manifest-perform-transaction
 manifest-transaction-effects
-manifest-show-transaction
 
 profile-manifest
 package->manifest-entry
@@ -315,97 +313,6 @@ it."
 (manifest-add (manifest-remove manifest remove)
   install)))
 
-(define (right-arrow port)
-  "Return either a string containing the 'RIGHT ARROW' character, or an ASCII
-replacement if PORT is not Unicode-capable."
-  (with-fluids ((%default-port-encoding (port-encoding port)))
-(let ((arrow "→"))
-  (catch 'encoding-error
-(lambda ()
-  (call-with-output-string
-(lambda (port)
-  (set-port-conversion-strategy! port 'error)
-  (display arrow port
-(lambda (key . args)
-  "->")
-
-(define* (manifest-show-transaction store manifest transaction
-#:key dry-run?)
-  "Display what will/would be installed/removed from MANIFEST by TRANSACTION."
-  (define (package-strings name version output item)
-(map (lambda (name version output item)
-   (format #f "   ~a~:[:~a~;~*~]\t~a\t~a"
-   name
-   (equal? output "out") output version
-   (if (package? item)
-   (package-output store item output)
-   item)))
- name version output item))
-
-  (define →;an arrow that can be represented on stderr
-(right-arrow (current-error-port)))
-
-  (define (upgrade-string name old-version new-version output item)
-(format #f "   ~a~:[:~a~;~*~]\t~a ~a ~a\t~a"
-name (equal? output "out") output
-old-version → new-version
-(if (package? item)
-(package-output store item output)
-item)))
-
-  (let-values (((remove install upgrade)
-(manifest-transaction-effects manifest transaction)))
-(match remove
-  ((($  name version output item) ..1)
-   (let ((len(length name))
- (remove (package-strings name version output item)))
- (if dry-run?
- (format (current-error-port)
- (N_ "The following package would be removed:~%~{~a~%~}~%"
-   

ui: Move 'show-manifest-transaction' from (guix profiles).

2014-10-08 Thread Alex Kost
Hello, I tried to move (and rename for consistency with other ‘show-…’
procedures) ‘manifest-show-transaction’ from (guix profiles) to (guix
ui) as we were discussing on #guix today, but I found that tests began
to fail. And I can't figure it out.  The first failed test is
"builders.scm".  Its log and the patch with the changes I made are
attached.

Need help :(

>From bc27ebd215a16c52d434245bd618b10262fa9562 Mon Sep 17 00:00:00 2001
From: Alex Kost 
Date: Wed, 8 Oct 2014 17:15:49 +0400
Subject: [PATCH] ui: Move 'show-manifest-transaction' from (guix profiles).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès.

* guix/profiles.scm: Do not use (guix ui) module.
  (right-arrow, manifest-show-transaction): Move and rename to...
* guix/ui.scm (right-arrow, show-manifest-transaction): ... here.
* tests/profiles.scm ("manifest-show-transaction"): Move to...
* tests/ui.scm ("show-manifest-transaction"): ... here.
  (guile-1.8.8, guile-2.0.9): New variables.
* emacs/guix-main.scm (process-package-actions): Rename
  'manifest-show-transaction' to 'show-manifest-transaction'.
* guix/scripts/package.scm (guix-package): Likewise.
---
 emacs/guix-main.scm  |  2 +-
 guix/profiles.scm| 93 
 guix/scripts/package.scm |  2 +-
 guix/ui.scm  | 93 
 tests/profiles.scm   | 17 -
 tests/ui.scm | 32 +
 6 files changed, 127 insertions(+), 112 deletions(-)

diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 7dbfa61..c25dd50 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -797,7 +797,7 @@ OUTPUTS is a list of package outputs (may be an empty list)."
  (new-profile (derivation->output-path derivation)))
 (set-build-options store
#:use-substitutes? use-substitutes?)
-(manifest-show-transaction store manifest transaction
+(show-manifest-transaction store manifest transaction
#:dry-run? dry-run?)
 (show-what-to-build store derivations
 #:use-substitutes? use-substitutes?
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 18733a6..f2eb754 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -19,7 +19,6 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix profiles)
-  #:use-module (guix ui)
   #:use-module (guix utils)
   #:use-module (guix records)
   #:use-module (guix derivations)
@@ -63,7 +62,6 @@
 manifest-transaction-remove
 manifest-perform-transaction
 manifest-transaction-effects
-manifest-show-transaction
 
 profile-manifest
 package->manifest-entry
@@ -315,97 +313,6 @@ it."
 (manifest-add (manifest-remove manifest remove)
   install)))
 
-(define (right-arrow port)
-  "Return either a string containing the 'RIGHT ARROW' character, or an ASCII
-replacement if PORT is not Unicode-capable."
-  (with-fluids ((%default-port-encoding (port-encoding port)))
-(let ((arrow "→"))
-  (catch 'encoding-error
-(lambda ()
-  (call-with-output-string
-(lambda (port)
-  (set-port-conversion-strategy! port 'error)
-  (display arrow port
-(lambda (key . args)
-  "->")
-
-(define* (manifest-show-transaction store manifest transaction
-#:key dry-run?)
-  "Display what will/would be installed/removed from MANIFEST by TRANSACTION."
-  (define (package-strings name version output item)
-(map (lambda (name version output item)
-   (format #f "   ~a~:[:~a~;~*~]\t~a\t~a"
-   name
-   (equal? output "out") output version
-   (if (package? item)
-   (package-output store item output)
-   item)))
- name version output item))
-
-  (define →;an arrow that can be represented on stderr
-(right-arrow (current-error-port)))
-
-  (define (upgrade-string name old-version new-version output item)
-(format #f "   ~a~:[:~a~;~*~]\t~a ~a ~a\t~a"
-name (equal? output "out") output
-old-version → new-version
-(if (package? item)
-(package-output store item output)
-item)))
-
-  (let-values (((remove install upgrade)
-(manifest-transaction-effects manifest transaction)))
-(match remove
-  ((($  name version output item) ..1)
-   (let ((len(length name))
-