From unknown Sat Aug 16 11:33:14 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35905] [PATCH] find-package-by-name: reverse package load precedence Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 May 2019 19:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35905 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35905@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155881183331315 (code B ref -1); Sat, 25 May 2019 19:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 May 2019 19:17:13 +0000 Received: from localhost ([127.0.0.1]:49660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUcAK-000891-Nv for submit@debbugs.gnu.org; Sat, 25 May 2019 15:17:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUcAH-00088n-Mt for submit@debbugs.gnu.org; Sat, 25 May 2019 15:17:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:49273) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hUcAB-0007pq-QU for submit@debbugs.gnu.org; Sat, 25 May 2019 15:17:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUcA8-0002vB-SW for guix-patches@gnu.org; Sat, 25 May 2019 15:17:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUcA6-0007iB-Tl for guix-patches@gnu.org; Sat, 25 May 2019 15:17:00 -0400 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]:24264) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hUcA5-0007XG-42 for guix-patches@gnu.org; Sat, 25 May 2019 15:16:58 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id E1A364FF6D for ; Sat, 25 May 2019 21:16:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id xvNc7L_6V_Ae for ; Sat, 25 May 2019 21:16:35 +0200 (CEST) From: Robert Vollmert Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Message-Id: Date: Sat, 25 May 2019 21:16:34 +0200 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:67c:2050:104:0:1:25:1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.6 (-) 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.6 (--) =46rom e484a11fa652c6e9cb4484c6f700b91f134e7156 Mon Sep 17 00:00:00 2001 From: Robert Vollmert 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))) =20 (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@42 -n =20 +# Make sure GUIX_PACKAGE_PATH/'-L' takes precedence in case of = duplicate packages. +cat > "$module_dir/bar.scm"<&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"< Subject: bug#35905: closed (Re: [bug#35905] [PATCH] find-package-by-name: reverse package load precedence) Message-ID: References: <87y32tj5bu.fsf@gnu.org> X-Gnu-PR-Message: they-closed 35905 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 35905@debbugs.gnu.org Date: Sun, 26 May 2019 21:05:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1558904702-20653-1" This is a multi-part message in MIME format... ------------=_1558904702-20653-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #35905: [PATCH] find-package-by-name: reverse package load precedence which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 35905@debbugs.gnu.org. --=20 35905: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D35905 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1558904702-20653-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 35905-done) by debbugs.gnu.org; 26 May 2019 21:04:20 +0000 Received: from localhost ([127.0.0.1]:51921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hV0JY-0005M0-4A for submit@debbugs.gnu.org; Sun, 26 May 2019 17:04:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39463) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hV0JV-0005Ln-UN for 35905-done@debbugs.gnu.org; Sun, 26 May 2019 17:04:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hV0JP-0001jj-PK; Sun, 26 May 2019 17:04:11 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=49594 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hV0JL-0003c3-Or; Sun, 26 May 2019 17:04:08 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Robert Vollmert Subject: Re: [bug#35905] [PATCH] find-package-by-name: reverse package load precedence References: Date: Sun, 26 May 2019 23:04:05 +0200 In-Reply-To: (Robert Vollmert's message of "Sat, 25 May 2019 21:16:34 +0200") Message-ID: <87y32tj5bu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 35905-done Cc: 35905-done@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 Robert, Robert Vollmert skribis: > From e484a11fa652c6e9cb4484c6f700b91f134e7156 Mon Sep 17 00:00:00 2001 > From: Robert Vollmert > 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 =E2=80=9Cdiscovery=E2=80=9D.) Likewise, in case more than one packages match a given spec, packages of third-party channels would take precedence over those coming from the =E2=80=98guix=E2=80=99 channel, contrary to what was intended. Thanks for fixing it! Ludo=E2=80=99. ------------=_1558904702-20653-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 May 2019 19:17:13 +0000 Received: from localhost ([127.0.0.1]:49660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUcAK-000891-Nv for submit@debbugs.gnu.org; Sat, 25 May 2019 15:17:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUcAH-00088n-Mt for submit@debbugs.gnu.org; Sat, 25 May 2019 15:17:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:49273) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hUcAB-0007pq-QU for submit@debbugs.gnu.org; Sat, 25 May 2019 15:17:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUcA8-0002vB-SW for guix-patches@gnu.org; Sat, 25 May 2019 15:17:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUcA6-0007iB-Tl for guix-patches@gnu.org; Sat, 25 May 2019 15:17:00 -0400 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]:24264) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hUcA5-0007XG-42 for guix-patches@gnu.org; Sat, 25 May 2019 15:16:58 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id E1A364FF6D for ; Sat, 25 May 2019 21:16:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id xvNc7L_6V_Ae for ; Sat, 25 May 2019 21:16:35 +0200 (CEST) From: Robert Vollmert Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: [PATCH] find-package-by-name: reverse package load precedence Message-Id: Date: Sat, 25 May 2019 21:16:34 +0200 To: guix-patches@gnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:67c:2050:104:0:1:25:1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.6 (-) 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.6 (--) =46rom e484a11fa652c6e9cb4484c6f700b91f134e7156 Mon Sep 17 00:00:00 2001 From: Robert Vollmert 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))) =20 (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@42 -n =20 +# Make sure GUIX_PACKAGE_PATH/'-L' takes precedence in case of = duplicate packages. +cat > "$module_dir/bar.scm"<&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"<