unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help adding a graph backend
@ 2023-02-10  3:10 Kyle Andrews
  2023-02-10  7:11 ` Julien Lepiller
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kyle Andrews @ 2023-02-10  3:10 UTC (permalink / raw)
  To: guix-devel


Dear Guix,

I am not very comfortable editing Guix source code. However, I would
very much like to add a new backend for `guix graph`. Right now guix
graph descriptions can only be exported into special purpose tools like
graphviz, D3, and cypher. I would like to add a fourth option which
would support loading the dependency data into general purpose network analysis software tools: an edgelist backend.

=> https://en.wikipedia.org/wiki/Edge_list

I think this code will do the job, but I don't know how to test it. So, I don't know for sure.

``` guix/graph.scm
(define (el-prologue name port)
  (display "from, to" port))

(define (el-epilogue port)
  (display "\n" port))

(define (el-node id label port)
  (display "" port))

(define (el-edge id1 id2 port)
  (format port "~a, ~a\n"))

(define %edgelist-backend
  (graph-backend "edgelist"
                 "Generate graph in CSV edge list format"
                 el-prologue el-epilogue
                 el-node el-edge))

(define %graph-backends
  (list %graphviz-backend
        %d3js-backend
        %cypher-backend
        %edgelist-backend)) ; <- the new proposed backend
```

Maybe it would be using some incantation involving ./pre-inst-env? I gave it a try following the manual:

```
cd ~/{{path/to/guix}}
guix shell -D guix
./bootstrap
./configure
```

This gave an error:

```
configure: error: chosen localstatedir '/usr/local/var' does not match that of the existing installation '/var'
Installing may corrupt /gnu/store!
Use './configure --localstatedir=/var'.
```

Since I am not that excited about corrupting my /gnu/store given that I don't know what I am doing, I didn't proceed further. 

I figured because I wanted to extend Guix with a new feature and that I
could piece together a story in my head about how the code should look, my query should be sent to this list rather than to help-guix.

Thanks in advance for any helpful suggestions towards getting this backend added to Guix!

Cheers,
Kyle


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Help adding a graph backend
  2023-02-10  3:10 Help adding a graph backend Kyle Andrews
@ 2023-02-10  7:11 ` Julien Lepiller
  2023-02-10  9:25 ` Attila Lendvai
  2023-02-10  9:30 ` Andreas Enge
  2 siblings, 0 replies; 5+ messages in thread
From: Julien Lepiller @ 2023-02-10  7:11 UTC (permalink / raw)
  To: guix-devel, Kyle Andrews

As the message says, use ./configure --localstatedir=/var :)

Le 10 février 2023 04:10:02 GMT+01:00, Kyle Andrews <kyle@posteo.net> a écrit :
>
>Dear Guix,
>
>I am not very comfortable editing Guix source code. However, I would
>very much like to add a new backend for `guix graph`. Right now guix
>graph descriptions can only be exported into special purpose tools like
>graphviz, D3, and cypher. I would like to add a fourth option which
>would support loading the dependency data into general purpose network analysis software tools: an edgelist backend.
>
>=> https://en.wikipedia.org/wiki/Edge_list
>
>I think this code will do the job, but I don't know how to test it. So, I don't know for sure.
>
>``` guix/graph.scm
>(define (el-prologue name port)
>  (display "from, to" port))
>
>(define (el-epilogue port)
>  (display "\n" port))
>
>(define (el-node id label port)
>  (display "" port))
>
>(define (el-edge id1 id2 port)
>  (format port "~a, ~a\n"))
>
>(define %edgelist-backend
>  (graph-backend "edgelist"
>                 "Generate graph in CSV edge list format"
>                 el-prologue el-epilogue
>                 el-node el-edge))
>
>(define %graph-backends
>  (list %graphviz-backend
>        %d3js-backend
>        %cypher-backend
>        %edgelist-backend)) ; <- the new proposed backend
>```
>
>Maybe it would be using some incantation involving ./pre-inst-env? I gave it a try following the manual:
>
>```
>cd ~/{{path/to/guix}}
>guix shell -D guix
>./bootstrap
>./configure
>```
>
>This gave an error:
>
>```
>configure: error: chosen localstatedir '/usr/local/var' does not match that of the existing installation '/var'
>Installing may corrupt /gnu/store!
>Use './configure --localstatedir=/var'.
>```
>
>Since I am not that excited about corrupting my /gnu/store given that I don't know what I am doing, I didn't proceed further. 
>
>I figured because I wanted to extend Guix with a new feature and that I
>could piece together a story in my head about how the code should look, my query should be sent to this list rather than to help-guix.
>
>Thanks in advance for any helpful suggestions towards getting this backend added to Guix!
>
>Cheers,
>Kyle
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Help adding a graph backend
  2023-02-10  3:10 Help adding a graph backend Kyle Andrews
  2023-02-10  7:11 ` Julien Lepiller
@ 2023-02-10  9:25 ` Attila Lendvai
  2023-02-10  9:30 ` Andreas Enge
  2 siblings, 0 replies; 5+ messages in thread
From: Attila Lendvai @ 2023-02-10  9:25 UTC (permalink / raw)
  To: Kyle Andrews; +Cc: guix-devel

> Since I am not that excited about corrupting my /gnu/store given
> that I don't know what I am doing, I didn't proceed further.

you shouldn't worry until you actually install some packages that you have modified. a subsequent `guix gc` will delete anything you have produced into /gnu/store but haven't installed.

this should work in a git checkout:

guix shell --pure --development guix
./bootstrap
./configure --localstatedir=/var --sysconfdir=/etc
make -j
./pre-inst-env guix graph ...

afterwards you don't need to invoke `make -j` every time you modify something, it just makes the startup time faster.

if you'll ever need to use extra channels and/or packages:

export GUIX_PACKAGE_PATH=/path/to/some-guile-modules:/another/path
export GUILE_LOAD_PATH=/path/to/some-guile-modules:$GUILE_LOAD_PATH

HTH,

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“The fatal attraction of government is that it allows busybodies to impose decisions on others without paying any price themselves.”
	— Thomas Sowell (1930–)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Help adding a graph backend
  2023-02-10  3:10 Help adding a graph backend Kyle Andrews
  2023-02-10  7:11 ` Julien Lepiller
  2023-02-10  9:25 ` Attila Lendvai
@ 2023-02-10  9:30 ` Andreas Enge
  2023-02-10 19:03   ` Kyle
  2 siblings, 1 reply; 5+ messages in thread
From: Andreas Enge @ 2023-02-10  9:30 UTC (permalink / raw)
  To: Kyle Andrews; +Cc: guix-devel

Hello Kyle,

Am Fri, Feb 10, 2023 at 03:10:02AM +0000 schrieb Kyle Andrews:
> configure: error: chosen localstatedir '/usr/local/var' does not match that of the existing installation '/var'

you should do exactly as suggested: Before running "make", configure the
Guix source code not by "./configure", but
   ./configure --localstatedir=/var

Personally I think this is a bug in Guix: It was chosen to follow the
standard configure behaviour (installation directories under /usr/local).
But it would probably be better to let the Guix behaviour be the one
that everybody wants (especially newcomers), and to leave options like
--localstatedir to people needing to do something unusual.

Andreas



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Help adding a graph backend
  2023-02-10  9:30 ` Andreas Enge
@ 2023-02-10 19:03   ` Kyle
  0 siblings, 0 replies; 5+ messages in thread
From: Kyle @ 2023-02-10 19:03 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1721 bytes --]

Thanks, Andreas! 

For my own education I just tried running ./configure with no arguments on Ubuntu and it ran without error. I wasnt actually able to run pre-inst-env afterwards though since I am not an administrator on that system. That behavior, though, seems consistent with what I think you are saying: setting up pre-inst-env is currently easier by default for foreign distro users than for guixsd users. I can see how that made perfect sense when Guix was only used with a foreign distro. I don't know much about what is actually happening in ./configure, but it also makes sense to me that the default now should depend on what the host system actually is. Then the manual could include those standard lines in a source block explicitly and it will all seem routine and not at all scary to people like me. It already seems smart enough to do that given it could make the right suggestion in my case.

On February 10, 2023 4:30:49 AM EST, Andreas Enge <andreas@enge.fr> wrote:
>Hello Kyle,
>
>Am Fri, Feb 10, 2023 at 03:10:02AM +0000 schrieb Kyle Andrews:
>> configure: error: chosen localstatedir '/usr/local/var' does not match that of the existing installation '/var'
>
>you should do exactly as suggested: Before running "make", configure the
>Guix source code not by "./configure", but
>   ./configure --localstatedir=/var
>
>Personally I think this is a bug in Guix: It was chosen to follow the
>standard configure behaviour (installation directories under /usr/local).
>But it would probably be better to let the Guix behaviour be the one
>that everybody wants (especially newcomers), and to leave options like
>--localstatedir to people needing to do something unusual.
>
>Andreas
>

[-- Attachment #2: Type: text/html, Size: 2130 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-10 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10  3:10 Help adding a graph backend Kyle Andrews
2023-02-10  7:11 ` Julien Lepiller
2023-02-10  9:25 ` Attila Lendvai
2023-02-10  9:30 ` Andreas Enge
2023-02-10 19:03   ` Kyle

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).