guix-patches
[Top][All Lists]
Advanced

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

[bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options.


From: Ludovic Courtès
Subject: [bug#55220] [PATCH 0/4] Add --list-systems and --list-targets options.
Date: Fri, 06 May 2022 16:54:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

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 via email to

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