summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRobert Vollmert <rob@vllmrt.net>2019-05-25 08:40:38 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-26 23:02:02 +0200
commit002d17dcaacba0f86265b34f2509419d9e21224d (patch)
tree3b436b8af5354197965f34565f6156ae874c7c20 /tests
parentdfc69e4b6d4bbc41a4d37b3cc6ea12adb34aaafa (diff)
downloadguix-002d17dcaacba0f86265b34f2509419d9e21224d.tar.gz
discovery: 'all-modules' returns modules in path order.
A particular effect of this is that if there are ambiguous
packages in a directory specified with `-L module_dir` and the
distribution, the version from `module_dir` will be loaded,
which is usually what would be expected. (E.g. for `guix build`
or `guix package -i`.)

* guix/discovery.scm (all-modules): Return modules in path order.
* tests/guix-package.sh: Test local definitions take precedence.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-package.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 767c3f8a66..79d6ec65e4 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -280,6 +280,20 @@ export GUIX_PACKAGE_PATH
 guix package -A emacs-foo-bar | grep 42
 guix package -i emacs-foo-bar@42 -n
 
+# Make sure GUIX_PACKAGE_PATH/'-L' takes precedence in case of duplicate packages.
+cat > "$module_dir/bar.scm"<<EOF
+(define-module (bar)
+  #:use-module (guix packages))
+
+(define-public hello
+  (package (inherit (@@ (gnu packages base) hello))
+    (synopsis "an overridden version of GNU hello")))
+EOF
+
+guix package -i hello -n 2>&1 | grep choosing.*bar.scm
+( unset GUIX_PACKAGE_PATH; \
+  guix package -i hello -n -L "$module_dir" 2>&1 | grep choosing.*bar.scm )
+
 # Make sure patches that live under $GUIX_PACKAGE_PATH are found.
 cat > "$module_dir/emacs.patch"<<EOF
 This is a fake patch.