From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] guix package: add a "show" option. Date: Tue, 15 Jul 2014 23:23:15 +0200 Message-ID: <87r41mjozg.fsf@gnu.org> References: <1405277641-2891-1-git-send-email-tipecaml@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]:43987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7AC7-0000pC-N6 for guix-devel@gnu.org; Tue, 15 Jul 2014 17:23:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7ABy-0002oG-Mw for guix-devel@gnu.org; Tue, 15 Jul 2014 17:23:27 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:56236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7ABy-0002nO-BP for guix-devel@gnu.org; Tue, 15 Jul 2014 17:23:18 -0400 In-Reply-To: <1405277641-2891-1-git-send-email-tipecaml@gmail.com> (Cyril Roelandt's message of "Sun, 13 Jul 2014 20:54:01 +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: Cyril Roelandt Cc: guix-devel@gnu.org Cyril Roelandt skribis: > * guix/packages.scm (package-direct-inputs): New procedure. > * guix/scripts/package.scm: Add a "show" option. > * tests/guix-package.sh: Add a test for the "show" option. Given that there is popular demand ;-), here=E2=80=99s a better review. > +(define (package-direct-inputs package) > + (sort (append (package-inputs package) > + (package-native-inputs package) > + (package-propagated-inputs package)) > + (lambda (p1 p2) > + (string + (display (_ " > + --show=3DPACKAGE show details about PACKAGE")) Please also add it to guix.texi, mentioning that the output is in recutils format. > + (('show-package requested-name) > + (let* ((available (fold-packages > + (lambda (p r) > + (let ((name (package-name p)) > + (full-name (package-full-name p))) > + (if (or (string=3D? requested-name name) > + (string=3D? requested-name full-= name)) > + (cons p r) > + r))) > + '()))) Use =E2=80=98specification->package+output=E2=80=99 (and ignore the second = return value) instead of =E2=80=98fold-packages=E2=80=99. > + (leave-on-EPIPE > + (for-each (lambda (p) > + (format #t "Package: ~a\n\ > +Version: ~a\n\ > +Description: ~a\n\ > +Depends: ~a\n\ > +Homepage: ~a\n\ > +License: ~a\n~%" > + (package-name p) > + (package-version p) > + (package-description p) > + (string-join (map car (package-direct-in= puts p)) ", ") > + (package-home-page p) > + (license-name (package-license p)))) Use =E2=80=98package->recutils=E2=80=99 instead of this. In a separate patch, you can augment it to add the =E2=80=98depends=E2=80= =99 field. > + (sort available > + (lambda (p1 p2) > + (version>? (package-version p2) (package-v= ersion p1)))))) Sort by =E2=80=98package-full-name=E2=80=99 instead of =E2=80=98package-ver= sion=E2=80=99. Thoughts? Thanks! Ludo=E2=80=99.