(address . bug-guix@gnu.org)
Hi,
I'm having an issue with the JSON importer. The following example
attempts to illustrate the problem:
Toggle quote (18 lines)
> $ cd $(mktemp -d) # -> /tmp/tmp.J3f9qsyDIL
> /tmp/tmp.J3f9qsyDIL$ cat myhello.json
> {
> "name": "myhello",
> "version": "2.10",
> "source": "mirror://gnu/hello/hello-2.10.tar.gz",
> "build-system": "gnu",
> "license": "GPL-3.0+",
> "native-inputs": ["gettext", "myotherhello"]
> }
> /tmp/tmp.J3f9qsyDIL$ cat non-gnu.scm
> (define-module (non-gnu)
> #:use-module (gnu packages base)
> #:use-module (guix packages))
>
> (define-public myotherhello
> (package (inherit hello) (name "myotherhello")))
As expected, both `hello` and `myotherhello` are found by `guix search
-L /tmp/tmp.J3f9qsyDIL hello`:
Toggle quote (8 lines)
> name: hello
> ...
> location: gnu/packages/base.scm:86:2
> ...
> name: myotherhello
> ...
> location: /tmp/tmp.J3f9qsyDIL/non-gnu.scm:6:2
But importing `myhello` fails:
Toggle quote (37 lines)
> /tmp/tmp.J3f9qsyDIL$ export GUIX_PACKAGE_PATH=/tmp/tmp.J3f9qsyDIL/
> /tmp/tmp.J3f9qsyDIL$ guix import json myhello.json
>
> Starting download of /tmp/guix-file.bQ5VSS
> From https://ftpmirror.gnu.org/gnu/hello/hello-2.10.tar.gz...
> following redirection to `https://gnu.askapache.com/hello/hello-2.10.tar.gz'...
> …10.tar.gz 709KiB 671KiB/s 00:01 [##################] 100.0%
> Backtrace:
> 14 (primitive-load "/home/itd/.config/guix/current/bin/…")
> In guix/ui.scm:
> 2263:7 13 (run-guix . _)
> 2226:10 12 (run-guix-command _ . _)
> In guix/scripts/import.scm:
> 92:11 11 (guix-import . _)
> In ice-9/boot-9.scm:
> 1747:15 10 (with-exception-handler #<procedure 7efce407acf0 at ic…> …)
> In guix/scripts/import/json.scm:
> 91:16 9 (_)
> In ice-9/boot-9.scm:
> 1747:15 8 (with-exception-handler #<procedure 7efce407acc0 at ic…> …)
> In guix/import/json.scm:
> 86:18 7 (_)
> In guix/import/print.scm:
> 220:37 6 (package->code _)
> 161:17 5 (inputs->code (("gettext" #<package gettext@0.21 g…>) #))
> In srfi/srfi-1.scm:
> 586:29 4 (map1 (("gettext" #<package gettext@0.21 gnu/packa…>) #))
> 586:17 3 (map1 (("myotherhello" #<package myotherhello@2.12.1…>)))
> In guix/import/print.scm:
> 164:40 2 (_ _)
> 60:31 1 (variable-name _ (#{}# tmp tmp.J3f9qsyDIL non-gnu))
> In ice-9/boot-9.scm:
> 3330:6 0 (resolve-interface (#{}# tmp tmp.J3f9qsyDIL non-gnu) # _ …)
>
> ice-9/boot-9.scm:3330:6: In procedure resolve-interface:
> no code for module (#{}# tmp tmp.J3f9qsyDIL non-gnu)
One can influence the name of the mentioned module via
GUIX_PACKAGE_PATH, e.g.:
Toggle quote (6 lines)
> /tmp/tmp.J3f9qsyDIL$ export GUIX_PACKAGE_PATH=.
> /tmp/tmp.J3f9qsyDIL$ guix import json myhello.json
> ...
> ice-9/boot-9.scm:3330:6: In procedure resolve-interface:
> no code for module (#{.}# non-gnu)
But the issue remains.
Suspected cause: the value of GUIX_PACKAGE_PATH is considered part of
the module name but shouldn't. This results in an unexpected module
name / missing module. Idea: when constructing the module name from the
file name, this prefix should be removed.
Regards
itd