guix system: Use standard cross and native build options.

This change prevents guix system from erroring out with an ugly backtrace
when it's passed an invalid value to the “--system” or “--target”
option. It also adds the “--list-systems” and “--list-targets” options.

The manual section about guix system doesn't mention the “--target” option,
so add it there.

* guix/scripts/system (show-help): Call show-cross-build-options-help and
show-native-build-options-help.
(%options): Remove own implementation of “system” and “target” options and
use the ones in %standard-cross-build-options and
%standard-native-build-options.
* doc/guix.texi (Invoking guix system): Document “--target” option.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
Thiago Jung Bauermann 2022-08-21 03:11:24 -03:00 committed by Mathieu Othacehe
parent 93ed34977e
commit 65ce5fe2fb
No known key found for this signature in database
GPG key ID: 8354763531769CA6
2 changed files with 12 additions and 9 deletions

View file

@ -38021,6 +38021,11 @@ Installation Image}).
Attempt to build for @var{system} instead of the host system type.
This works as per @command{guix build} (@pxref{Invoking guix build}).
@item --target=@var{triplet}
Cross-build for @var{triplet}, which must be a valid GNU triplet, such
as @code{"aarch64-linux-gnu"} (@pxref{Specifying target triplets, GNU
configuration triplets,, autoconf, Autoconf}).
@item --derivation
@itemx -d
Return the derivation file name of the given operating system without

View file

@ -1046,6 +1046,10 @@ (define (show-help)
for 'describe' and 'list-generations', list installed
packages matching REGEXP"))
(newline)
(show-cross-build-options-help)
(newline)
(show-native-build-options-help)
(newline)
(display (G_ "
-h, --help display this help and exit"))
(display (G_ "
@ -1136,14 +1140,6 @@ (define %options
(let ((level (string->number* arg)))
(alist-cons 'verbosity level
(alist-delete 'verbosity result)))))
(option '(#\s "system") #t #f
(lambda (opt name arg result)
(alist-cons 'system arg
(alist-delete 'system result eq?))))
(option '("target") #t #f
(lambda (opt name arg result)
(alist-cons 'target arg
(alist-delete 'target result eq?))))
(option '(#\r "root") #t #f
(lambda (opt name arg result)
(alist-cons 'gc-root arg result)))
@ -1153,7 +1149,9 @@ (define %options
(option '(#\I "list-installed") #f #t
(lambda (opt name arg result)
(alist-cons 'list-installed (or arg "") result)))
%standard-build-options))
(append %standard-build-options
%standard-cross-build-options
%standard-native-build-options)))
(define %default-options
;; Alist of default option values.