guix build: Add '--manifest' option.
* guix/scripts/build.scm (show-help): Document --manifest argument. (options->things-to-build): When given a manifest, evaluate all the entries. * tests/guix-build.sh: Add test for --manifest. * doc/guix.texi (Additional Build Options): Mention --manifest. * etc/completion/bash/guix: Complete file name if 'guix build' argument is -m.
This commit is contained in:
parent
a74e23188f
commit
11415d3506
4 changed files with 35 additions and 2 deletions
|
@ -46,7 +46,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
|
||||||
Copyright @copyright{} 2017 Thomas Danckaert@*
|
Copyright @copyright{} 2017 Thomas Danckaert@*
|
||||||
Copyright @copyright{} 2017 humanitiesNerd@*
|
Copyright @copyright{} 2017 humanitiesNerd@*
|
||||||
Copyright @copyright{} 2017 Christopher Allan Webber@*
|
Copyright @copyright{} 2017 Christopher Allan Webber@*
|
||||||
Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@*
|
Copyright @copyright{} 2017, 2018, 2019, 2020 Marius Bakke@*
|
||||||
Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
|
Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
|
||||||
Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@*
|
Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@*
|
||||||
Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@*
|
Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@*
|
||||||
|
@ -8456,6 +8456,11 @@ As an example, @var{file} might contain a package definition like this
|
||||||
@include package-hello.scm
|
@include package-hello.scm
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@item --manifest=@var{manifest}
|
||||||
|
@itemx -m @var{manifest}
|
||||||
|
Build all packages listed in the given @var{manifest}
|
||||||
|
(@pxref{profile-manifest, @option{--manifest}}).
|
||||||
|
|
||||||
@item --expression=@var{expr}
|
@item --expression=@var{expr}
|
||||||
@itemx -e @var{expr}
|
@itemx -e @var{expr}
|
||||||
Build the package or derivation @var{expr} evaluates to.
|
Build the package or derivation @var{expr} evaluates to.
|
||||||
|
|
|
@ -178,7 +178,7 @@ _guix_complete ()
|
||||||
_guix_complete_installed_package "$word_at_point"
|
_guix_complete_installed_package "$word_at_point"
|
||||||
elif _guix_is_command "build"
|
elif _guix_is_command "build"
|
||||||
then
|
then
|
||||||
if _guix_is_dash_L
|
if _guix_is_dash_L || _guix_is_dash_m
|
||||||
then
|
then
|
||||||
_guix_complete_file
|
_guix_complete_file
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
|
||||||
|
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
|
|
||||||
#:use-module (guix monads)
|
#:use-module (guix monads)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (guix profiles)
|
||||||
#:autoload (guix http-client) (http-fetch http-get-error?)
|
#:autoload (guix http-client) (http-fetch http-get-error?)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
@ -680,6 +682,9 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
|
||||||
-f, --file=FILE build the package or derivation that the code within
|
-f, --file=FILE build the package or derivation that the code within
|
||||||
FILE evaluates to"))
|
FILE evaluates to"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
|
-m, --manifest=FILE build the packages that the manifest given in FILE
|
||||||
|
evaluates to"))
|
||||||
|
(display (G_ "
|
||||||
-S, --source build the packages' source derivations"))
|
-S, --source build the packages' source derivations"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--sources[=TYPE] build source derivations; TYPE may optionally be one
|
--sources[=TYPE] build source derivations; TYPE may optionally be one
|
||||||
|
@ -768,6 +773,9 @@ must be one of 'package', 'all', or 'transitive'~%")
|
||||||
(option '(#\f "file") #t #f
|
(option '(#\f "file") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'file arg result)))
|
(alist-cons 'file arg result)))
|
||||||
|
(option '(#\m "manifest") #t #f
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(alist-cons 'manifest arg result)))
|
||||||
(option '(#\n "dry-run") #f #f
|
(option '(#\n "dry-run") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
|
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
|
||||||
|
@ -804,6 +812,14 @@ build---packages, gexps, derivations, and so on."
|
||||||
(for-each validate-type lst)
|
(for-each validate-type lst)
|
||||||
lst))
|
lst))
|
||||||
|
|
||||||
|
;; Note: Taken from (guix scripts refresh).
|
||||||
|
(define (manifest->packages manifest)
|
||||||
|
"Return the list of packages in MANIFEST."
|
||||||
|
(filter-map (lambda (entry)
|
||||||
|
(let ((item (manifest-entry-item entry)))
|
||||||
|
(if (package? item) item #f)))
|
||||||
|
(manifest-entries manifest)))
|
||||||
|
|
||||||
(append-map (match-lambda
|
(append-map (match-lambda
|
||||||
(('argument . (? string? spec))
|
(('argument . (? string? spec))
|
||||||
(cond ((derivation-path? spec)
|
(cond ((derivation-path? spec)
|
||||||
|
@ -827,6 +843,9 @@ build---packages, gexps, derivations, and so on."
|
||||||
(list (specification->package spec)))))
|
(list (specification->package spec)))))
|
||||||
(('file . file)
|
(('file . file)
|
||||||
(ensure-list (load* file (make-user-module '()))))
|
(ensure-list (load* file (make-user-module '()))))
|
||||||
|
(('manifest . manifest)
|
||||||
|
(manifest->packages
|
||||||
|
(load* manifest (make-user-module '((guix profiles) (gnu))))))
|
||||||
(('expression . str)
|
(('expression . str)
|
||||||
(ensure-list (read/eval str)))
|
(ensure-list (read/eval str)))
|
||||||
(('argument . (? derivation? drv))
|
(('argument . (? derivation? drv))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# GNU Guix --- Functional package management for GNU
|
# GNU Guix --- Functional package management for GNU
|
||||||
# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
|
# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
#
|
#
|
||||||
# This file is part of GNU Guix.
|
# This file is part of GNU Guix.
|
||||||
#
|
#
|
||||||
|
@ -308,6 +309,14 @@ cat > "$module_dir/gexp.scm"<<EOF
|
||||||
EOF
|
EOF
|
||||||
guix build --file="$module_dir/gexp.scm" -d
|
guix build --file="$module_dir/gexp.scm" -d
|
||||||
guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
|
guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
|
||||||
|
|
||||||
|
# Building from a manifest file.
|
||||||
|
cat > "$module_dir/manifest.scm"<<EOF
|
||||||
|
(specifications->manifest '("hello" "guix"))
|
||||||
|
EOF
|
||||||
|
test `guix build -d --manifest="$module_dir/manifest.scm" \
|
||||||
|
| grep -e '-hello-' -e '-guix-' \
|
||||||
|
| wc -l` -eq 2
|
||||||
rm "$module_dir"/*.scm
|
rm "$module_dir"/*.scm
|
||||||
|
|
||||||
# Using 'GUIX_BUILD_OPTIONS'.
|
# Using 'GUIX_BUILD_OPTIONS'.
|
||||||
|
|
Reference in a new issue