unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: 55220@debbugs.gnu.org
Subject: [bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options.
Date: Fri, 06 May 2022 16:54:06 +0200	[thread overview]
Message-ID: <875ymi3e5t.fsf_-_@gnu.org> (raw)
In-Reply-To: <20220502111859.13605-4-othacehe@gnu.org> (Mathieu Othacehe's message of "Mon, 2 May 2022 13:18:59 +0200")

Mathieu Othacehe <othacehe@gnu.org> skribis:

> Also factorize the --system and --target build options. Check that the passed
> system and target arguments are known platforms.
>
> * doc/guix.texi (Additional Build Options): Document the new --list-systems
> and --list-targets options.
> * guix/scripts/build.scm (show-cross-build-options-help,
> show-emulated-build-options-help, list-systems, list-targets): New procedures.
> (%standard-cross-build-options, %standard-emulated-build-options): New
> variables.
> (show-help): Remove --system and --target entries and use
> show-cross-build-options-help and show-emulated-build-options-help procedures instead.
> (%options): Remove --system and --target entries and use
> %standard-cross-build-options and %standard-emulated-build-options variables instead.
> * guix/scripts/archive.scm (show-help, %options): Adapt them.
> * guix/scripts/environment.scm: Ditto.
> * guix/scripts/graph.scm: Ditto.
> * guix/scripts/pack.scm: Ditto.
> * guix/scripts/pull.scm: Ditto.
> * guix/scripts/size.scm: Ditto.
> * guix/scripts/weather.scm: Ditto.
>
> Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>

[...]

> +@item --list-systems
> +List all the supported systems, than can be passed as @var{system}
> +argument.

“as an argument to @option{--system}” maybe?

> +@item --list-targets
> +List all the supported targets, than can be passed as @var{target}
> +argument.

Likewise.

> +(define %standard-cross-build-options
> +  ;; Build options related to cross builds.
> +  (list
> +   (option '("list-targets") #f #f
> +           (lambda (opt name arg result)
> +             (list-targets)
> +             (exit 0)))
> +   (option '("target") #t #f
> +           (lambda (opt name arg result . rest)
> +             (let ((t (false-if-exception
> +                       (first (member arg (targets))))))
> +               (if t
> +                   (apply values (alist-cons 'target t result) rest)
> +                   (leave (G_ "'~a' is not a supported target.~%")
> +                          arg)))))))

This is my main issue: should we still accept any triplet, and simply
print a nicer error than currently when the glibc dynamic linker name is
unknown?

Or should be be just as strict as above, at the risk of frustrating
developers porting stuff to new or unusual platforms?

Or should there be an option to bypass this check?

Maybe I’m overrating the usefulness of allowing users to pass in
arbitrary triplets, though the manual does suggest that when porting to
a new platform (info "(guix) Porting").  Thoughts?

> +(define %standard-emulated-build-options
> +  ;; Build options related to emulated builds.
> +  (list
> +   (option '("list-systems") #f #f
> +           (lambda (opt name arg result)
> +             (list-systems)
> +             (exit 0)))
> +   (option '(#\s "system") #t #f
> +           (lambda (opt name arg result . rest)
> +             (let ((s (false-if-exception
> +                       (first (member arg (systems))))))
> +               (if s
> +                   (apply values (alist-cons 'system s result) rest)
> +                   (leave (G_ "'~a' is not a supported system.~%")
> +                          arg)))))))

Since it has nothing to do with emulation :-), how about calling it
‘%standard-native-build-options’, ‘%standard-system-type-build-options’,
or similar?

How about replacing:

  (let ((s (false-if-exception (first (member arg (systems))))))
    (if s …))

with:

  (if (member arg (systems)) …)

?

Also, please remove final period in the error message passed to ‘leave’.

Anyway, overall this patch series is a clear improvement over the status
quo, so this is just about fine-tuning the details.

Thanks!

Ludo’.




  reply	other threads:[~2022-05-06 14:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 11:17 [bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options Mathieu Othacehe
2022-05-02 11:18 ` [bug#55220] [PATCH 1/4] platform: Introduce new platforms Mathieu Othacehe
2022-05-02 11:18   ` [bug#55220] [PATCH 2/4] platform: Add discovery support Mathieu Othacehe
2022-05-06 14:41     ` [bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options Ludovic Courtès
2022-05-07 15:53       ` Mathieu Othacehe
2022-05-02 11:18   ` [bug#55220] [PATCH 3/4] ci: Do not rely on hardcoded cross-targets lists Mathieu Othacehe
2022-05-02 11:18   ` [bug#55220] [PATCH 4/4] scripts: Add --list-systems and --list-targets options Mathieu Othacehe
2022-05-06 14:54     ` Ludovic Courtès [this message]
2022-05-07 16:04       ` [bug#55220] [PATCH 0/4] " Mathieu Othacehe
2022-05-22  1:30       ` Maxim Cournoyer
2022-05-22  1:25     ` Maxim Cournoyer
2022-05-22 13:09       ` Mathieu Othacehe
2022-05-06 14:39   ` Ludovic Courtès
2022-05-07 15:50     ` Mathieu Othacehe
2022-05-06 14:37 ` Ludovic Courtès
2022-05-07 16:11 ` [bug#55220] [PATCH v2 0/6] " Mathieu Othacehe
2022-05-07 16:11   ` [bug#55220] [PATCH v2 1/6] platform: Introduce new platforms Mathieu Othacehe
2022-05-09 20:44     ` Maxime Devos
2022-05-22  1:39       ` [bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options Maxim Cournoyer
2022-05-22 13:12         ` Mathieu Othacehe
2022-05-22 13:42           ` Maxim Cournoyer
2022-05-22 13:01       ` [bug#55220] [PATCH v2 1/6] platform: Introduce new platforms Mathieu Othacehe
2022-05-09 20:50     ` Maxime Devos
2022-05-22 13:02       ` Mathieu Othacehe
2022-05-07 16:11   ` [bug#55220] [PATCH v2 2/6] platform: Add discovery support Mathieu Othacehe
2022-05-09 20:58     ` Maxime Devos
2022-05-22  1:34       ` [bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options Maxim Cournoyer
2022-05-22 13:06       ` [bug#55220] [PATCH v2 2/6] platform: Add discovery support Mathieu Othacehe
2022-05-07 16:11   ` [bug#55220] [PATCH v2 3/6] ci: Do not rely on hardcoded cross-targets lists Mathieu Othacehe
2022-05-07 16:11   ` [bug#55220] [PATCH v2 4/6] scripts: Add --list-systems and --list-targets options Mathieu Othacehe
2022-05-07 16:11   ` [bug#55220] [PATCH v2 5/6] platform: Add glibc-dynamic-linker field Mathieu Othacehe
2022-05-07 16:11   ` [bug#55220] [PATCH v2 6/6] linux: Remove system->linux-architecture procedure Mathieu Othacehe

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=875ymi3e5t.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=55220@debbugs.gnu.org \
    --cc=othacehe@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).