From 11415d35064cdba5cec1139aede18099cfa14547 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 5 Feb 2020 18:47:31 +0100 Subject: 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. --- guix/scripts/build.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'guix') 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 ;;; Copyright © 2013 Mark H Weaver +;;; Copyright © 2020 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -34,6 +35,7 @@ (define-module (guix scripts build) #: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 @@ (define (show-help) -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 @@ (define %options (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 @@ (define (ensure-list x) (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 @@ (define (ensure-list x) (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)) -- cgit v1.2.3