From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH] Emacs interface for Guix Date: Wed, 13 Aug 2014 10:57:34 +0400 Message-ID: <87lhqsev1d.fsf@gmail.com> References: <87k3719v7p.fsf@gmail.com> <87r419fa50.fsf@gnu.org> <87fvho9fqm.fsf@gmail.com> <87a97taixl.fsf@gmail.com> <87sil2rbly.fsf@gnu.org> <87tx5idn7f.fsf_-_@gmail.com> <87egwlkcy1.fsf@gnu.org> <87ppg5el2i.fsf@gmail.com> <87d2c5h4if.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHSVD-0005xA-4x for guix-devel@gnu.org; Wed, 13 Aug 2014 02:57:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHSV3-0004I6-Um for guix-devel@gnu.org; Wed, 13 Aug 2014 02:57:42 -0400 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") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s (2014-08-12 23:50 +0400) wrote: [...] >>> What about introducing a type that would contain >>> a list of packages to install, to remove, and to upgrade, and we could = do: >> >> I think only =E2=80=9Cinstall=E2=80=9D part should contain a list of pac= kages (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 =E2=80=98manifest= -add=E2=80=99 > and =E2=80=98manifest-remove=E2=80=99. > > 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 =E2=80=98guix package=E2=80=99 or guix.el. (The diffic= ulty here is > that (guix profiles) should not depend on (gnu packages).) > > The list of packages to remove should be a list of . > >> So there will be =E2=80=98make-manifest-transaction=E2=80=99 function wi= th #:install, >> #:upgrade, #:remove keys. Do I understand it right? > > Rather, use (define-record-type* ...), 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 =E2=80=98manifest-perform-transaction=E2=80=99 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 > =E2=80=98manifest-add=E2=80=99 and =E2=80=98manifest-remove=E2=80=99. Ve= ry simple. > > The actual profile is still built with =E2=80=98profile-derivation=E2=80= =99. I realized there could be a problem with (PACKAGE OUTPUT) elements. They should be transformed into manifest entries, but "guix/scripts/package.scm" uses =E2=80=98package->manifest-entry*=E2=80=99 = for that, so this cannot be performed in (guix profiles) module. Perhaps =E2=80=9Cinsta= ll=E2=80=9D should just contain a list of manifest entries. WDYT? And manifest-transaction stuff could look like this: --=-=-= Content-Type: text/plain Content-Disposition: inline (define-record-type* manifest-transaction make-manifest-transaction manifest-transaction? (install manifest-transaction-install ; list of (default '())) (remove manifest-transaction-remove ; list of (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 ((($ 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 ((($ 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)))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable (I excluded =E2=80=9Cupgrade=E2=80=9D part as it's the same as =E2=80=9Cins= tall=E2=80=9D, and =E2=80=98show-transaction=E2=80=99 is almost the same as =E2=80=98show-what= -to-remove/install=E2=80=99 from "package.scm".) Also I think "guix.el" should check for freshness too, so =E2=80=98check-package-freshness=E2=80=99 should probably be exported. --=-=-=--