From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] Emacs interface for Guix Date: Wed, 13 Aug 2014 18:03:22 +0200 Message-ID: <877g2c74xh.fsf@gnu.org> 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> <87lhqsev1d.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHb1U-0000Hw-8D for guix-devel@gnu.org; Wed, 13 Aug 2014 12:03:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHb1J-0004hS-GE for guix-devel@gnu.org; Wed, 13 Aug 2014 12:03:36 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:32991) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHb1J-0004h5-1w for guix-devel@gnu.org; Wed, 13 Aug 2014 12:03:25 -0400 In-Reply-To: <87lhqsev1d.fsf@gmail.com> (Alex Kost's message of "Wed, 13 Aug 2014 10:57:34 +0400") 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: Alex Kost Cc: guix-devel@gnu.org Alex Kost 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 =E2=80=98package->manifest-entry*=E2=80= =99 for that, so > this cannot be performed in (guix profiles) module. Perhaps =E2=80=9Cins= tall=E2=80=9D > should just contain a list of manifest entries. WDYT? Yes, that=E2=80=99s fine too. > And manifest-transaction stuff could look like this: > > (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 TRANSACT= ION." > (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)))) Looks good! > (I excluded =E2=80=9Cupgrade=E2=80=9D part as it's the same as =E2=80=9Ci= nstall=E2=80=9D, and > =E2=80=98show-transaction=E2=80=99 is almost the same as =E2=80=98show-wh= at-to-remove/install=E2=80=99 > from "package.scm".) Yes. Could you turn the above thing into a patch with a commit log? Bonus points for =E2=80=98manifest-perform-transaction=E2=80=99 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, =E2=80=98show-what-to-remove/install=E2=80=99 should= report packages that are going to be upgraded (by checking among =E2=80=98install= =E2=80=99 those are already in the manifest.) > Also I think "guix.el" should check for freshness too, so > =E2=80=98check-package-freshness=E2=80=99 should probably be exported. Yes, probably in the (gnu packages) module? Thanks, Ludo=E2=80=99.