From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH 3/3] emacs: Add "Source" field to 'guix-info' buffers. Date: Wed, 12 Nov 2014 09:56:51 +0300 Message-ID: <87ioik6h58.fsf@gmail.com> References: <87egtcbwd0.fsf@gmail.com> <87lhnktgh7.fsf@gnu.org> <878ujkb475.fsf@gmail.com> <87d28wq9kj.fsf@gnu.org> <878ujj2nyo.fsf@gmail.com> <87y4riiqhf.fsf@gnu.org> <877fz14kjx.fsf@gmail.com> <87bnodh5n5.fsf@gnu.org> 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]:34694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoRrU-00068F-Pz for guix-devel@gnu.org; Wed, 12 Nov 2014 01:57:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoRrL-0001mo-Ol for guix-devel@gnu.org; Wed, 12 Nov 2014 01:57:04 -0500 In-Reply-To: <87bnodh5n5.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 11 Nov 2014 20:57:34 +0100") 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 Ludovic Court=C3=A8s (2014-11-11 22:57 +0300) wrote: > Alex Kost skribis: > >> Ludovic Court=C3=A8s (2014-11-11 02:29 +0300) wrote: [...] >>> There=E2=80=99s still the possibility that (1) the source is there, so = no >>> =E2=80=9CDownload=E2=80=9D button, (2) the source is GC=E2=80=99d, and = (3) there=E2=80=99s still no >>> =E2=80=9CDownload=E2=80=9D button and trying to access the source fails= gracelessly. >>> >>> That=E2=80=99s probably not very common in practice, and easily fixed b= y hitting >>> =E2=80=98g=E2=80=99, so maybe it=E2=80=99s not worth worrying. WDYT? >> >> Do you mean a user deleted the source (with "guix gc") when a =E2=80=9Cp= ackage >> info=E2=80=9D buffer was displayed? Sure such cases are not (and I thin= k cannot >> be) handled. It's the same as if: >> >> 1) a user has a list of installed packages, >> >> 2) installs another package somewhere outside (e.g., in a shell with >> "guix package -i"), >> >> 3) and wonders why the list is not up-to-date. >> >> Of course it is not up-to-date! He needs to revert a buffer after that. > > It=E2=80=99s not really comparable, because GC is always something that c= an > happen concurrently (one may choose to run it from cron, for instance.) > But let=E2=80=99s ignore this possibility for the present case. :-) OK, thanks >>>> +(define (package-source-names package) >>>> + "Return a list of source names (URLs) of the PACKAGE." >>>> + (let ((source (package-source package))) >>>> + (and (origin? source) >>>> + (filter-map (lambda (uri) >>>> + (cond ((string? uri) >>>> + uri) >>>> + ((git-reference? uri) >>>> + (git-reference-url uri)) >>>> + (else #f))) >>>> + (list-maybe (origin-uri source)))))) >>> >>> The #f case above just leads to degraded display, not breakage, right? >>> (I=E2=80=99m asking because of the other things beyond string? and >>> git-reference?.) >> >> Yes, there _would_ be just "Source: =E2=80=93", but it will not happen b= ecause >> there are no other things beyond a string URL and a git-reference URL. > > There=E2=80=99s also =E2=80=98svn-reference=E2=80=99 (not currently used)= , and possibly other > things. > > The point is that this part will have to be updated anytime new origin > methods are added. Yes, sure. What about making =E2=80=9C(else "Unknown source type")=E2=80= =9D? And if some package will use a new origin method, a =E2=80=9CSource=E2=80=9D field= will display =E2=80=9CUnknown source type=E2=80=9D string, so we'll not forget to update= this thing. >> From 733c5276bcb9ded008e9c0a4dbe2e5fb6561b5eb Mon Sep 17 00:00:00 2001 >> From: Alex Kost >> Date: Sun, 9 Nov 2014 11:03:39 +0300 >> Subject: [PATCH] emacs: Add "Source" field to 'guix-info' buffers. >> MIME-Version: 1.0 >> Content-Type: text/plain; charset=3DUTF-8 >> Content-Transfer-Encoding: 8bit >> >> Suggested by Ludovic Court=C3=A8s. >> >> * emacs/guix-info.el (guix-info-insert-methods, guix-info-displayed-para= ms): >> Add 'source' parameter. >> (guix-package-info-source): New face. >> (guix-package-source): New button type. >> (guix-package-info-auto-find-source, guix-package-info-auto-download-s= ource, >> guix-package-info-download-buffer): New variables. >> (guix-package-info-show-source, guix-package-info-insert-source-url, >> guix-package-info-insert-source, guix-package-info-download-source, >> guix-package-info-redisplay-after-download): New procedures. >> * emacs/guix-base.el (guix-param-titles): Add 'source' parameter. >> (guix-operation-prompt): Add 'prompt' argument. >> (guix-after-source-download-hook): New variable. >> (guix-package-source-path, guix-package-source-build-derivation): New >> procedures. >> * emacs/guix-main.scm (%package-param-alist): Add 'source' parameter. >> (package-source-names, package-source-derivation->store-path, >> package-source-path, package-source-build-derivation): New procedures. > > I think we=E2=80=99re all set now, no? :-) I think so. May I commit with the above =E2=80=9CUnknown source type=E2=80= =9D addition? --=20 Alex