Subject: bug#42735: closed (Re: [bug#42735] [PATCH] pre-inst-env: don't use GUIX_PACKAGE_PATH)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 14 Aug 2020 10:01:01 +0000

Your bug report

#42735: [PATCH] pre-inst-env: don't use GUIX_PACKAGE_PATH

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 [email-masked].

-- 
42735: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42735
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#42735] [PATCH] pre-inst-env: don't use GUIX_PACKAGE_PATH
From: Oleg Pykhalov <[email-masked]>
To: Denis 'GNUtoo' Carikli <[email-masked]>
Cc: [email-masked]
Date: Fri, 14 Aug 2020 13:00:16 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Denis 'GNUtoo' Carikli <[email-masked]> writes:

[…]

> Should a warning be emitted when packages come from GUIX_PACKAGE_PATH
> with ./pre-inst-env ?

I don't think a user needs another warning for an environment variable
which he setted by himself.  Also, user could use ‘-L’ flag instead of
‘GUIX_PACKAGE_PATH’.

Currently,

with ‘hello’ package in GUIX_PACKAGE_PATH:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~/src/guix-master$ GUIX_PACKAGE_PATH=/home/oleg/src/guix-wigust/guix ./pre-inst-env guix build --no-grafts --no-offload hello
guix build: warning: ambiguous package specification `hello'
guix build: warning: choosing [email-masked] from /home/oleg/src/guix-wigust/guix/wigust/packages/games.scm:174:2
/gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10
--8<---------------cut here---------------end--------------->8---

without ‘hello’ package in GUIX_PACKAGE_PATH:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~/src/guix-master$ GUIX_PACKAGE_PATH=/home/oleg/src/guix-wigust/guix ./pre-inst-env guix build --no-grafts --no-offload hello
/gnu/store/a462kby1q51ndvxdv3b6p0rsixxrgx1h-hello-2.10
--8<---------------cut here---------------end--------------->8---

> The issue is if it picks dependencies from GUIX_PACKAGE_PATH which are
> not in Guix source code yet. In that case it might be more complicated
> to make sure that people will see the warning as it might be hidden in
> the huge build log.
>
> Another option which can also be combined with the previous one would be
> to warn people in the manual.

It's already documented, isn't it?

https://www.gnu.org/software/guix/manual/html_node/Package-Modules.html
--8<---------------cut here---------------start------------->8---
 -- Environment Variable: GUIX_PACKAGE_PATH
     This is a colon-separated list of directories to search for
     additional package modules.  Directories listed in this variable
     take precedence over the own modules of the distribution.
--8<---------------cut here---------------end--------------->8---

I'll close the bug.  Feel free to reopen if I miss something.

Regards,
Oleg.

Subject: [PATCH] pre-inst-env: don't use GUIX_PACKAGE_PATH
From: Denis 'GNUtoo' Carikli <[email-masked]>
To: [email-masked]
Cc: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Fri, 7 Aug 2020 04:21:42 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

./pre-inst-env is supposed to use only the packages definitions that are in
the guix source tree and not the host packages.

However if GUIX_PACKAGE_PATH is set, it will use host packages as well.

In addition, when packages are defined in both the guix source tree and in
GUIX_PACKAGE_PATH, GUIX_PACKAGE_PATH will take the precedence and guix
will print warnings like that:
    guix build: warning: ambiguous package specification `libsamsung-ipc'
    guix build: warning: choosing [email-masked] from
                         /home/[...]/.config/guix/local/replicant.scm:31:2

That situation can happen when working in a new package in
GUIX_PACKAGE_PATH and then importing the package in the guix source tree to
add it upstream.

Signed-off-by: Denis 'GNUtoo' Carikli <[email-masked]>
---
 build-aux/pre-inst-env.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in
index e0aa7fe868..698a7994fb 100644
--- a/build-aux/pre-inst-env.in
+++ b/build-aux/pre-inst-env.in
@@ -59,4 +59,8 @@ export NIX_HASH
 GUIX_UNINSTALLED=1
 export GUIX_UNINSTALLED
 
+# Make sure we don't use local package definitions
+GUIX_PACKAGE_PATH=""
+export GUIX_PACKAGE_PATH
+
 exec "$@"
-- 
2.28.0