From patchwork Wed Feb 5 20:03:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marius Bakke X-Patchwork-Id: 20141 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 23140168DA; Wed, 5 Feb 2020 20:04:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 2E4C4168D1 for ; Wed, 5 Feb 2020 20:04:10 +0000 (GMT) Received: from localhost ([::1]:55780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izQu9-00010d-O7 for patchwork@mira.cbaines.net; Wed, 05 Feb 2020 15:04:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46320) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izQu3-00010T-Nn for guix-patches@gnu.org; Wed, 05 Feb 2020 15:04:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izQu2-000311-Bs for guix-patches@gnu.org; Wed, 05 Feb 2020 15:04:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40784) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izQu2-00030C-89 for guix-patches@gnu.org; Wed, 05 Feb 2020 15:04:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1izQu2-0006lM-4Q for guix-patches@gnu.org; Wed, 05 Feb 2020 15:04:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39444] [PATCH] guix build: Add '--manifest' option. Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 05 Feb 2020 20:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39444 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39444@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158093302725974 (code B ref -1); Wed, 05 Feb 2020 20:04:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2020 20:03:47 +0000 Received: from localhost ([127.0.0.1]:46757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1izQti-0006kn-QB for submit@debbugs.gnu.org; Wed, 05 Feb 2020 15:03:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:51838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1izQth-0006kg-Vb for submit@debbugs.gnu.org; Wed, 05 Feb 2020 15:03:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46079) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izQtg-0000xl-CE for guix-patches@gnu.org; Wed, 05 Feb 2020 15:03:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izQte-0001cz-Tr for guix-patches@gnu.org; Wed, 05 Feb 2020 15:03:40 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:58793) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1izQte-0001OX-Hd for guix-patches@gnu.org; Wed, 05 Feb 2020 15:03:38 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 36600781 for ; Wed, 5 Feb 2020 15:03:36 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 05 Feb 2020 15:03:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=fm2; bh=/BMW6YfQmeWU4qWGWrJhvunjZW 0gD/lAds1hBLVdN6M=; b=HPxg1vaGhPS3trgtuptjTXpQesEEOzzlZhLwbPwZqF JmuGFNAGdI2JVg8RFPCK3kYOiWkrzcmjZSMtof3O6cVsWr2T8x4iYa3Z1AMvMPq0 FmNZNqGGOuE81+gC4t36B8IdmcgJy9/mAXF4ecO04P3Ps1+lI45vy5Lmdc3hC2b2 WkMQbrxGELw8aehPpAOYbUpQ8X9aN2F7i1l5/8SS7BYeljYIibqv0zQeFAJ2DseU 5XBvvcAE2hswJKzTjfS7ogpVXmI5jEjzlOC+6p+sIOeULbu1qjqAL7RHVA6xPXUI JKSlUFzcSyaG/nDvfKN+b8gIZZeJET1x5G5l2GlyqP7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=/BMW6Y fQmeWU4qWGWrJhvunjZW0gD/lAds1hBLVdN6M=; b=Iq+bafOcw7WJusPJ0GKQNZ itk4Ak4gJMOMdFabPBpc3kNEopXF1dvMsbhOREJiP+vak40wAENw/nAF0zDx8Oai pUOF32+rplJuWxVCd3JLeoc/FMpOML2YzLIba8W4XtxjfavMuJno2ZMdrGbdHWD7 l1h+020zWYSstyAAUWR+u50gpkI1YnnK9KYirq/1QbX/6osl2vAhgIgXBfSPHuJf LE0v0aaN8OYNjCp1sz12zeAya/GqFH1pMeXl7eaA3YHxrzrMMpQ2kNU43Ff88T9o 7JEWheK2aoHgI6HHt17N+MvXe544jCsOGpGb7XPdiF1BE+8nMbTnwH5beB833HxQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrhedugdduvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofggtgfgsehtkeertd ertdejnecuhfhrohhmpeforghrihhushcuuegrkhhkvgcuoehmsggrkhhkvgesfhgrshht mhgrihhlrdgtohhmqeenucfkphepkeegrddvtddvrdeiledrvdehfeenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmsggrkhhkvgesfhgrshht mhgrihhlrdgtohhm X-ME-Proxy: Received: from localhost (ti0006q161-3035.bb.online.no [84.202.69.253]) by mail.messagingengine.com (Postfix) with ESMTPA id 62C9330606FB for ; Wed, 5 Feb 2020 15:03:35 -0500 (EST) From: Marius Bakke Date: Wed, 5 Feb 2020 21:03:33 +0100 Message-Id: <20200205200333.8309-1-mbakke@fastmail.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2013 Mark H Weaver +;;; Copyright © 2020 Marius Bakke ;;; ;;; 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 +# Copyright © 2020 Marius Bakke # # This file is part of GNU Guix. # @@ -308,6 +309,14 @@ cat > "$module_dir/gexp.scm"< "$module_dir/manifest.scm"<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'.