unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Finding the channel in which a package is defined
@ 2021-04-01 10:07 Konrad Hinsen
  2021-04-01 10:11 ` Tobias Geerinckx-Rice
  2021-04-01 13:26 ` Mathieu Othacehe
  0 siblings, 2 replies; 9+ messages in thread
From: Konrad Hinsen @ 2021-04-01 10:07 UTC (permalink / raw)
  To: Guix Devel

Dear Guix experts,

Is there a simple way to find out in which channel a given package was
defined? I tried "guix edit" to see the source code, but it shows a file
from a "module-union" directory in the store.

Cheers,
  Konrad


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

* Re: Finding the channel in which a package is defined
  2021-04-01 10:07 Finding the channel in which a package is defined Konrad Hinsen
@ 2021-04-01 10:11 ` Tobias Geerinckx-Rice
  2021-04-01 10:25   ` Konrad Hinsen
  2021-04-01 13:26 ` Mathieu Othacehe
  1 sibling, 1 reply; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-04-01 10:11 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: guix-devel

Konrad,

Konrad Hinsen writes:
> Dear Guix experts,

I'll answer in the meantime.

> Is there a simple way to find out in which channel a given 
> package was
> defined?

Does the ‘location’ field of ‘guix show PACKAGE’ do what you want?

Kind regards,

T G-R


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

* Re: Finding the channel in which a package is defined
  2021-04-01 10:11 ` Tobias Geerinckx-Rice
@ 2021-04-01 10:25   ` Konrad Hinsen
  2021-04-01 12:27     ` Tobias Geerinckx-Rice
  2021-04-01 13:04     ` Ricardo Wurmus
  0 siblings, 2 replies; 9+ messages in thread
From: Konrad Hinsen @ 2021-04-01 10:25 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: guix-devel

Tobias,

Thanks for your reply!

> Does the ‘location’ field of ‘guix show PACKAGE’ do what you want?

Taking coreutils as a test case, it displays:

   gnu/packages/base.scm:328:2

as a link pointing to:

   /gnu/store/3qykwxq1mqlin3lrb93s3rzi1ah5xia8-guix-module-union/share/guile/site/3.0/gnu/packages/base.scm

and that is the same file that is opened with "guix edit". But it's a
copy of the input source file that is part of some channel, so the
provenance is lost.

Cheers,
  Konrad


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

* Re: Finding the channel in which a package is defined
  2021-04-01 10:25   ` Konrad Hinsen
@ 2021-04-01 12:27     ` Tobias Geerinckx-Rice
  2021-04-01 13:04     ` Ricardo Wurmus
  1 sibling, 0 replies; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-04-01 12:27 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: guix-devel

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

Konrad Hinsen writes:
> Taking coreutils as a test case, it displays:
>
>    gnu/packages/base.scm:328:2

Right, it's not guaranteed to match the channel name, but it's 
usually enough to deduce it.

I meant something like:

  λ guix show nicecat | grep ^location
  location: nckx/packages/gnuzilla.scm:105:2

Because my channel uses (nckx packages ...) module names.  Most 
channels do something similar.

If you're using a third-party channel that shadows (clobbers?) the 
(gnu packages ...) namespace, I'm not sure what you could do.

Kind regards,

T G-R

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

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

* Re: Finding the channel in which a package is defined
  2021-04-01 10:25   ` Konrad Hinsen
  2021-04-01 12:27     ` Tobias Geerinckx-Rice
@ 2021-04-01 13:04     ` Ricardo Wurmus
  1 sibling, 0 replies; 9+ messages in thread
From: Ricardo Wurmus @ 2021-04-01 13:04 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: guix-devel


Konrad Hinsen <konrad.hinsen@fastmail.net> writes:

> Tobias,
>
> Thanks for your reply!
>
>> Does the ‘location’ field of ‘guix show PACKAGE’ do what you want?
>
> Taking coreutils as a test case, it displays:
>
>    gnu/packages/base.scm:328:2
>
> as a link pointing to:
>
>    /gnu/store/3qykwxq1mqlin3lrb93s3rzi1ah5xia8-guix-module-union/share/guile/site/3.0/gnu/packages/base.scm
>
> and that is the same file that is opened with "guix edit". But it's a
> copy of the input source file that is part of some channel, so the
> provenance is lost.

I’m pretty sure that the union file itself is a link.  By using
“readlink -f
/gnu/store/3qykwxq1mqlin3lrb93s3rzi1ah5xia8-guix-module-union/share/guile/site/3.0/gnu/packages/base.scm”
you could get the source directory of that file.  The prefix will
indicate that this is a Guix source checkout, whereas for files from
other channels the prefix directory will differ.

Still, that’s a bit crude.  It might be better to record a channel
reference in the package values.

-- 
Ricardo


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

* Re: Finding the channel in which a package is defined
  2021-04-01 10:07 Finding the channel in which a package is defined Konrad Hinsen
  2021-04-01 10:11 ` Tobias Geerinckx-Rice
@ 2021-04-01 13:26 ` Mathieu Othacehe
  2021-04-01 13:39   ` Tobias Geerinckx-Rice
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Mathieu Othacehe @ 2021-04-01 13:26 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: Guix Devel


Hello Konrad,

> Is there a simple way to find out in which channel a given package was
> defined? I tried "guix edit" to see the source code, but it shows a file
> from a "module-union" directory in the store.

You can run something like:

--8<---------------cut here---------------start------------->8---
,use (guix describe) (gnu packages) (gnu packages linux)
(%package-module-path)
(package-channels strace)
--8<---------------cut here---------------end--------------->8---

in a "guix repl" to determine the channel providing "strace". If you
replace "strace" by a package provided by my-channel, "package-channels"
should return a list containing the default Guix channel as well as
my-channel.

Mathieu



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

* Re: Finding the channel in which a package is defined
  2021-04-01 13:26 ` Mathieu Othacehe
@ 2021-04-01 13:39   ` Tobias Geerinckx-Rice
  2021-04-01 14:06   ` Pierre Neidhardt
  2021-04-01 16:11   ` Konrad Hinsen
  2 siblings, 0 replies; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2021-04-01 13:39 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: Konrad Hinsen, guix-devel

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

Mathieu Othacehe writes:
> package-channels

Ah sweet!  This is exactly what I was looking for

> (guix packages)

...here.  -_-

Thanks,

T G-R

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

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

* Re: Finding the channel in which a package is defined
  2021-04-01 13:26 ` Mathieu Othacehe
  2021-04-01 13:39   ` Tobias Geerinckx-Rice
@ 2021-04-01 14:06   ` Pierre Neidhardt
  2021-04-01 16:11   ` Konrad Hinsen
  2 siblings, 0 replies; 9+ messages in thread
From: Pierre Neidhardt @ 2021-04-01 14:06 UTC (permalink / raw)
  To: Mathieu Othacehe, Konrad Hinsen; +Cc: Guix Devel

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

Hi Mathieu!

Mathieu Othacehe <othacehe@gnu.org> writes:

> You can run something like:
>
> --8<---------------cut here---------------start------------->8---
> ,use (guix describe) (gnu packages) (gnu packages linux)
> (%package-module-path)
> (package-channels strace)
> --8<---------------cut here---------------end--------------->8---

Thanks for sharing, this is very useful!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

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

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

* Re: Finding the channel in which a package is defined
  2021-04-01 13:26 ` Mathieu Othacehe
  2021-04-01 13:39   ` Tobias Geerinckx-Rice
  2021-04-01 14:06   ` Pierre Neidhardt
@ 2021-04-01 16:11   ` Konrad Hinsen
  2 siblings, 0 replies; 9+ messages in thread
From: Konrad Hinsen @ 2021-04-01 16:11 UTC (permalink / raw)
  To: Mathieu Othacehe, Ricardo Wurmus, Tobias Geerinckx-Rice; +Cc: Guix Devel

Hi everyone,

thanks for your suggestions. My award for the most useful one (to me)
goes to Mathieu :

> You can run something like:
>
> --8<---------------cut here---------------start------------->8---
> ,use (guix describe) (gnu packages) (gnu packages linux)
> (%package-module-path)
> (package-channels strace)
> --8<---------------cut here---------------end--------------->8---

Since the information is stored with all packages, it would be
reasonable for "guix show" to display it as well. I'll look at this and
propose a patch if I succeed.

It's a bit surprising at first sight that there are multiple channels. I
suspect that the list contains the channels of all inputs as well,
recursively, meaning that channel "guix" is present almost everywhere.

Cheers,
  Konrad.


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

end of thread, other threads:[~2021-04-01 16:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 10:07 Finding the channel in which a package is defined Konrad Hinsen
2021-04-01 10:11 ` Tobias Geerinckx-Rice
2021-04-01 10:25   ` Konrad Hinsen
2021-04-01 12:27     ` Tobias Geerinckx-Rice
2021-04-01 13:04     ` Ricardo Wurmus
2021-04-01 13:26 ` Mathieu Othacehe
2021-04-01 13:39   ` Tobias Geerinckx-Rice
2021-04-01 14:06   ` Pierre Neidhardt
2021-04-01 16:11   ` Konrad Hinsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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