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

@ -39,7 +39,9 @@
options->transformation
%transformation-options))
#:use-module ((guix scripts build)
#:select (%standard-build-options))
#:select (%standard-build-options
%standard-native-build-options
show-native-build-options-help))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
@ -504,10 +506,6 @@ package modules, while attempting to retain user package modules."
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
(option '(#\s "system") #t #f
(lambda (opt name arg result)
(alist-cons 'system arg
(alist-delete 'system result eq?))))
(find (lambda (option)
(member "load-path" (option-names option)))
%standard-build-options)
@ -519,7 +517,8 @@ package modules, while attempting to retain user package modules."
(lambda args
(show-version-and-exit "guix graph")))
%transformation-options))
(append %transformation-options
%standard-native-build-options)))
(define (show-help)
;; TRANSLATORS: Here 'dot' is the name of a program; it must not be
@ -540,8 +539,6 @@ Emit a representation of the dependency graph of PACKAGE...\n"))
--path display the shortest path between the given nodes"))
(display (G_ "
-e, --expression=EXPR consider the package EXPR evaluates to"))
(display (G_ "
-s, --system=SYSTEM consider the graph for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
-L, --load-path=DIR prepend DIR to the package module search path"))
@ -553,6 +550,8 @@ Emit a representation of the dependency graph of PACKAGE...\n"))
(display (G_ "
-V, --version display version information and exit"))
(newline)
(show-native-build-options-help)
(newline)
(show-bug-report-information))
(define %default-options