From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 02 10:26:59 2022 Received: (at submit) by debbugs.gnu.org; 2 Oct 2022 14:26:59 +0000 Received: from localhost ([127.0.0.1]:47757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oezvm-0001oR-27 for submit@debbugs.gnu.org; Sun, 02 Oct 2022 10:26:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:43704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oezvk-0001oH-A4 for submit@debbugs.gnu.org; Sun, 02 Oct 2022 10:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oezvk-00014S-2L for bug-guix@gnu.org; Sun, 02 Oct 2022 10:26:56 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:33399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oezvh-0006Bx-Ur for bug-guix@gnu.org; Sun, 02 Oct 2022 10:26:55 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id E383910038C for ; Sun, 2 Oct 2022 16:26:40 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id D516A1A8; Sun, 2 Oct 2022 16:26:40 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id DBE001A1 for ; Sun, 2 Oct 2022 16:26:38 +0200 (CEST) Received: from mail.net.in.tum.de (mail.net.in.tum.de [IPv6:2001:4ca0:2001:14:216:3eff:fe52:ed14]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id DA611CD for ; Sun, 2 Oct 2022 16:26:38 +0200 (CEST) Received: from amnesix.net.in.tum.de (amnesix.net.in.tum.de [131.159.20.238]) by mail.net.in.tum.de (Postfix) with ESMTP id B90FC28D0804; Sun, 2 Oct 2022 16:26:38 +0200 (CEST) From: itd To: bug-guix@gnu.org Subject: guix import json: GUIX_PACKAGE_PATH -- no code for module Date: Sun, 02 Oct 2022 16:26:37 +0200 Message-ID: <871qrqfgiq.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.159.0.8; envelope-from=itd@net.in.tum.de; helo=mailout3.rbg.tum.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hi, I'm having an issue with the JSON importer. The following example attempts to illustrate the problem: > $ 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`: > name: hello > ... > location: gnu/packages/base.scm:86:2 > ... > name: myotherhello > ... > location: /tmp/tmp.J3f9qsyDIL/non-gnu.scm:6:2 But importing `myhello` fails: > /tmp/tmp.J3f9qsyDIL$ export GUIX_PACKAGE_PATH=3D/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'... > =E2=80=A610.tar.gz 709KiB 671KiB/s 00:01 [##############= ####] 100.0% > Backtrace: > 14 (primitive-load "/home/itd/.config/guix/current/bin/=E2=80= =A6") > 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 # =E2=80=A6) > In guix/scripts/import/json.scm: > 91:16 9 (_) > In ice-9/boot-9.scm: > 1747:15 8 (with-exception-handler # =E2=80=A6) > In guix/import/json.scm: > 86:18 7 (_) > In guix/import/print.scm: > 220:37 6 (package->code _) > 161:17 5 (inputs->code (("gettext" #= ) #)) > In srfi/srfi-1.scm: > 586:29 4 (map1 (("gettext" #= ) #)) > 586:17 3 (map1 (("myotherhello" #))) > 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) # _ =E2= =80=A6) > > 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.: > /tmp/tmp.J3f9qsyDIL$ export GUIX_PACKAGE_PATH=3D. > /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 From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 02 10:35:47 2022 Received: (at 58250) by debbugs.gnu.org; 2 Oct 2022 14:35:47 +0000 Received: from localhost ([127.0.0.1]:47787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1of04J-00024k-HT for submit@debbugs.gnu.org; Sun, 02 Oct 2022 10:35:47 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:50963) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1of04G-00024T-82 for 58250@debbugs.gnu.org; Sun, 02 Oct 2022 10:35:45 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id 9ACF6100129 for <58250@debbugs.gnu.org>; Sun, 2 Oct 2022 16:35:37 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 978E11A8; Sun, 2 Oct 2022 16:35:37 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 0F92F1A1 for <58250@debbugs.gnu.org>; Sun, 2 Oct 2022 16:35:35 +0200 (CEST) Received: from mail.net.in.tum.de (mail.net.in.tum.de [IPv6:2001:4ca0:2001:14:216:3eff:fe52:ed14]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 0E332CD for <58250@debbugs.gnu.org>; Sun, 2 Oct 2022 16:35:35 +0200 (CEST) Received: from amnesix.net.in.tum.de (amnesix.net.in.tum.de [IPv6:2001:4ca0:2001:11:e2d5:5eff:fea9:55ca]) by mail.net.in.tum.de (Postfix) with ESMTP id E30A328D0804; Sun, 2 Oct 2022 16:35:34 +0200 (CEST) From: itd To: 58250@debbugs.gnu.org Subject: [PATCH 1/2] modules: Remove load path prefix from module name. In-Reply-To: References: <871qrqfgiq.fsf@localhost> Date: Sun, 02 Oct 2022 16:35:33 +0200 Message-ID: <87y1tye1je.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58250 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/modules.scm (file-name->module-name): Ignore load path prefix when building module name. --- It was mentioned on IRC, that (guix modules)'s file-name->module-name might be function to be used by the JSON importer (and fixed if needed). This patch attempts to implement the idea from the bug report. guix/modules.scm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/guix/modules.scm b/guix/modules.scm index 61bc8e1978..269d52ae1e 100644 --- a/guix/modules.scm +++ b/guix/modules.scm @@ -100,11 +100,23 @@ (define module-file-dependencies '())))))) (define file-name->module-name - (let ((not-slash (char-set-complement (char-set #\/)))) + (let ((not-slash (char-set-complement (char-set #\/))) + (load-path-prefix-length + (lambda (file) + ;; Length of the longest prefix among all given load paths. + (apply max (map + (lambda (path) (if (string-prefix? path file) + (string-length path) + 0)) + %load-path))))) (lambda (file) "Return the module name (a list of symbols) corresponding to FILE." (map string->symbol - (string-tokenize (string-drop-right file 4) not-slash))))) + (string-tokenize + (string-drop + (string-drop-right file 4) + (load-path-prefix-length file)) + not-slash))))) (define (module-name->file-name module) "Return the file name for MODULE." base-commit: ae221813745783ef1b7eee47561a2208cd5ad512 -- 2.37.3 From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 02 10:38:17 2022 Received: (at 58250) by debbugs.gnu.org; 2 Oct 2022 14:38:17 +0000 Received: from localhost ([127.0.0.1]:47795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1of06j-00028r-D6 for submit@debbugs.gnu.org; Sun, 02 Oct 2022 10:38:17 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:57359) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1of06i-00028f-0E for 58250@debbugs.gnu.org; Sun, 02 Oct 2022 10:38:16 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id 9E9F9100129 for <58250@debbugs.gnu.org>; Sun, 2 Oct 2022 16:38:10 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 9BD181A8; Sun, 2 Oct 2022 16:38:10 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 628D41A1 for <58250@debbugs.gnu.org>; Sun, 2 Oct 2022 16:38:10 +0200 (CEST) Received: from mail.net.in.tum.de (mail.net.in.tum.de [IPv6:2001:4ca0:2001:14:216:3eff:fe52:ed14]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 60F66CD for <58250@debbugs.gnu.org>; Sun, 2 Oct 2022 16:38:10 +0200 (CEST) Received: from amnesix.net.in.tum.de (amnesix.net.in.tum.de [131.159.20.238]) by mail.net.in.tum.de (Postfix) with ESMTP id 488B828D0804; Sun, 2 Oct 2022 16:38:10 +0200 (CEST) From: itd To: 58250@debbugs.gnu.org Subject: [PATCH 2/2] import: print: Use file-name->module-name. In-Reply-To: References: <871qrqfgiq.fsf@localhost> Date: Sun, 02 Oct 2022 16:38:09 +0200 Message-ID: <87v8p2e1f2.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58250 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/import/print.scm (package->code)[package-module-name]: Use file-name->module-name to build the package module name. --- This patch updates the JSON importer to use (guix modules)'s file-name->module-name to determine the module name. guix/import/print.scm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/guix/import/print.scm b/guix/import/print.scm index 2f54adbd8c..04e6b0a7b1 100644 --- a/guix/import/print.scm +++ b/guix/import/print.scm @@ -21,6 +21,7 @@ (define-module (guix import print) #:use-module (guix base32) #:use-module (guix utils) #:use-module (guix licenses) + #:use-module (guix modules) #:use-module (guix packages) #:use-module (guix search-paths) #:use-module (guix build-system) @@ -45,10 +46,7 @@ (define (package->code package) when evaluated." ;; The module in which the package PKG is defined (define (package-module-name pkg) - (map string->symbol - (string-split (string-drop-right - (location-file (package-location pkg)) 4) - #\/))) + (file-name->module-name (location-file (package-location pkg)))) ;; Return the first candidate variable name that is bound to VAL. (define (variable-name val mod) -- 2.37.3 From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 08:49:52 2022 Received: (at 58250) by debbugs.gnu.org; 23 Dec 2022 13:49:52 +0000 Received: from localhost ([127.0.0.1]:37115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8iQq-0004oT-76 for submit@debbugs.gnu.org; Fri, 23 Dec 2022 08:49:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8iQo-0004oN-1p for 58250@debbugs.gnu.org; Fri, 23 Dec 2022 08:49:50 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8iQg-0002ah-UX; Fri, 23 Dec 2022 08:49:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=io4BpLHbF9ZnzGrsleBfqAuBuyGemeuSc5h7CxYMzlg=; b=JRKsFH8Z2WlKXAsouV2G uLgSpHnBhso5N5m30znjqPJ4L/y4/jyGicw2KRUeurr8H9ptkUa+JVYqnLIHHj8bOQ19oTfsCbSU1 65zixgSD3lf18+07aWhCVvAazQTzpnE2Kt8G4iBmnjLNY4COkmKqym8YVpPK8wnZVQN570L1GCg8Y tIWjDoJOJsqhhKQUJEqZ2aMRMOlHnRTY6e7jsjYJCoTmQyZHpeWZz4GsuyLTcl4lYxAPAf1dffSDU 1hKvoWGuhXp9yxeohNjwHS4kt+6jM2Ij83TfWUZ/hWxp3RXyfYxx4hwANBB5HNo429sxOIkOX84Qy Bxej5quZzOBptg==; Received: from [193.50.110.60] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8iQg-0003hP-9J; Fri, 23 Dec 2022 08:49:42 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: itd Subject: Re: bug#58250: guix import json: GUIX_PACKAGE_PATH -- no code for module References: <871qrqfgiq.fsf@localhost> <87y1tye1je.fsf@localhost> Date: Fri, 23 Dec 2022 14:49:40 +0100 In-Reply-To: <87y1tye1je.fsf@localhost> (itd@net.in.tum.de's message of "Sun, 02 Oct 2022 16:35:33 +0200") Message-ID: <87r0wqz0uj.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58250 Cc: 58250@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, itd skribis: > * guix/modules.scm (file-name->module-name): Ignore load path prefix > when building module name. > --- > It was mentioned on IRC, that (guix modules)'s file-name->module-name > might be function to be used by the JSON importer (and fixed if needed). > This patch attempts to implement the idea from the bug report. At first sight I believe the fix should be in =E2=80=98package->code=E2=80= =99, not in (guix modules). (guix modules) is quite sensitive so in general we should refrain from changing the semantics of its procedures. In this case, =E2=80=98file-name->module-name=E2=80=99 expects a file name relative to a = search path entry. HTH, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 23 08:51:05 2022 Received: (at 58250) by debbugs.gnu.org; 23 Dec 2022 13:51:05 +0000 Received: from localhost ([127.0.0.1]:37120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8iS0-0004pu-LB for submit@debbugs.gnu.org; Fri, 23 Dec 2022 08:51:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8iRz-0004pU-E2 for 58250@debbugs.gnu.org; Fri, 23 Dec 2022 08:51:03 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8iRu-0002tQ-7g; Fri, 23 Dec 2022 08:50:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=BOt+Wmwy2ZvV10idH6roZJK1lS0fU1FEr29skgQn7fU=; b=aAnOJnWmr8bAmv6wjL4E 31r8MqygfFgmb9Qnp+6bC4cBTiuEzj2ZIgm8HNwLOOzrx7phIcTxt2psztRL68zjNoV9jx7fHSADx IurkCjsMY6cUr2jqvlLM21AO5fp3HtsiHif33u5fdpYKyH/AKxwHjxbj4Gd2MmWW5NC+uCfd6uasf dyQ125NPe3ZrnAmClcAxKc0wsfNxLsHFa/L6Fq5TlEOO3WduB3Up9wZ+UjmSbRwGT/arKX7xAmhSI 04llK1o5fIyFMXToUYrD+4zqYOap19Sk5nXGnFK13PqAFYQ2bRltuUITqZL+zGgFR43VvdXflOnXk xwMmbXZKYm/78A==; Received: from [193.50.110.60] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8iRk-0003s1-11; Fri, 23 Dec 2022 08:50:57 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: itd Subject: Re: bug#58250: guix import json: GUIX_PACKAGE_PATH -- no code for module References: <871qrqfgiq.fsf@localhost> <87v8p2e1f2.fsf@localhost> Date: Fri, 23 Dec 2022 14:50:46 +0100 In-Reply-To: <87v8p2e1f2.fsf@localhost> (itd@net.in.tum.de's message of "Sun, 02 Oct 2022 16:38:09 +0200") Message-ID: <87mt7ez0sp.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58250 Cc: 58250@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) itd skribis: > * guix/import/print.scm (package->code)[package-module-name]: Use > file-name->module-name to build the package module name. > --- > This patch updates the JSON importer to use (guix modules)'s > file-name->module-name to determine the module name. > > guix/import/print.scm | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/guix/import/print.scm b/guix/import/print.scm > index 2f54adbd8c..04e6b0a7b1 100644 > --- a/guix/import/print.scm > +++ b/guix/import/print.scm > @@ -21,6 +21,7 @@ (define-module (guix import print) > #:use-module (guix base32) > #:use-module (guix utils) > #:use-module (guix licenses) > + #:use-module (guix modules) > #:use-module (guix packages) > #:use-module (guix search-paths) > #:use-module (guix build-system) > @@ -45,10 +46,7 @@ (define (package->code package) > when evaluated." > ;; The module in which the package PKG is defined > (define (package-module-name pkg) > - (map string->symbol > - (string-split (string-drop-right > - (location-file (package-location pkg)) 4) > - #\/))) > + (file-name->module-name (location-file (package-location pkg)))) LGTM! Ludo'.