From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPQ8z-00068X-Kp for guix-patches@gnu.org; Wed, 21 Nov 2018 05:54:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPQ8y-0002hR-To for guix-patches@gnu.org; Wed, 21 Nov 2018 05:54:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33584) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPQ8w-0002Zo-Ea for guix-patches@gnu.org; Wed, 21 Nov 2018 05:54:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gPQ8w-0007g8-8u for guix-patches@gnu.org; Wed, 21 Nov 2018 05:54:02 -0500 Subject: [bug#33448] [PATCH] describe: Add json format. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20181120222616.3941-1-go.wigust@gmail.com> <20181121070051.12041-1-go.wigust@gmail.com> Date: Wed, 21 Nov 2018 11:53:32 +0100 In-Reply-To: <20181121070051.12041-1-go.wigust@gmail.com> (Oleg Pykhalov's message of "Wed, 21 Nov 2018 10:00:51 +0300") Message-ID: <8736ruu2fn.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Oleg Pykhalov Cc: 33448@debbugs.gnu.org Oleg Pykhalov skribis: > * guix/scripts/describe.scm: Add json format. Please describe the modified and added variables/procedures. > + (define (channels format) > + (map (lambda (entry) > + (match (assq 'source (manifest-entry-properties entry)) > + (('source ('repository ('version 0) > + ('url url) > + ('branch branch) > + ('commit commit) > + _ ...)) > + (case format > + ((scm) > + `(channel (name ',(string->symbol > + (manifest-entry-name entry))) > + (url ,url) > + (commit ,commit))) > + ((json) > + `((name . ,(string->symbol > + (manifest-entry-name entry))) > + (url . ,url) > + (commit . ,commit))))) > + > + ;; Pre-0.15.0 Guix does not provide that information, > + ;; so there's not much we can do in that case. > + (_ '???))) > + > + ;; Show most recently installed packages last. > + (reverse > + (manifest-entries > + (profile-manifest > + (if (zero? number) > + profile > + (generation-file-name profile number))))))) How about turning this into a list of objects, and then, separately have =E2=80=98channels->sexp=E2=80=99 and =E2=80=98channels->jso= n=E2=80=99? That would avoid having dealing with the format in two different places. Also, could you mention the new format in the manual? Last question: what use case do you have in mind regarding the JSON format? I=E2=80=99m asking because we don=E2=80=99t have tools that can co= nsume it so far. Thanks, Ludo=E2=80=99.