scripts: Add --list-systems and --list-targets options.

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>
This commit is contained in:
Mathieu Othacehe 2022-05-02 12:59:14 +02:00
parent dd970122dd
commit ec42d287b4
No known key found for this signature in database
GPG key ID: 8354763531769CA6
9 changed files with 120 additions and 74 deletions

View file

@ -96,8 +96,6 @@ shell'."
(display (G_ "
--search-paths display needed environment variable definitions"))
(display (G_ "
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(display (G_ "
-r, --root=FILE make FILE a symlink to the result, and register it
as a garbage collector root"))
(display (G_ "
@ -145,6 +143,8 @@ COMMAND or an interactive shell in that environment.\n"))
(newline)
(show-build-options-help)
(newline)
(show-native-build-options-help)
(newline)
(show-transformation-options-help)
(newline)
(display (G_ "
@ -226,10 +226,6 @@ use '--preserve' instead~%"))
(option '(#\n "dry-run") #f #f
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
(option '(#\s "system") #t #f
(lambda (opt name arg result)
(alist-cons 'system arg
(alist-delete 'system result eq?))))
(option '(#\C "container") #f #f
(lambda (opt name arg result)
(alist-cons 'container? #t result)))
@ -273,7 +269,8 @@ use '--preserve' instead~%"))
(alist-cons 'bootstrap? #t result)))
(append %transformation-options
%standard-build-options)))
%standard-build-options
%standard-native-build-options)))
(define (pick-all alist key)
"Return a list of values in ALIST associated with KEY."