From: Alex Kost <alezost@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] Emacs interface for Guix
Date: Wed, 13 Aug 2014 10:57:34 +0400 [thread overview]
Message-ID: <87lhqsev1d.fsf@gmail.com> (raw)
In-Reply-To: <87d2c5h4if.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 12 Aug 2014 21:50:00 +0200")
[-- Attachment #1: Type: text/plain, Size: 2454 bytes --]
Ludovic Courtès (2014-08-12 23:50 +0400) wrote:
[...]
>>> What about introducing a <manifest-transaction> type that would contain
>>> a list of packages to install, to remove, and to upgrade, and we could do:
>>
>> I think only “install” part should contain a list of packages (or
>> (PACKAGE OUTPUT) things). Upgrading and removing can be performed on
>> obsolete packages, so only a package specification of an installed
>> package is known in such cases. Perhaps any pattern (package (with
>> "out" output), (package output), name specification) should be accepted.
>
> The arguments should be the same as (or compatible) for ‘manifest-add’
> and ‘manifest-remove’.
>
> So the list of packages could be installed could be a list of (PACKAGE
> OUTPUT) as you note.
>
> The list of packages to upgrade could a list of (PACKAGE OUTPUT) as
> well, computed by ‘guix package’ or guix.el. (The difficulty here is
> that (guix profiles) should not depend on (gnu packages).)
>
> The list of packages to remove should be a list of <manifest-pattern>.
>
>> So there will be ‘make-manifest-transaction’ function with #:install,
>> #:upgrade, #:remove keys. Do I understand it right?
>
> Rather, use (define-record-type* <manifest-transaction> ...), so we can
> then write:
>
> (manifest-transaction
> (install lst1)
> (remove lst2)
> ...)
>
>>> ;; Show what will/would be installed, removed, etc.
>>> (show-transaction manifest transaction #:dry-run? bool)
>>>
>>> ;; Do the installation/removal/upgrades listed in TRANSACTION, and
>>> ;; return the new manifest.
>>> (manifest-perform-transaction manifest transaction)
>>
>> So ‘manifest-perform-transaction’ will open connection? If so,
>> shouldn't it accept '#:dry-run' and '#:use-substitutes?' keys?
>
> No, it would just return the new manifest, built by successive calls to
> ‘manifest-add’ and ‘manifest-remove’. Very simple.
>
> The actual profile is still built with ‘profile-derivation’.
I realized there could be a problem with (PACKAGE OUTPUT) elements.
They should be transformed into manifest entries, but
"guix/scripts/package.scm" uses ‘package->manifest-entry*’ for that, so
this cannot be performed in (guix profiles) module. Perhaps “install”
should just contain a list of manifest entries. WDYT?
And manifest-transaction stuff could look like this:
[-- Attachment #2: Type: text/plain, Size: 2584 bytes --]
(define-record-type* <manifest-transaction> manifest-transaction
make-manifest-transaction
manifest-transaction?
(install manifest-transaction-install ; list of <manifest-entry>
(default '()))
(remove manifest-transaction-remove ; list of <manifest-pattern>
(default '())))
(define (manifest-perform-transaction manifest transaction)
"Perform TRANSACTION on MANIFEST and return new manifest."
(let ((install (manifest-transaction-install transaction))
(remove (manifest-transaction-remove transaction)))
(manifest-add (manifest-remove manifest remove)
install)))
(define* (show-transaction manifest transaction #:key dry-run?)
"Display what will/would be installed/removed from MANIFEST by TRANSACTION."
(let ((install (manifest-transaction-install transaction))
(remove (manifest-matching-entries
manifest
(manifest-transaction-remove transaction))))
(match remove
((($ <manifest-entry> name version output path _) ..1)
(let ((len (length name))
(remove (map (cut format #f " ~a-~a\t~a\t~a" <> <> <> <>)
name version output path)))
(if dry-run?
(format (current-error-port)
(N_ "The following package would be removed:~%~{~a~%~}~%"
"The following packages would be removed:~%~{~a~%~}~%"
len)
remove)
(format (current-error-port)
(N_ "The following package will be removed:~%~{~a~%~}~%"
"The following packages will be removed:~%~{~a~%~}~%"
len)
remove))))
(_ #f))
(match install
((($ <manifest-entry> name version output path _) ..1)
(let ((len (length name))
(install (map (cut format #f " ~a-~a\t~a\t~a" <> <> <> <>)
name version output path)))
(if dry-run?
(format (current-error-port)
(N_ "The following package would be installed:~%~{~a~%~}~%"
"The following packages would be installed:~%~{~a~%~}~%"
len)
install)
(format (current-error-port)
(N_ "The following package will be installed:~%~{~a~%~}~%"
"The following packages will be installed:~%~{~a~%~}~%"
len)
install))))
(_ #f))))
[-- Attachment #3: Type: text/plain, Size: 298 bytes --]
(I excluded “upgrade” part as it's the same as “install”, and
‘show-transaction’ is almost the same as ‘show-what-to-remove/install’
from "package.scm".)
Also I think "guix.el" should check for freshness too, so
‘check-package-freshness’ should probably be exported.
next prev parent reply other threads:[~2014-08-13 6:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 17:58 Emacs interface for Guix Alex Kost
2014-07-25 20:36 ` Ludovic Courtès
2014-07-26 17:44 ` Alex Kost
2014-07-28 10:15 ` Alex Kost
2014-08-11 20:54 ` Ludovic Courtès
2014-08-12 10:19 ` [PATCH] " Alex Kost
2014-08-12 14:19 ` Ludovic Courtès
2014-08-12 16:20 ` Alex Kost
2014-08-12 19:50 ` Ludovic Courtès
2014-08-13 6:57 ` Alex Kost [this message]
2014-08-13 16:03 ` Ludovic Courtès
2014-08-13 20:58 ` Alex Kost
2014-08-15 5:51 ` Alex Kost
2014-08-16 9:27 ` Ludovic Courtès
2014-08-16 10:52 ` [PATCH] manifest-transaction Alex Kost
2014-08-20 12:10 ` [PATCH] profiles: Report about upgrades Alex Kost
2014-08-23 11:58 ` Ludovic Courtès
2014-08-30 19:56 ` Ludovic Courtès
2014-08-31 6:04 ` Alex Kost
2014-08-31 19:57 ` Ludovic Courtès
2014-08-31 22:54 ` Jason Self
2014-09-01 7:13 ` Alex Kost
2014-09-02 19:45 ` Ludovic Courtès
[not found] ` <87egvrke1z.fsf@gmail.com>
2014-09-04 19:37 ` Ludovic Courtès
2014-08-16 12:24 ` [PATCH] Emacs interface for Guix Ludovic Courtès
2014-08-16 13:07 ` Alex Kost
2014-08-19 21:00 ` Ludovic Courtès
2014-08-20 10:54 ` Alex Kost
2014-08-22 8:56 ` Ludovic Courtès
2014-08-22 12:44 ` Alex Kost
2014-08-27 8:34 ` Ludovic Courtès
2014-10-04 17:59 ` [PATCH] guix package: Export generation procedures Alex Kost
2014-10-04 20:23 ` Ludovic Courtès
2014-10-05 8:54 ` [PATCH] emacs: Add support for deleting generations Alex Kost
2014-10-05 13:14 ` Ludovic Courtès
2014-10-05 18:23 ` Alex Kost
2014-10-05 19:20 ` Ludovic Courtès
2014-10-05 20:04 ` Alex Kost
2014-10-06 7:36 ` Ludovic Courtès
2014-10-06 14:14 ` [PATCH] guix package: Add '--switch-generation' option Alex Kost
2014-10-06 19:27 ` Ludovic Courtès
2014-10-07 10:04 ` Alex Kost
2014-10-07 16:00 ` Ludovic Courtès
2014-10-07 21:32 ` Alex Kost
2014-10-08 9:44 ` Ludovic Courtès
2014-10-05 14:44 ` [PATCH] guix package: Export generation procedures Andreas Enge
2014-10-05 19:21 ` Ludovic Courtès
2014-07-26 20:58 ` Emacs interface for Guix Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lhqsev1d.fsf@gmail.com \
--to=alezost@gmail.com \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.