unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Use 'build-and-use-profile' from (guix scripts package).
@ 2016-03-25  8:48 Alex Kost
  2016-04-05  9:59 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Kost @ 2016-03-25  8:48 UTC (permalink / raw)
  To: guix-devel

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

This is to remove code duplication in "emacs/guix-main.scm" and
"guix/scripts/package.scm" ('build-and-use-profile' did not exist until
commits 1b67644 and d1ac5c0).

The only important (or maybe not) difference is:

  (set-guile-for-build (default-guile))

in "guix-main.scm" which does not exist in 'build-and-use-profile'.  It
was introduced in commit 4ad2e76 and I don't really understand why it is
needed.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-Use-build-and-use-profile-from-guix-scripts-pa.patch --]
[-- Type: text/x-patch, Size: 3461 bytes --]

From df96e6019edbddea09849105b2ed59059109d860 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 25 Mar 2016 11:27:18 +0300
Subject: [PATCH] emacs: Use 'build-and-use-profile' from (guix scripts
 package).

* guix/scripts/package.scm: Export 'build-and-use-profile'.
* emacs/guix-main.scm (process-package-actions): Use it.
---
 emacs/guix-main.scm      | 36 ++++++++----------------------------
 guix/scripts/package.scm |  3 ++-
 2 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 86cedfd..bcff9ce 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -917,34 +917,14 @@ OUTPUTS is a list of package outputs (may be an empty list)."
                         manifest transaction)))
     (unless (and (null? install) (null? remove))
       (with-store store
-        (let* ((derivation (run-with-store store
-                             (mbegin %store-monad
-                               (set-guile-for-build (default-guile))
-                               (profile-derivation new-manifest))))
-               (derivations (list derivation))
-               (new-profile (derivation->output-path derivation)))
-          (set-build-options store
-                             #:print-build-trace #f
-                             #:use-substitutes? use-substitutes?)
-          (show-manifest-transaction store manifest transaction
-                                     #:dry-run? dry-run?)
-          (show-what-to-build store derivations
-                              #:use-substitutes? use-substitutes?
-                              #:dry-run? dry-run?)
-          (unless dry-run?
-            (let ((name (generation-file-name
-                         profile
-                         (+ 1 (generation-number profile)))))
-              (and (build-derivations store derivations)
-                   (let* ((entries (manifest-entries new-manifest))
-                          (count   (length entries)))
-                     (switch-symlinks name new-profile)
-                     (switch-symlinks profile name)
-                     (format #t (N_ "~a package in profile~%"
-                                    "~a packages in profile~%"
-                                    count)
-                             count)
-                     (display-search-paths entries (list profile)))))))))))
+        (set-build-options store
+                           #:print-build-trace #f
+                           #:use-substitutes? use-substitutes?)
+        (show-manifest-transaction store manifest transaction
+                                   #:dry-run? dry-run?)
+        (build-and-use-profile store profile new-manifest
+                               #:use-substitutes? use-substitutes?
+                               #:dry-run? dry-run?)))))
 
 (define (delete-generations* profile generations)
   "Delete GENERATIONS from PROFILE.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1d88b33..697afc1 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -47,7 +47,8 @@
   #:autoload   (gnu packages base) (canonical-package)
   #:autoload   (gnu packages guile) (guile-2.0)
   #:autoload   (gnu packages bootstrap) (%bootstrap-guile)
-  #:export (delete-generations
+  #:export (build-and-use-profile
+            delete-generations
             display-search-paths
             guix-package))
 
-- 
2.6.3


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

* Re: [PATCH] emacs: Use 'build-and-use-profile' from (guix scripts package).
  2016-03-25  8:48 [PATCH] emacs: Use 'build-and-use-profile' from (guix scripts package) Alex Kost
@ 2016-04-05  9:59 ` Ludovic Courtès
  2016-04-05 22:04   ` Alex Kost
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2016-04-05  9:59 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> This is to remove code duplication in "emacs/guix-main.scm" and
> "guix/scripts/package.scm" ('build-and-use-profile' did not exist until
> commits 1b67644 and d1ac5c0).
>
> The only important (or maybe not) difference is:
>
>   (set-guile-for-build (default-guile))
>
> in "guix-main.scm" which does not exist in 'build-and-use-profile'.  It
> was introduced in commit 4ad2e76 and I don't really understand why it is
> needed.

For future reference, this was(?) needed because ‘run-with-store’ has
its #:guile parameter default to (%guile-for-build), which itself
defaults to #f (4ad2e76 and e87f059 hint at this.)

I presume that somehow ‘%guile-for-build’ or #:guile gets the right
value in this case.

Ludo’.

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

* Re: [PATCH] emacs: Use 'build-and-use-profile' from (guix scripts package).
  2016-04-05  9:59 ` Ludovic Courtès
@ 2016-04-05 22:04   ` Alex Kost
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Kost @ 2016-04-05 22:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-04-05 12:59 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> This is to remove code duplication in "emacs/guix-main.scm" and
>> "guix/scripts/package.scm" ('build-and-use-profile' did not exist until
>> commits 1b67644 and d1ac5c0).
>>
>> The only important (or maybe not) difference is:
>>
>>   (set-guile-for-build (default-guile))
>>
>> in "guix-main.scm" which does not exist in 'build-and-use-profile'.  It
>> was introduced in commit 4ad2e76 and I don't really understand why it is
>> needed.
>
> For future reference, this was(?) needed because ‘run-with-store’ has
> its #:guile parameter default to (%guile-for-build), which itself
> defaults to #f (4ad2e76 and e87f059 hint at this.)
>
> I presume that somehow ‘%guile-for-build’ or #:guile gets the right
> value in this case.

Thanks for the info!  I already pushed this patch, and I have not had
any problems with it so far.  Let's see if it will introduced bugs or
not :-)

-- 
Alex

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

end of thread, other threads:[~2016-04-05 22:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-25  8:48 [PATCH] emacs: Use 'build-and-use-profile' from (guix scripts package) Alex Kost
2016-04-05  9:59 ` Ludovic Courtès
2016-04-05 22:04   ` Alex Kost

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).