From: "Ludovic Courtès" <ludo@gnu.org>
To: elaexuotee@wilsonb.com
Cc: guix-devel@gnu.org
Subject: Re: packages: [PoC] Expand range of objects 'add-input-label' can label
Date: Tue, 18 Jan 2022 16:32:51 +0100 [thread overview]
Message-ID: <87zgntdpp8.fsf@gnu.org> (raw)
In-Reply-To: <3J7C60ZL2GML6.2523PXP88LOT9@wilsonb.com> (elaexuotee@wilsonb.com's message of "Mon, 17 Jan 2022 19:01:35 +0900")
Hi,
elaexuotee@wilsonb.com skribis:
> From 3b8e7fa8fbd58e7e164e3730c708419f612b8549 Mon Sep 17 00:00:00 2001
> From: "B. Wilson" <elaexuotee@wilsonb.com>
> Date: Sun, 16 Jan 2022 23:54:51 +0900
> Subject: [PATCH 1/2] packages: Expand range of objects 'add-input-label' can
> label
> To: guix-patches@gnu.org
>
> * guix/packages.scm (%auxiliary-files-subpath-dir): New variable.
> (add-input-label): Support labels from the name property of
> objects that have one. Also, name auxiliary files from their
> subpath.
[...]
> (define (add-input-label input)
> "Add an input label to INPUT."
> (match input
> @@ -576,7 +581,24 @@ (define (add-input-label input)
> (list (package-name package) package))
> (((? package? package) output) ;XXX: ugly?
> (list (package-name package) package output))
> - ((? gexp-input?) ;XXX: misplaced because 'native?' field is ignored?
> + ((? local-file? local-file)
> + (list (local-file-name local-file) local-file))
> + ((? plain-file? plain-file)
> + (list (plain-file-name plain-file) plain-file))
> + ((? computed-file? computed-file)
> + (list (computed-file-name computed-file) computed-file))
> + ((? program-file? program-file)
> + (list (program-file-name program-file) program-file))
> + ((? scheme-file? scheme-file)
> + (list (scheme-file-name scheme-file) scheme-file))
> + ((? string? path)
> + (let* ((regex (string-append %auxiliary-files-subdir-path "/(.*)"))
> + (match (string-match regex input)))
> + `(,(if match
> + (match:substring match 1)
> + "_")
> + ,input)))
> + ((? gexp-input?) ;XXX: misplaced because 'native?' field is ignored?
I can see why it’s tempting to add more labels, but the medium-term goal
is to remove labels altogether since there are other mechanisms to fill
the same role:
https://guix.gnu.org/en/blog/2021/the-big-change/
I would keep things as they are and instead encourage you to use gexps
when you need to refer to file-like objects in packages.
We’re still fine-tuning the idioms, so feel free to ask if you don’t see
how to achieve what you want.
HTH!
Ludo’.
prev parent reply other threads:[~2022-01-18 16:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 10:01 packages: [PoC] Expand range of objects 'add-input-label' can label elaexuotee
2022-01-18 15:32 ` 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=87zgntdpp8.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=elaexuotee@wilsonb.com \
--cc=guix-devel@gnu.org \
/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).