GNU bug report logs -
#39444
[PATCH] guix build: Add '--manifest' option.
Previous Next
Reported by: Marius Bakke <mbakke <at> fastmail.com>
Date: Wed, 5 Feb 2020 20:04:01 UTC
Severity: normal
Tags: patch
Done: Marius Bakke <mbakke <at> fastmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39444 in the body.
You can then email your comments to 39444 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#39444
; Package
guix-patches
.
(Wed, 05 Feb 2020 20:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Marius Bakke <mbakke <at> fastmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Wed, 05 Feb 2020 20:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* 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.
---
doc/guix.texi | 7 ++++++-
etc/completion/bash/guix | 2 +-
guix/scripts/build.scm | 19 +++++++++++++++++++
tests/guix-build.sh | 9 +++++++++
4 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 956c25ba9e..f25943789b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -46,7 +46,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@*
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 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019, 2020 Maxim Cournoyer@*
Copyright @copyright{} 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice@*
@@ -8427,6 +8427,11 @@ As an example, @var{file} might contain a package definition like this
@include package-hello.scm
@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}
@itemx -e @var{expr}
Build the package or derivation @var{expr} evaluates to.
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index edfb627e87..0333bfc8a2 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -178,7 +178,7 @@ _guix_complete ()
_guix_complete_installed_package "$word_at_point"
elif _guix_is_command "build"
then
- if _guix_is_dash_L
+ if _guix_is_dash_L || _guix_is_dash_m
then
_guix_complete_file
else
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index f054fc2bce..eedf6bf6a8 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo <at> gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2020 Marius Bakke <mbakke <at> fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -34,6 +35,7 @@
#:use-module (guix monads)
#:use-module (guix gexp)
+ #:use-module (guix profiles)
#:autoload (guix http-client) (http-fetch http-get-error?)
#:use-module (ice-9 format)
#: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
FILE evaluates to"))
(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"))
(display (G_ "
--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
(lambda (opt name 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
(lambda (opt name arg 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)
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
(('argument . (? string? spec))
(cond ((derivation-path? spec)
@@ -827,6 +843,9 @@ build---packages, gexps, derivations, and so on."
(list (specification->package spec)))))
(('file . file)
(ensure-list (load* file (make-user-module '()))))
+ (('manifest . manifest)
+ (manifest->packages
+ (load* manifest (make-user-module '((guix profiles) (gnu))))))
(('expression . str)
(ensure-list (read/eval str)))
(('argument . (? derivation? drv))
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 21b6af4395..c1df6db3a4 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -1,5 +1,6 @@
# GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo <at> gnu.org>
+# Copyright © 2020 Marius Bakke <mbakke <at> fastmail.com>
#
# This file is part of GNU Guix.
#
@@ -308,6 +309,14 @@ cat > "$module_dir/gexp.scm"<<EOF
EOF
guix build --file="$module_dir/gexp.scm" -d
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
# Using 'GUIX_BUILD_OPTIONS'.
--
2.25.0
Reply sent
to
Marius Bakke <mbakke <at> fastmail.com>
:
You have taken responsibility.
(Fri, 14 Feb 2020 16:54:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Marius Bakke <mbakke <at> fastmail.com>
:
bug acknowledged by developer.
(Fri, 14 Feb 2020 16:54:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 39444-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Marius Bakke <mbakke <at> fastmail.com> writes:
> * 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.
Pushed in 11415d35064cdba5cec1139aede18099cfa14547.
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#39444
; Package
guix-patches
.
(Fri, 14 Feb 2020 21:41:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 39444 <at> debbugs.gnu.org (full text, mbox):
Hi Marius,
Marius Bakke <mbakke <at> fastmail.com> skribis:
> * 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.
I’m late to the party but all I have to say is that it looks nice.
Good idea!
Thank you,
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 14 Mar 2020 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 93 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.