aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/modules.scm6
-rw-r--r--tests/modules.scm10
2 files changed, 13 insertions, 3 deletions
diff --git a/guix/modules.scm b/guix/modules.scm
index 77e1c2b6f4..74400ffacc 100644
--- a/guix/modules.scm
+++ b/guix/modules.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016-2019, 2021-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016-2019, 2021-2022, 2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -104,7 +104,9 @@ depends on."
(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)))))
+ (match (string-tokenize (string-drop-right file 4) not-slash)
+ (("." . rest) rest) ;strip the leading "."
+ (lst lst))))))
(define (module-name->file-name module)
"Return the file name for MODULE."
diff --git a/tests/modules.scm b/tests/modules.scm
index e70d2d9e08..bb2c70e287 100644
--- a/tests/modules.scm
+++ b/tests/modules.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016-2017, 2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -65,4 +65,12 @@
(source-module-closure '((baz)) (list directory)
#:select? (const #t))))))
+(test-equal "file-name->module-name"
+ '(guix foo)
+ (file-name->module-name "guix/foo.scm"))
+
+(test-equal "file-name->module-name, leading dot"
+ '(guix foo)
+ (file-name->module-name "./guix/foo.scm"))
+
(test-end)
f='/guix/commit/gnu/packages/tor-browsers.scm?id=79163d2c3c50fb1a7fd3fb3e64a34e9a1d0e3083'>gnu: tor-browser: Build with newest rust-cbindgen....Efraim Flashner 2024-03-10Merge branch 'master' into gnome-teamLiliana Marie Prikler 2024-03-08gnu: torbrowser: Update to 13.0.11....Clément Lassieur 2024-02-25Merge branch 'master' into gnome-teamLiliana Marie Prikler 2024-02-21gnu: mullvadbrowser: Update to 13.0.10....Clément Lassieur 2024-02-21gnu: torbrowser: Update to 13.0.10....Clément Lassieur 2024-02-16gnu: icu4c-73: Move it from gnuzilla.scm to icu4c.scm....Ian Eure 2024-02-13Merge branch 'master' into gnome-teamLiliana Marie Prikler 2024-02-05gnu: Add mullvadbrowser....Clément Lassieur 2024-02-03gnu: tor-browsers: Use freedesktop module....Liliana Marie Prikler 2024-02-02gnu: torbrowser: Stop inheriting Icecat....Clément Lassieur