unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* GUIX_PACKAGE_PATH doesn't have priority over official guix packages
@ 2021-10-16  8:45 Tim Lee
  2021-10-16 21:03 ` Phil Beadling
  0 siblings, 1 reply; 9+ messages in thread
From: Tim Lee @ 2021-10-16  8:45 UTC (permalink / raw)
  To: help-guix

I have my own channel in a Git repository on my local computer.
This is what I do to search and install packages from my own channel:

$ cd /path/to/my-channel/
$ GUIX_PACKAGE_PATH=. guix search 'mypackage'
$ GUIX_PACKAGE_PATH=. guix install 'mypackage'

However, if there is a package with the same name in both my channel and
in the official guix channel, 'guix install' will install from the
official guix channel instead of my channel. Is this supposed to happen?
I thought that GUIX_PACKAGE_PATH is supposed to have priority over
the official guix channel?

I am currently working around this problem by specifying the version
number when installing. For example:

$ GUIX_PACKAGE_PATH=. guix install 'mypackage@1.2.3'


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-16  8:45 GUIX_PACKAGE_PATH doesn't have priority over official guix packages Tim Lee
@ 2021-10-16 21:03 ` Phil Beadling
  2021-10-16 22:29   ` Tim Lee
  2021-10-18 13:48   ` Paul Jewell
  0 siblings, 2 replies; 9+ messages in thread
From: Phil Beadling @ 2021-10-16 21:03 UTC (permalink / raw)
  To: help-guix

As far as I can see, Guix will always prefer the highest version number
irrspective of which channel is sources it from.

If you want another version you can use the '@' format as you have already
worked out.

Another way is to define the package is to keep the 'name' of the original,
but the definition returns a different Scheme variable name.  Using this
method you can even have multiple packages all pointing to the same version
of the source.

This can then be specified in most Guix commands using the "-e" switch with
a direct expression in Scheme like so:

guix environment --ad-hoc python -e '(@@ (my-package my-module)
python-pandas-special)'

(define-public python-pandas-special
  (package
    (inherit python-pandas)
    (version "1.1.2")

To avoid your command line getting overly complicated you can store your
package requirements in a manifest which allows for similar specification.

It can also be specified as a dependency in your own packages like this:
("python-pandas" ,python-pandas-special)

HTH,
Phil.

On Sat, 16 Oct 2021 at 09:46, Tim Lee <progscriptclone@gmail.com> wrote:

> I have my own channel in a Git repository on my local computer.
> This is what I do to search and install packages from my own channel:
>
> $ cd /path/to/my-channel/
> $ GUIX_PACKAGE_PATH=. guix search 'mypackage'
> $ GUIX_PACKAGE_PATH=. guix install 'mypackage'
>
> However, if there is a package with the same name in both my channel and
> in the official guix channel, 'guix install' will install from the
> official guix channel instead of my channel. Is this supposed to happen?
> I thought that GUIX_PACKAGE_PATH is supposed to have priority over
> the official guix channel?
>
> I am currently working around this problem by specifying the version
> number when installing. For example:
>
> $ GUIX_PACKAGE_PATH=. guix install 'mypackage@1.2.3'
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-16 21:03 ` Phil Beadling
@ 2021-10-16 22:29   ` Tim Lee
  2021-10-17  8:10     ` Phil
  2021-10-17 11:36     ` Tobias Geerinckx-Rice
  2021-10-18 13:48   ` Paul Jewell
  1 sibling, 2 replies; 9+ messages in thread
From: Tim Lee @ 2021-10-16 22:29 UTC (permalink / raw)
  To: phil; +Cc: help-guix

> As far as I can see, Guix will always prefer the highest version
> number irrspective of which channel is sources it from.

I guess I misread the documentation or was misled by it.
https://guix.gnu.org/manual/en/html_node/Package-Modules.html

> 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.

The last sentence makes it sound like GUIX_PACKAGE_PATH will always have
precedence over the official guix channel.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-16 22:29   ` Tim Lee
@ 2021-10-17  8:10     ` Phil
  2021-10-17 11:36     ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 9+ messages in thread
From: Phil @ 2021-10-17  8:10 UTC (permalink / raw)
  To: Tim Lee; +Cc: help-guix


Tim Lee writes:

>> 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.
>
> The last sentence makes it sound like GUIX_PACKAGE_PATH will always have
> precedence over the official guix channel.

I think the doc should specify "all else being equal" - my own trail and
error testing seem to suggest that when versions are equal, Guix will then prefer the
package specified by "-L" or "GUIX_PACKAGE_PATH" - however a higher version seems to always win, wherever it is specified.

2 Caveats -

This is just by observation only, perhaps someone else can
comment if this is intended or not.

I used time-machine to test this but I don't think that
should change things.  I was able to move backwards and forwards in time
vs a local package I have specified.  My local package was taken when I
moved backwards in time, but when I moved forwards to a newer version in
Guix it took the remote package instead.  When the package was the same
as remote it took the version with a local location - as far as I can
tell.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-16 22:29   ` Tim Lee
  2021-10-17  8:10     ` Phil
@ 2021-10-17 11:36     ` Tobias Geerinckx-Rice
  2021-10-17 12:15       ` Phil
  1 sibling, 1 reply; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-10-17 11:36 UTC (permalink / raw)
  To: Tim Lee; +Cc: phil, help-guix

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

Tim Lee 写道:
>> 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.
>
> The last sentence makes it sound like GUIX_PACKAGE_PATH will 
> always have
> precedence over the official guix channel.

TBH I don't really understand what that second sentence is trying 
to say, so I can't judge whether it's misleading or not.

How about something like

  “Any packages they define will be added to the pool of available 
  packages.  Standard package specification rules apply: when 
  given a package name without an unambiguous version number, Guix 
  will always pick the highest version of that package regardless 
  of where it came from.”

?

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-17 11:36     ` Tobias Geerinckx-Rice
@ 2021-10-17 12:15       ` Phil
  2021-10-17 12:31         ` Tobias Geerinckx-Rice
  2021-10-17 13:56         ` Tim Lee
  0 siblings, 2 replies; 9+ messages in thread
From: Phil @ 2021-10-17 12:15 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: Tim Lee, help-guix


Tobias Geerinckx-Rice writes:

>  “Any packages they define will be added to the pool of available
>  packages.  Standard package specification rules apply: when 
>  given a package name without an unambiguous version number, Guix
>  will always pick the highest version of that package regardless 
>  of where it came from.”

Makes sense to me - only thing I'd add, assuming my analysis is right,
I'd highlight that when 2 packages exist with identical verison number,
and one package is specified as local (via -L or GUIX_PACKAGE_PATH),
that local version is preferred over a git-hosted channel.

This has consequences if you want to alter a package locally. Although
I'd recommend defining the package to have a different variable name and
refer to it using "-e" to make intentions explicit in any command/manifest.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-17 12:15       ` Phil
@ 2021-10-17 12:31         ` Tobias Geerinckx-Rice
  2021-10-17 13:56         ` Tim Lee
  1 sibling, 0 replies; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-10-17 12:31 UTC (permalink / raw)
  To: Phil; +Cc: Tim Lee, help-guix

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

Phil,

Right, I meant to add this but forgot:

  “In the event of a tie, packages from GUIX_PACKAGE_PATH will 
  take precedence.”

Thanks for bringing up ‘-L’.  We should explicitly state which of 
‘-L’ and GUIX_PACKAGE_PATH wins, if someone's willing to test 
that.

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-17 12:15       ` Phil
  2021-10-17 12:31         ` Tobias Geerinckx-Rice
@ 2021-10-17 13:56         ` Tim Lee
  1 sibling, 0 replies; 9+ messages in thread
From: Tim Lee @ 2021-10-17 13:56 UTC (permalink / raw)
  To: Phil; +Cc: help-guix

On 2021-10-17 13:15 +0100, Phil wrote:
> I'd highlight that when 2 packages exist with identical verison number,
> and one package is specified as local (via -L or GUIX_PACKAGE_PATH),
> that local version is preferred over a git-hosted channel.

Warnings will also be printed. For example:

> guix install: warning: ambiguous package specification `mypackage'
> guix install: warning: choosing mypackage@1.2.3 from ./path/to/mysoftware.scm:123:4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: GUIX_PACKAGE_PATH doesn't have priority over official guix packages
  2021-10-16 21:03 ` Phil Beadling
  2021-10-16 22:29   ` Tim Lee
@ 2021-10-18 13:48   ` Paul Jewell
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Jewell @ 2021-10-18 13:48 UTC (permalink / raw)
  To: help-guix

Just a small thought:

On 16/10/2021 22:03, Phil Beadling wrote:
> As far as I can see, Guix will always prefer the highest version number
> irrspective of which channel is sources it from.
>> However, if there is a package with the same name in both my channel and
>> in the official guix channel, 'guix install' will install from the
>> official guix channel instead of my channel. Is this supposed to happen?
>> I thought that GUIX_PACKAGE_PATH is supposed to have priority over
>> the official guix channel?
>>
>> I am currently working around this problem by specifying the version
>> number when installing. For example:
>>
>> $ GUIX_PACKAGE_PATH=. guix install 'mypackage@1.2.3'


This is a similar situation you see in the gentoo world with an overlay 
(similar to non core channel) containing an ebuild (package definition) 
for a package which also exists in the main repo. The highest version 
number will be selected by default, regardless of the ebuild location. 
The solution there is to allow the overlay source to be included in the 
package definition:

emerge -av my-package::my-overlay

[emerge is the command which installs packages]

It is also allowed to pin a particular version of the package, but if 
the package exists in both the overlay and the main repo, I am not sure 
what will happen.

Perhaps in the future a similar method could be used to pin a particular 
channel for a package? It is quite useful to ensure the latest package 
continues to be installed without having to change the version number in 
the package list.

--
Paul





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-18 13:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16  8:45 GUIX_PACKAGE_PATH doesn't have priority over official guix packages Tim Lee
2021-10-16 21:03 ` Phil Beadling
2021-10-16 22:29   ` Tim Lee
2021-10-17  8:10     ` Phil
2021-10-17 11:36     ` Tobias Geerinckx-Rice
2021-10-17 12:15       ` Phil
2021-10-17 12:31         ` Tobias Geerinckx-Rice
2021-10-17 13:56         ` Tim Lee
2021-10-18 13:48   ` Paul Jewell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).