GNU bug report logs - #35905
[PATCH] find-package-by-name: reverse package load precedence

Previous Next

Package: guix-patches;

Reported by: Robert Vollmert <rob <at> vllmrt.net>

Date: Sat, 25 May 2019 19:18:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35905 in the body.
You can then email your comments to 35905 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#35905; Package guix-patches. (Sat, 25 May 2019 19:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Vollmert <rob <at> vllmrt.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 25 May 2019 19:18:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Vollmert <rob <at> vllmrt.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] find-package-by-name: reverse package load precedence
Date: Sat, 25 May 2019 21:16:34 +0200
From e484a11fa652c6e9cb4484c6f700b91f134e7156 Mon Sep 17 00:00:00 2001
From: Robert Vollmert <rob <at> vllmrt.net>
Date: Sat, 25 May 2019 08:40:38 +0200
Subject: [PATCH] guix: find-package-by-name: list 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.
---
 guix/discovery.scm    |  4 ++--
 tests/guix-package.sh | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/guix/discovery.scm b/guix/discovery.scm
index ef5ae73973..5bb494941b 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -145,8 +145,8 @@ Call (PROC MODULE RESULT) for each module that is found."
   "Return the list of package modules found in PATH, a list of directories to
 search.  Entries in PATH can be directory names (strings) or (DIRECTORY
 . SUB-DIRECTORY) pairs, in which case modules are searched for beneath
-SUB-DIRECTORY."
-  (fold-modules cons '() path #:warn warn))
+SUB-DIRECTORY. Modules are listed in the order they appear on the path."
+  (reverse (fold-modules cons '() path #:warn warn)))
 
 (define (fold-module-public-variables* proc init modules)
   "Call (PROC MODULE SYMBOL VARIABLE) for each variable exported by one of MODULES,
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 <at> 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.
-- 
2.21.0






Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 26 May 2019 21:05:02 GMT) Full text and rfc822 format available.

Notification sent to Robert Vollmert <rob <at> vllmrt.net>:
bug acknowledged by developer. (Sun, 26 May 2019 21:05:02 GMT) Full text and rfc822 format available.

Message #10 received at 35905-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Robert Vollmert <rob <at> vllmrt.net>
Cc: 35905-done <at> debbugs.gnu.org
Subject: Re: [bug#35905] [PATCH] find-package-by-name: reverse package load
 precedence
Date: Sun, 26 May 2019 23:04:05 +0200
Hi Robert,

Robert Vollmert <rob <at> vllmrt.net> skribis:

> From e484a11fa652c6e9cb4484c6f700b91f134e7156 Mon Sep 17 00:00:00 2001
> From: Robert Vollmert <rob <at> vllmrt.net>
> Date: Sat, 25 May 2019 08:40:38 +0200
> Subject: [PATCH] guix: find-package-by-name: list 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.

Good catch, applied!  (I adjusted the summary line so that it mentions
“discovery”.)

Likewise, in case more than one packages match a given spec, packages of
third-party channels would take precedence over those coming from the
‘guix’ channel, contrary to what was intended.

Thanks for fixing it!

Ludo’.






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.