help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions regarding substitutes with debug output


From: zimoun
Subject: Re: Questions regarding substitutes with debug output
Date: Fri, 29 Apr 2022 10:49:47 +0200

Hi Olivier,

On Thu, 28 Apr 2022 at 10:11, Olivier Dion via <help-guix@gnu.org> wrote:
> On Thu, 28 Apr 2022, zimoun <zimon.toutoune@gmail.com> wrote:

> In my case, I prefer to avoid using package object directly.  As
> mentioned in GWL' manual, the version of Guix running GWL and the
> version of Guix used by GWL (the inferior) might not be the same.  Thus,
> it is not okay for reproducibility in the long term.  In my case, I use
> `guix time-machine --channels` as the inferior.

You wrote:

         I need to specify the package programmatically as a string in
         Guile.  More specifically in the process packages field of Guix
         Workflow Language.

so I do not understand why it would be an issue to deal with the package
instead of the specification string.  Because your need seems «to
specify the package programmatically». :-)


>> Last, back to the feature you would like – be able to write:
>>
>>     (specifications->manifest (list "foo"))
>>
>> and select "foo" from your channel instead from upstream, right?  Or a
>> way to specify the channel using the symbol from the name field in
>> <channel>, right?
>
> Correct.  In fact as I mentioned above, I think having a way to select a
> package variant -- e.g. if you've introduced an existing package in your
> channel -- is a more generic way of describing it.  Selection of channel
> being only a type of metadata that can be used for selection of the
> variant.  More metadata could be added in the future as well.

Well, I think you are “overengineering“. :-) I am lacking of imagination
about a channel containing several packages with the exact same name,
version, output but applying a variation to ’arguments’ or ’inputs’.

About ’arguments’, you need a short key as metadata, and the simplest is
to put this key directly in the name or version or output.

About ’inputs’, it remembers me «parameterized package», e.g., see [1].

1: <https://yhetil.org/guix/87eeku8trb.fsf@gnu.org>.


>> Aside the syntax of the string – why not the one your are proposing –
>> and so adapt ’package-name->name+version’ (or similar), the function
>> ’find-best-packages-by-name’ requires some improvements.


Rethinking about the feature request, what I would do:

 1. channel with variants where each variant contains a ’properties’ (it
 is an association list describing whatever you want and kept as-is)

 2. write a manifest.scm where I would filter by name and ’properties’;
 probably using ’fold-packages’.

Well, #2 means write by hand my own version ’find-best-packages-by-name’.

Maybe the API could have a function returning a list of packages from
its arguments name, version, output *and* a ’properties’ specification.


>> What I am missing is the mapping from channel name to package.  Well,
>> Guix does not track this information at pull time.  And I miss how to
>> implement such mapping.

Well, this mapping could be included as another ’properties’.  When
building the cache (~/.config/guix/current/lib/package.cache) with
’generate-package-cache’, the cache already contains the module name…

--8<---------------cut here---------------start------------->8---
  (define expand-cache
    (match-lambda*
      (((module symbol variable) (result . seen))
       (let ((package (variable-ref variable)))
         (if (or (vhash-assq package seen)
                 (hidden-package? package))
             (cons result seen)
             (cons (cons `#(,(package-name package)
                            ,(package-version package)
                            ,(module-name module)
                            ,symbol
                            ,(package-outputs package)
                            ,(->bool (supported-package? package))
                            ,(->bool (package-superseded package))
                            ,@(let ((loc (package-location package)))
                                (if loc
                                    `(,(location-file loc)
                                      ,(location-line loc)
                                      ,(location-column loc))
                                    '(#f #f #f))))
                         result)
                   (vhash-consq package #t seen)))))))
--8<---------------cut here---------------end--------------->8---

…but then it is not exploited by ’specifications->manifest’ and co, IIUC.


All in all, maybe it is time to resume: :-)

    https://issues.guix.gnu.org/39258

Cheers,
simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]