From: "Ludovic Courtès" <ludo@gnu.org>
To: Hilton Chain <hako@ultrarare.space>
Cc: Josselin Poiret <dev@jpoiret.xyz>,
Simon Tournier <zimon.toutoune@gmail.com>,
Mathieu Othacehe <othacehe@gnu.org>,
Tobias Geerinckx-Rice <me@tobias.gr>,
Ricardo Wurmus <rekado@elephly.net>,
65062@debbugs.gnu.org, Christopher Baines <guix@cbaines.net>
Subject: [bug#65062] [PATCH core-updates] packages: Lookup inputs by specification.
Date: Wed, 20 Dec 2023 22:26:51 +0100 [thread overview]
Message-ID: <87msu4ftus.fsf_-_@gnu.org> (raw)
In-Reply-To: <dac85ddb4c5637ab522b4b37f926f00af567cc33.1696323536.git.hako@ultrarare.space> (Hilton Chain's message of "Tue, 3 Oct 2023 17:17:02 +0800")
Hi,
Hilton Chain <hako@ultrarare.space> skribis:
> * guix/packages.scm (specification->inputs): New procedure.
> (lookup-input,replace-input): Use it.
> (delete-input): New procedure.
> (modify-inputs)[delete]: Use it.
I’ve been thinking about this change lately.
The problem we have now is that it looks like input labels are gone, but
they’re not; in particular ‘modify-inputs’ preserves labels, which is a
source of confusion. For instance, if you do:
(modify-inputs x
(replace "openmpi" mpich))
then ‘mpich’ remains associated with the “openmpi” label. Ugh.
So I sympathize with the goal. I think we can do something simpler
though:
> (define (lookup-input inputs name)
> "Lookup NAME among INPUTS, an input list."
> ;; Note: Currently INPUTS is assumed to be an input list that contains input
> ;; labels. In the future, input labels will be gone and this procedure will
> ;; check package names.
> - (match (assoc-ref inputs name)
> - ((obj) obj)
> - ((obj _) obj)
> - (#f #f)))
> + (let ((candidates (specification->inputs name inputs)))
> + (and (not (null? candidates))
> + (second (first candidates)))))
How about:
(find (match-lambda
((_ (? package? package) . _)
(string=? (package-name package) name))
(_ #f))
inputs)
?
That way, ‘lookup-input’ would honor package names and ignore labels.
> +(define (delete-input name inputs)
> + "Delete input NAME within INPUTS."
> + (let ((to-delete (specification->inputs name inputs)))
> + (lset-difference equal? inputs to-delete)))
And we do something similar here.
Thus, no need to fiddle with specifications.
How does that sound?
Now, I think this is the way forward, but I also think it’s going to
break many packages and workflows (‘--with-input’…). So it should go
hand in hand with an effort to fully remove labels in Guix.
Thanks,
Ludo’.
prev parent reply other threads:[~2023-12-20 21:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-05 2:50 [bug#65062] [PATCH core-updates 0/1] Specify output in input label when it's not "out" Hilton Chain via Guix-patches via
2023-08-05 2:53 ` [bug#65062] [PATCH core-updates 1/1] packages: " Hilton Chain via Guix-patches via
2023-08-22 16:00 ` Ludovic Courtès
2023-08-24 3:42 ` Hilton Chain via Guix-patches via
2023-08-25 11:10 ` Josselin Poiret via Guix-patches via
2023-09-08 22:03 ` Ludovic Courtès
2023-10-03 9:13 ` Hilton Chain via Guix-patches via
2023-08-05 3:01 ` [bug#65062] [PATCH core-updates 0/1] " Hilton Chain via Guix-patches via
2023-08-05 3:19 ` Hilton Chain via Guix-patches via
2023-10-03 9:15 ` [bug#65062] [PATCH v2 core-updates 0/2] packages: Lookup inputs by specification Hilton Chain via Guix-patches via
2023-10-03 9:17 ` [bug#65062] [PATCH v2 core-updates 1/2] ui: package-specification->name+version+output: Move to (guix packages) Hilton Chain via Guix-patches via
2023-10-03 9:17 ` [bug#65062] [PATCH v2 core-updates 2/2] packages: Lookup inputs by specification Hilton Chain via Guix-patches via
2023-12-20 21:26 ` Ludovic Courtès [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87msu4ftus.fsf_-_@gnu.org \
--to=ludo@gnu.org \
--cc=65062@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=hako@ultrarare.space \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=rekado@elephly.net \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).