From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dlAVD-000594-6W for guix-patches@gnu.org; Fri, 25 Aug 2017 05:02:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dlAV8-0001CE-TJ for guix-patches@gnu.org; Fri, 25 Aug 2017 05:02:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:44866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dlAV8-0001C6-PY for guix-patches@gnu.org; Fri, 25 Aug 2017 05:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dlAV8-0001QD-AS for guix-patches@gnu.org; Fri, 25 Aug 2017 05:02:02 -0400 Subject: [bug#27907] [PATCH] graph: Provide access to the package record in the emit Resent-Message-ID: References: <87lgn3w0n6.fsf@gnu.org> <87inhchab4.fsf@gnu.org> From: Roel Janssen In-reply-to: <87inhchab4.fsf@gnu.org> Date: Fri, 25 Aug 2017 11:00:51 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 27907@debbugs.gnu.org Ludovic Courtès writes: > Hi! > > ludo@gnu.org (Ludovic Courtès) skribis: > >> Roel Janssen skribis: >> >>> I would like to expand the Cypher back-end and in the long run add a >>> SPARQL graph back-end to GNU Guix. For this, I will need to have access >>> to the package records inside the emit-* functions. >>> >>> This patch makes this change by essentially changing the "label" >>> parameter of the emit-* functions passed as "(node-label head)" into a >>> "node" parameter, passed as "head". >>> >>> The rest of the patch adapts the current emit-* functions to this >>> change. >>> >>> I tested the Graphviz, D3js, and Cypher back-ends, and all seem to work >>> as before. >>> >>> Is it OK to apply this change? >> >> Sure, looks good to me! > > Actually no! :-) > > The problem was that it broke all non-package-related “node types” (like > “guix graph -t references”), and it had the problem that it ignores the > ‘label’ procedure in . And “make check” failed. > > So I reverted it in 5e60bef9802e448924f889d34d95a249b008652c. We need > to rethink about it. > > Cheers, > Ludo’. Oops! I am sorry about this. Would it not break if we include a check for whether the node type is a package or not. Then, non-package node types are handled the “old way” and packages are handled the “new way”. I think we cannot have a generic way of exposing the specifics of a node type, so if we need to expose more information for the other node types, we have to add a type-specific implementation. If this sounds like a good idea I'll write a new patch. And while I'm at it, what set of commands fully cover the graph code for all node types? Just all variants in 'guix graph --type=X'? Thanks! Kind regards, Roel Janssen