[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Emacs interface for Guix
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] Emacs interface for Guix |
Date: |
Wed, 13 Aug 2014 18:03:22 +0200 |
User-agent: |
Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux) |
Alex Kost <address@hidden> skribis:
> 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?
Yes, that’s fine too.
> And manifest-transaction stuff could look like this:
>
> (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))))
Looks good!
> (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".)
Yes.
Could you turn the above thing into a patch with a commit log? Bonus
points for ‘manifest-perform-transaction’ unit tests. Make sure to add
a copyright line for yourself in profiles.scm.
And then a second patch to actually use it in (guix scripts package)
would be wonderful. :-)
In the next iteration, ‘show-what-to-remove/install’ should report
packages that are going to be upgraded (by checking among ‘install’
those are already in the manifest.)
> Also I think "guix.el" should check for freshness too, so
> ‘check-package-freshness’ should probably be exported.
Yes, probably in the (gnu packages) module?
Thanks,
Ludo’.
- Re: Emacs interface for Guix, Ludovic Courtès, 2014/08/11
- [PATCH] Emacs interface for Guix, Alex Kost, 2014/08/12
- Re: [PATCH] Emacs interface for Guix, Ludovic Courtès, 2014/08/12
- Re: [PATCH] Emacs interface for Guix, Alex Kost, 2014/08/12
- Re: [PATCH] Emacs interface for Guix, Ludovic Courtès, 2014/08/12
- Re: [PATCH] Emacs interface for Guix, Alex Kost, 2014/08/13
- Re: [PATCH] Emacs interface for Guix,
Ludovic Courtès <=
- Re: [PATCH] Emacs interface for Guix, Alex Kost, 2014/08/13
- Re: [PATCH] Emacs interface for Guix, Alex Kost, 2014/08/15
- Re: [PATCH] Emacs interface for Guix, Ludovic Courtès, 2014/08/16
- [PATCH] manifest-transaction, Alex Kost, 2014/08/16
- [PATCH] profiles: Report about upgrades., Alex Kost, 2014/08/20
- Re: [PATCH] profiles: Report about upgrades., Ludovic Courtès, 2014/08/23
- Re: [PATCH] profiles: Report about upgrades., Ludovic Courtès, 2014/08/30
- Re: [PATCH] profiles: Report about upgrades., Alex Kost, 2014/08/31
- Re: [PATCH] profiles: Report about upgrades., Ludovic Courtès, 2014/08/31
- Re: [PATCH] profiles: Report about upgrades., Jason Self, 2014/08/31