Re: Finding the channel in which a package is defined

2021-04-01 Thread Konrad Hinsen
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.



Re: Finding the channel in which a package is defined

2021-04-01 Thread Tobias Geerinckx-Rice

Mathieu Othacehe writes:

package-channels


Ah sweet!  This is exactly what I was looking for


(guix packages)


...here.  -_-

Thanks,

T G-R


signature.asc
Description: PGP signature


Re: Finding the channel in which a package is defined

2021-04-01 Thread Mathieu Othacehe


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




Re: Finding the channel in which a package is defined

2021-04-01 Thread Ricardo Wurmus


Konrad Hinsen  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



Re: Finding the channel in which a package is defined

2021-04-01 Thread Tobias Geerinckx-Rice

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


signature.asc
Description: PGP signature


Re: Finding the channel in which a package is defined

2021-04-01 Thread Konrad Hinsen
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



Re: Finding the channel in which a package is defined

2021-04-01 Thread Tobias Geerinckx-Rice

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



Finding the channel in which a package is defined

2021-04-01 Thread Konrad Hinsen
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