Cannot compute a file with a G-exp

  • Open
  • quality assurance status badge
Details
3 participants
  • Robby Zambito
  • (
  • Simon Tournier
Owner
unassigned
Submitted by
Robby Zambito
Severity
normal
R
R
Robby Zambito wrote on 16 Jun 2023 03:17
(address . bug-guix@gnu.org)
87v8fogpk8.fsf@robbyzambito.me
Hi,

I seem to be having two issues with writing a G-exp that computes a
file. The first issue I ran into is that source-module-closure returns
null no matter what modules I give it.

```
scheme@(guile-user)> (source-module-closure '((ice-9 popen) (ice-9 atomic) (ini) (json)))
$8 = ()
```

This seems to be a bug to me.

I found that I could get a partial list of dependencies using
source-module-dependencies, which seems to only include the direct
dependencies. So in my G-exp that I want to have depend on (ini), I used:

```
(with-imported-modules (source-module-dependencies '(ini)))
```

and then slowly worked on rebuilding over and over again, adding each
dependency as it was reported as missing.

Now that I have a seemingly correct (as far as the dependencies are
concerned) expression, I have run into another issue.

```
scheme@(guile-user)> ;; Assumes a file exists at wofi/style.css
scheme@(guile-user)> (define rz/terminal-emulator "foot")
scheme@(guile-user)> (import (guix gexp) (guix modules) (guix))
scheme@(guile-user)> ,build (computed-file "config" (with-imported-modules
(append (source-module-dependencies '(ini))
'((ini)
(scheme documentation)
(smc core common)
(smc context common)
(smc context u8)
(smc context char)
(smc core config)
(smc core log)
(logging logger)
(smc core state)
(smc core transition)
(smc context oop generic)
(smc context oop port)
(smc context oop char)
(smc context oop u8)
(smc fsm)
(smc core set)))
#~(begin
(import (ini))
(plain-file #$output
(with-output-to-string
(lambda ()
(scm->ini
'((#f
("stylesheet" . #$(local-file "wofi/style.css"))
("xoffset" . 0)
("yoffset" . 0)
("hide_scroll" . "true")
("show" . "drun")
("width" . "600px")
("lines" . 10)
("line_wrap" . "word")
("term" . #$rz/terminal-emulator)
("allow_markup" . "true")
("always_parse_args" . "true")
("show_all" . "true")
("print_command" . "true")
("layer" . "overlay")
("allow_images" . "true")
("insensitivity" . "true")
("prompt" . "Hey, you should type something!")
("image_size" . 25)
("display_generic" . "true")
("key_expand" . "Tab"))))))))))
warning: importing modules (ice-9 receive) (ice-9 pretty-print) (ice-9 textual-ports) from the host
building /gnu/store/icvbvnjdiykc7lsraz16j1hsydfg77ld-module-import-compiled.drv...
18% ?????????????????????????????????????????? ?While executing meta-command:
User interrupt
```
At this point, if I do not interrupt the process, it will eat up all of
my systems memory and crash. Building my config with this provides some
more information:

```
The following derivations will be built:
/gnu/store/a86dcbp4nckf40g7h7abw02viqn9aags-home.drv
/gnu/store/1mr2bjmbjwqd0qg4zbhpiajbqz8ljxvm-files.drv
/gnu/store/5rsbwalrkvd09gq554gc0dclc65vmyhj-wofi-config.drv
/gnu/store/icvbvnjdiykc7lsraz16j1hsydfg77ld-module-import-compiled.drv
/gnu/store/gn8jpf439qskxai3vyph8zv1p7ygsrsh-provenance.drv
building /gnu/store/gn8jpf439qskxai3vyph8zv1p7ygsrsh-provenance.drv...
successfully built /gnu/store/gn8jpf439qskxai3vyph8zv1p7ygsrsh-provenance.drv
building /gnu/store/icvbvnjdiykc7lsraz16j1hsydfg77ld-module-import-compiled.drv...
[ 1/50] Loading './ice-9/pretty-print.scm'...
[ 2/50] Loading './ice-9/receive.scm'...
[ 3/50] Loading './ice-9/textual-ports.scm'...
[ 4/50] Loading './ini/fsm-context-ini.scm'...
[ 5/50] Loading './ini/fsm-context.scm'...
[ 6/50] Loading './ini/fsm.scm'...
[ 7/50] Loading './ini.scm'...
[ 8/50] Loading './logging/logger.scm'...
[ 9/50] Loading './oop/goops.scm'...
interrupt
```

It hangs on importing `./oop/goops.scm`.

Regards,
Robby
(
(name . Robby Zambito)(address . contact@robbyzambito.me)
87legied23.fsf@disroot.org
Hi!

Robby Zambito <contact@robbyzambito.me> writes:
Toggle quote (3 lines)
> scheme@(guile-user)> (source-module-closure '((ice-9 popen) (ice-9 atomic) (ini) (json)))
> $8 = ()

SOURCE-MODULE-CLOSURE only works for modules provided by Guix or Guix
channels ;) Modules included in Guile don't need it at all, and for
modules provided by third-party Guile libraries like guile-ini or
guile-json, you need to use WITH-EXTENSIONS:

(use-modules (gnu packages guile-xyz))

(with-extensions (list guile-ini guile-json) GEXP)

Toggle quote (4 lines)
> I found that I could get a partial list of dependencies using
> source-module-dependencies, which seems to only include the direct
> dependencies. So in my G-exp that I want to have depend on (ini), I used:

No, it includes the entire dependency tree, but filters out any modules
that don't come from Guix or Guix channels.

Toggle quote (4 lines)
> At this point, if I do not interrupt the process, it will eat up all of
> my systems memory and crash. Building my config with this provides some
> more information:

I suspect this will be fixed if you follow what I've said above.

-- (
R
R
Robby Zambito wrote on 17 Jun 2023 16:05
(name . ()(address . paren@disroot.org)
87o7lexjq3.fsf@robbyzambito.me
Hello,

"(" <paren@disroot.org> writes:

Toggle quote (9 lines)
> SOURCE-MODULE-CLOSURE only works for modules provided by Guix or Guix
> channels ;) Modules included in Guile don't need it at all, and for
> modules provided by third-party Guile libraries like guile-ini or
> guile-json, you need to use WITH-EXTENSIONS:
>
> (use-modules (gnu packages guile-xyz))
>
> (with-extensions (list guile-ini guile-json) GEXP)

Well shucks, if only I read the next paragraph in the manual! Thank you
for pointing this out.

Toggle quote (3 lines)
> No, it includes the entire dependency tree, but filters out any modules
> that don't come from Guix or Guix channels.

Strangely with-extensions doesn't seem to be including the whole
dependency tree for me. Should it? Maybe this is an issue with the
definition of the guile-ini package, but I also had to specify guile-smc
and guile-lib as extensions, even though I am not using either of those
directly.

Thank you for you help though :) I was able to get my G-Exp working as I
want

Robby
(
(name . Robby Zambito)(address . contact@robbyzambito.me)
87edmadp72.fsf@disroot.org
Robby Zambito <contact@robbyzambito.me> writes:
Toggle quote (3 lines)
> Strangely with-extensions doesn't seem to be including the whole
> dependency tree for me. Should it?

No, I don't think it should. It *would* be possible to traverse the
package inputs and add all the GUILE-BUILD-SYSTEM-using packages, but
then you get the problem that not all Guile packages have their
dependencies specified in the INPUTS list (for some reason, IIRC, you
need the Guile dependencies to be in both INPUTS *and* NATIVE-INPUTS,
but some have them only in NATIVE-INPUTS).

The problem there is that if you have a dependency that's only in
NATIVE-INPUTS, it's difficult to tell if it's actually used by the
application or by, say, a build script.

-- (
S
S
Simon Tournier wrote on 10 Sep 17:01 +0200
(name . ()(address . paren@disroot.org)
87r09rd02s.fsf@gmail.com
Hi,

On Sat, 17 Jun 2023 at 17:27, "(" <paren@disroot.org> wrote:
Toggle quote (15 lines)
> Robby Zambito <contact@robbyzambito.me> writes:
>> Strangely with-extensions doesn't seem to be including the whole
>> dependency tree for me. Should it?
>
> No, I don't think it should. It *would* be possible to traverse the
> package inputs and add all the GUILE-BUILD-SYSTEM-using packages, but
> then you get the problem that not all Guile packages have their
> dependencies specified in the INPUTS list (for some reason, IIRC, you
> need the Guile dependencies to be in both INPUTS *and* NATIVE-INPUTS,
> but some have them only in NATIVE-INPUTS).
>
> The problem there is that if you have a dependency that's only in
> NATIVE-INPUTS, it's difficult to tell if it's actually used by the
> application or by, say, a build script.

Reading the thread and from my understanding, there is no bug. Closing?

Else, could you provide more information about the bug?

Cheers,
simon
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 64090@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64090
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch