summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi7
-rw-r--r--etc/completion/bash/guix2
-rw-r--r--guix/scripts/build.scm19
-rw-r--r--tests/guix-build.sh9
4 files changed, 35 insertions, 2 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 42d7cfa2e83..282f9578bf7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -46,7 +46,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
46Copyright @copyright{} 2017 Thomas Danckaert@* 46Copyright @copyright{} 2017 Thomas Danckaert@*
47Copyright @copyright{} 2017 humanitiesNerd@* 47Copyright @copyright{} 2017 humanitiesNerd@*
48Copyright @copyright{} 2017 Christopher Allan Webber@* 48Copyright @copyright{} 2017 Christopher Allan Webber@*
49Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@* 49Copyright @copyright{} 2017, 2018, 2019, 2020 Marius Bakke@*
50Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@* 50Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
51Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@* 51Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@*
52Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@* 52Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@*
@@ -8456,6 +8456,11 @@ As an example, @var{file} might contain a package definition like this
8456@include package-hello.scm 8456@include package-hello.scm
8457@end lisp 8457@end lisp
8458 8458
8459@item --manifest=@var{manifest}
8460@itemx -m @var{manifest}
8461Build all packages listed in the given @var{manifest}
8462(@pxref{profile-manifest, @option{--manifest}}).
8463
8459@item --expression=@var{expr} 8464@item --expression=@var{expr}
8460@itemx -e @var{expr} 8465@itemx -e @var{expr}
8461Build the package or derivation @var{expr} evaluates to. 8466Build the package or derivation @var{expr} evaluates to.
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index edfb627e876..0333bfc8a2c 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -178,7 +178,7 @@ _guix_complete ()
178 _guix_complete_installed_package "$word_at_point" 178 _guix_complete_installed_package "$word_at_point"
179 elif _guix_is_command "build" 179 elif _guix_is_command "build"
180 then 180 then
181 if _guix_is_dash_L 181 if _guix_is_dash_L || _guix_is_dash_m
182 then 182 then
183 _guix_complete_file 183 _guix_complete_file
184 else 184 else
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index f054fc2bce8..eedf6bf6a8d 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> 3;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
4;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -34,6 +35,7 @@
34 35
35 #:use-module (guix monads) 36 #:use-module (guix monads)
36 #:use-module (guix gexp) 37 #:use-module (guix gexp)
38 #:use-module (guix profiles)
37 #:autoload (guix http-client) (http-fetch http-get-error?) 39 #:autoload (guix http-client) (http-fetch http-get-error?)
38 #:use-module (ice-9 format) 40 #:use-module (ice-9 format)
39 #:use-module (ice-9 match) 41 #:use-module (ice-9 match)
@@ -680,6 +682,9 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
680 -f, --file=FILE build the package or derivation that the code within 682 -f, --file=FILE build the package or derivation that the code within
681 FILE evaluates to")) 683 FILE evaluates to"))
682 (display (G_ " 684 (display (G_ "
685 -m, --manifest=FILE build the packages that the manifest given in FILE
686 evaluates to"))
687 (display (G_ "
683 -S, --source build the packages' source derivations")) 688 -S, --source build the packages' source derivations"))
684 (display (G_ " 689 (display (G_ "
685 --sources[=TYPE] build source derivations; TYPE may optionally be one 690 --sources[=TYPE] build source derivations; TYPE may optionally be one
@@ -768,6 +773,9 @@ must be one of 'package', 'all', or 'transitive'~%")
768 (option '(#\f "file") #t #f 773 (option '(#\f "file") #t #f
769 (lambda (opt name arg result) 774 (lambda (opt name arg result)
770 (alist-cons 'file arg result))) 775 (alist-cons 'file arg result)))
776 (option '(#\m "manifest") #t #f
777 (lambda (opt name arg result)
778 (alist-cons 'manifest arg result)))
771 (option '(#\n "dry-run") #f #f 779 (option '(#\n "dry-run") #f #f
772 (lambda (opt name arg result) 780 (lambda (opt name arg result)
773 (alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) 781 (alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
@@ -804,6 +812,14 @@ build---packages, gexps, derivations, and so on."
804 (for-each validate-type lst) 812 (for-each validate-type lst)
805 lst)) 813 lst))
806 814
815 ;; Note: Taken from (guix scripts refresh).
816 (define (manifest->packages manifest)
817 "Return the list of packages in MANIFEST."
818 (filter-map (lambda (entry)
819 (let ((item (manifest-entry-item entry)))
820 (if (package? item) item #f)))
821 (manifest-entries manifest)))
822
807 (append-map (match-lambda 823 (append-map (match-lambda
808 (('argument . (? string? spec)) 824 (('argument . (? string? spec))
809 (cond ((derivation-path? spec) 825 (cond ((derivation-path? spec)
@@ -827,6 +843,9 @@ build---packages, gexps, derivations, and so on."
827 (list (specification->package spec))))) 843 (list (specification->package spec)))))
828 (('file . file) 844 (('file . file)
829 (ensure-list (load* file (make-user-module '())))) 845 (ensure-list (load* file (make-user-module '()))))
846 (('manifest . manifest)
847 (manifest->packages
848 (load* manifest (make-user-module '((guix profiles) (gnu))))))
830 (('expression . str) 849 (('expression . str)
831 (ensure-list (read/eval str))) 850 (ensure-list (read/eval str)))
832 (('argument . (? derivation? drv)) 851 (('argument . (? derivation? drv))
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 21b6af43953..c1df6db3a47 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -1,5 +1,6 @@
1# GNU Guix --- Functional package management for GNU 1# GNU Guix --- Functional package management for GNU
2# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> 2# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
3# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
3# 4#
4# This file is part of GNU Guix. 5# This file is part of GNU Guix.
5# 6#
@@ -308,6 +309,14 @@ cat > "$module_dir/gexp.scm"<<EOF
308EOF 309EOF
309guix build --file="$module_dir/gexp.scm" -d 310guix build --file="$module_dir/gexp.scm" -d
310guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv' 311guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
312
313# Building from a manifest file.
314cat > "$module_dir/manifest.scm"<<EOF
315(specifications->manifest '("hello" "guix"))
316EOF
317test `guix build -d --manifest="$module_dir/manifest.scm" \
318 | grep -e '-hello-' -e '-guix-' \
319 | wc -l` -eq 2
311rm "$module_dir"/*.scm 320rm "$module_dir"/*.scm
312 321
313# Using 'GUIX_BUILD_OPTIONS'. 322# Using 'GUIX_BUILD_OPTIONS'.