mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
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:
parent
dd970122dd
commit
ec42d287b4
9 changed files with 120 additions and 74 deletions
|
@ -12397,6 +12397,14 @@ 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 --list-systems
|
||||
List all the supported systems, that can be passed as an argument to
|
||||
@option{--system}.
|
||||
|
||||
@item --list-targets
|
||||
List all the supported targets, that can be passed as an argument to
|
||||
@option{--target}.
|
||||
|
||||
@anchor{build-check}
|
||||
@item --check
|
||||
@cindex determinism, checking
|
||||
|
|
|
@ -93,14 +93,14 @@ (define (show-help)
|
|||
(display (G_ "
|
||||
-S, --source build the packages' source derivations"))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
|
||||
(display (G_ "
|
||||
--target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
|
||||
(display (G_ "
|
||||
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
|
||||
|
||||
(newline)
|
||||
(show-build-options-help)
|
||||
(newline)
|
||||
(show-cross-build-options-help)
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
|
||||
(newline)
|
||||
(display (G_ "
|
||||
|
@ -166,14 +166,6 @@ (define %options
|
|||
(option '(#\S "source") #f #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'source? #t 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 '(#\e "expression") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'expression arg result)))
|
||||
|
@ -186,7 +178,9 @@ (define %options
|
|||
(lambda (opt name arg result)
|
||||
(alist-cons 'dry-run? #t result)))
|
||||
|
||||
%standard-build-options))
|
||||
(append %standard-build-options
|
||||
%standard-cross-build-options
|
||||
%standard-native-build-options)))
|
||||
|
||||
(define (derivation-from-expression store str package-derivation
|
||||
system source?)
|
||||
|
|
|
@ -47,6 +47,7 @@ (define-module (guix scripts build)
|
|||
#:use-module (srfi srfi-35)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (gnu platform)
|
||||
#:use-module ((guix status) #:select (with-status-verbosity))
|
||||
#:use-module ((guix progress) #:select (current-terminal-columns))
|
||||
#:use-module ((guix build syscalls) #:select (terminal-columns))
|
||||
|
@ -54,9 +55,15 @@ (define-module (guix scripts build)
|
|||
#:export (log-url
|
||||
|
||||
%standard-build-options
|
||||
%standard-cross-build-options
|
||||
%standard-native-build-options
|
||||
|
||||
set-build-options-from-command-line
|
||||
set-build-options-from-command-line*
|
||||
|
||||
show-build-options-help
|
||||
show-cross-build-options-help
|
||||
show-native-build-options-help
|
||||
|
||||
guix-build
|
||||
register-root
|
||||
|
@ -184,6 +191,18 @@ (define (show-build-options-help)
|
|||
(display (G_ "
|
||||
--debug=LEVEL produce debugging output at LEVEL")))
|
||||
|
||||
(define (show-cross-build-options-help)
|
||||
(display (G_ "
|
||||
--list-targets list available targets"))
|
||||
(display (G_ "
|
||||
--target=TRIPLET cross-build for TRIPLET--e.g., \"aarch64-linux-gnu\"")))
|
||||
|
||||
(define (show-native-build-options-help)
|
||||
(display (G_ "
|
||||
--list-systems list available systems"))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\"")))
|
||||
|
||||
(define (set-build-options-from-command-line store opts)
|
||||
"Given OPTS, an alist as returned by 'args-fold' given
|
||||
'%standard-build-options', set the corresponding build options on STORE."
|
||||
|
@ -319,6 +338,52 @@ (define %standard-build-options
|
|||
(leave (G_ "not a number: '~a' option argument: ~a~%")
|
||||
name arg)))))))
|
||||
|
||||
(define (list-systems)
|
||||
"Print the available systems."
|
||||
(display (G_ "The available systems are:\n"))
|
||||
(newline)
|
||||
(format #t "~{ - ~a ~%~}"
|
||||
(sort (systems) string<?)))
|
||||
|
||||
(define (list-targets)
|
||||
"Print the available targets."
|
||||
(display (G_ "The available targets are:\n"))
|
||||
(newline)
|
||||
(format #t "~{ - ~a ~%~}"
|
||||
(sort (targets) string<?)))
|
||||
|
||||
(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)))))))
|
||||
|
||||
(define %standard-native-build-options
|
||||
;; Build options related to native 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)))))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Command-line options.
|
||||
|
@ -353,10 +418,6 @@ (define (show-help)
|
|||
--sources[=TYPE] build source derivations; TYPE may optionally be one
|
||||
of \"package\", \"all\" (default), or \"transitive\""))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
|
||||
(display (G_ "
|
||||
--target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
|
||||
(display (G_ "
|
||||
-d, --derivations return the derivation paths of the given packages"))
|
||||
(display (G_ "
|
||||
--check rebuild items to check for non-determinism issues"))
|
||||
|
@ -374,6 +435,10 @@ (define (show-help)
|
|||
(newline)
|
||||
(show-build-options-help)
|
||||
(newline)
|
||||
(show-cross-build-options-help)
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(show-transformation-options-help)
|
||||
(newline)
|
||||
(display (G_ "
|
||||
|
@ -420,13 +485,6 @@ (define %options
|
|||
(alist-cons 'build-mode (build-mode repair)
|
||||
result)
|
||||
rest)))
|
||||
(option '(#\s "system") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'system arg result)))
|
||||
(option '("target") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'target arg
|
||||
(alist-delete 'target result eq?))))
|
||||
(option '(#\d "derivations") #f #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'derivations-only? #t result)))
|
||||
|
@ -459,7 +517,9 @@ (define %options
|
|||
(alist-cons 'log-file? #t result)))
|
||||
|
||||
(append %transformation-options
|
||||
%standard-build-options)))
|
||||
%standard-build-options
|
||||
%standard-cross-build-options
|
||||
%standard-native-build-options)))
|
||||
|
||||
(define (options->things-to-build opts)
|
||||
"Read the arguments from OPTS and return a list of high-level objects to
|
||||
|
|
|
@ -96,8 +96,6 @@ (define (show-environment-options-help)
|
|||
(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 @@ (define (show-help)
|
|||
(newline)
|
||||
(show-build-options-help)
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(show-transformation-options-help)
|
||||
(newline)
|
||||
(display (G_ "
|
||||
|
@ -226,10 +226,6 @@ (define %options
|
|||
(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 @@ (define %options
|
|||
(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."
|
||||
|
|
|
@ -39,7 +39,9 @@ (define-module (guix scripts graph)
|
|||
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 @@ (define %options
|
|||
(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 @@ (define %options
|
|||
(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 @@ (define (show-help)
|
|||
--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 @@ (define (show-help)
|
|||
(display (G_ "
|
||||
-V, --version display version information and exit"))
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(show-bug-report-information))
|
||||
|
||||
(define %default-options
|
||||
|
|
|
@ -1244,17 +1244,9 @@ (define %options
|
|||
(option '(#\m "manifest") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'manifest arg result)))
|
||||
(option '(#\s "system") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'system arg
|
||||
(alist-delete 'system result eq?))))
|
||||
(option '("entry-point") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'entry-point arg result)))
|
||||
(option '("target") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'target arg
|
||||
(alist-delete 'target result eq?))))
|
||||
(option '(#\C "compression") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'compressor (lookup-compressor arg)
|
||||
|
@ -1305,13 +1297,19 @@ (define %options
|
|||
|
||||
(append %deb-format-options
|
||||
%transformation-options
|
||||
%standard-build-options)))
|
||||
%standard-build-options
|
||||
%standard-cross-build-options
|
||||
%standard-native-build-options)))
|
||||
|
||||
(define (show-help)
|
||||
(display (G_ "Usage: guix pack [OPTION]... PACKAGE...
|
||||
Create a bundle of PACKAGE.\n"))
|
||||
(show-build-options-help)
|
||||
(newline)
|
||||
(show-cross-build-options-help)
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(show-transformation-options-help)
|
||||
(newline)
|
||||
(show-deb-format-options)
|
||||
|
@ -1325,10 +1323,6 @@ (define (show-help)
|
|||
(display (G_ "
|
||||
-e, --expression=EXPR consider the package EXPR evaluates to"))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
|
||||
(display (G_ "
|
||||
--target=TRIPLET cross-build for TRIPLET--e.g., \"armel-linux-gnu\""))
|
||||
(display (G_ "
|
||||
-C, --compression=TOOL compress using TOOL--e.g., \"lzip\""))
|
||||
(display (G_ "
|
||||
-S, --symlink=SPEC create symlinks to the profile according to SPEC"))
|
||||
|
|
|
@ -116,12 +116,13 @@ (define (show-help)
|
|||
-p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current"))
|
||||
(display (G_ "
|
||||
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
|
||||
(display (G_ "
|
||||
--bootstrap use the bootstrap Guile to build the new Guix"))
|
||||
(newline)
|
||||
(show-build-options-help)
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(display (G_ "
|
||||
-h, --help display this help and exit"))
|
||||
(display (G_ "
|
||||
|
@ -182,10 +183,6 @@ (define %options
|
|||
(lambda (opt name arg result)
|
||||
(alist-cons 'profile (canonicalize-profile arg)
|
||||
result)))
|
||||
(option '(#\s "system") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'system arg
|
||||
(alist-delete 'system result eq?))))
|
||||
(option '(#\n "dry-run") #f #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'dry-run? #t result)))
|
||||
|
@ -206,7 +203,8 @@ (define %options
|
|||
(lambda args
|
||||
(show-version-and-exit "guix pull")))
|
||||
|
||||
%standard-build-options))
|
||||
(append %standard-build-options
|
||||
%standard-native-build-options)))
|
||||
|
||||
(define (warn-about-backward-updates channel start commit relation)
|
||||
"Warn about non-forward updates of CHANNEL from START to COMMIT, without
|
||||
|
|
|
@ -235,8 +235,6 @@ (define (show-help)
|
|||
(display (G_ "
|
||||
--substitute-urls=URLS
|
||||
fetch substitute from URLS if they are authorized"))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM consider packages for SYSTEM--e.g., \"i686-linux\""))
|
||||
;; TRANSLATORS: "closure" and "self" must not be translated.
|
||||
(display (G_ "
|
||||
--sort=KEY sort according to KEY--\"closure\" or \"self\""))
|
||||
|
@ -251,15 +249,13 @@ (define (show-help)
|
|||
(display (G_ "
|
||||
-V, --version display version information and exit"))
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(show-bug-report-information))
|
||||
|
||||
(define %options
|
||||
;; Specifications of the command-line options.
|
||||
(list (option '(#\s "system") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'system arg
|
||||
(alist-delete 'system result eq?))))
|
||||
(option '("substitute-urls") #t #f
|
||||
(cons* (option '("substitute-urls") #t #f
|
||||
(lambda (opt name arg result . rest)
|
||||
(apply values
|
||||
(alist-cons 'substitute-urls
|
||||
|
@ -287,7 +283,8 @@ (define %options
|
|||
(exit 0)))
|
||||
(option '(#\V "version") #f #f
|
||||
(lambda args
|
||||
(show-version-and-exit "guix size")))))
|
||||
(show-version-and-exit "guix size")))
|
||||
%standard-native-build-options))
|
||||
|
||||
(define %default-options
|
||||
`((system . ,(%current-system))
|
||||
|
|
|
@ -40,6 +40,7 @@ (define-module (guix scripts weather)
|
|||
#:use-module (guix ci)
|
||||
#:use-module (guix sets)
|
||||
#:use-module (guix graph)
|
||||
#:use-module (guix scripts build)
|
||||
#:autoload (guix scripts graph) (%bag-node-type)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (web uri)
|
||||
|
@ -339,18 +340,18 @@ (define (show-help)
|
|||
COUNT dependents"))
|
||||
(display (G_ "
|
||||
--display-missing display the list of missing substitutes"))
|
||||
(display (G_ "
|
||||
-s, --system=SYSTEM consider substitutes for SYSTEM--e.g., \"i686-linux\""))
|
||||
(newline)
|
||||
(display (G_ "
|
||||
-h, --help display this help and exit"))
|
||||
(display (G_ "
|
||||
-V, --version display version information and exit"))
|
||||
(newline)
|
||||
(show-native-build-options-help)
|
||||
(newline)
|
||||
(show-bug-report-information))
|
||||
|
||||
(define %options
|
||||
(list (option '(#\h "help") #f #f
|
||||
(cons* (option '(#\h "help") #f #f
|
||||
(lambda args
|
||||
(show-help)
|
||||
(exit 0)))
|
||||
|
@ -380,9 +381,7 @@ (define %options
|
|||
(option '("display-missing") #f #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'display-missing? #t result)))
|
||||
(option '(#\s "system") #t #f
|
||||
(lambda (opt name arg result)
|
||||
(alist-cons 'system arg result)))))
|
||||
%standard-native-build-options))
|
||||
|
||||
(define %default-options
|
||||
`((substitute-urls . ,%default-substitute-urls)))
|
||||
|
|
Loading…
Reference in a new issue