From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:55567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gihzZ-0004xI-JV for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gihzY-0004oO-HK for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gihzY-0004oI-EK for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gihzY-0008O8-Bm for guix-patches@gnu.org; Sun, 13 Jan 2019 10:48:04 -0500 Subject: [bug#34060] [PATCH 06/10] pull: Build profile with 'channel-instances->derivation'. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sun, 13 Jan 2019 16:47:29 +0100 Message-Id: <20190113154733.29737-6-ludo@gnu.org> In-Reply-To: <20190113154733.29737-1-ludo@gnu.org> References: <20190113154733.29737-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 34060@debbugs.gnu.org * guix/scripts/package.scm (build-and-use-profile): Rename 'manifest' to 'manifest-or-derivation' and allow it to be a derivation. * guix/scripts/pull.scm (build-and-install): Use 'channel-instances->derivation' instead of 'channel-instances->manifest'. --- guix/scripts/package.scm | 41 ++++++++++++++++++++++------------------ guix/scripts/pull.scm | 4 ++-- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 872a7303fc..4f483ac141 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -118,24 +118,27 @@ denote ranges as interpreted by 'matching-generations'." (else (leave (G_ "invalid syntax: ~a~%") pattern))))) -(define* (build-and-use-profile store profile manifest +(define* (build-and-use-profile store profile manifest-or-derivation #:key allow-collisions? bootstrap? use-substitutes? dry-run?) "Build a new generation of PROFILE, a file name, using the packages -specified in MANIFEST, a manifest object. When ALLOW-COLLISIONS? is true, -do not treat collisions in MANIFEST as an error." +specified in MANIFEST-OR-DERIVATION, a manifest object or a profile +derivation. When ALLOW-COLLISIONS? is true, do not treat collisions in +MANIFEST-OR-DERIVATION as an error." (when (equal? profile %current-profile) (ensure-default-profile)) - (let* ((prof-drv (run-with-store store - (profile-derivation manifest - #:allow-collisions? allow-collisions? - #:hooks (if bootstrap? - '() - %default-profile-hooks) - #:locales? (not bootstrap?)))) + (let* ((prof-drv (if (derivation? manifest-or-derivation) + manifest-or-derivation + (run-with-store store + (profile-derivation manifest-or-derivation + #:allow-collisions? allow-collisions? + #:hooks (if bootstrap? + '() + %default-profile-hooks) + #:locales? (not bootstrap?))))) (prof (derivation->output-path prof-drv))) (show-what-to-build store (list prof-drv) #:use-substitutes? use-substitutes? @@ -153,18 +156,20 @@ do not treat collisions in MANIFEST as an error." ;; overwriting a "previous future generation". (name (generation-file-name profile (+ 1 number)))) (and (build-derivations store (list prof-drv)) - (let* ((entries (manifest-entries manifest)) - (count (length entries))) + (let* ((entries (and (manifest? manifest-or-derivation) + (manifest-entries manifest-or-derivation))) + (count (and entries (length entries)))) (switch-symlinks name prof) (switch-symlinks profile (basename name)) (unless (string=? profile %current-profile) (register-gc-root store name)) - (format #t (N_ "~a package in profile~%" - "~a packages in profile~%" - count) - count) - (display-search-paths entries (list profile) - #:kind 'prefix))) + (when count + (format #t (N_ "~a package in profile~%" + "~a packages in profile~%" + count) + count) + (display-search-paths entries (list profile) + #:kind 'prefix)))) (warn-about-disk-space profile)))))) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 6d1914f7c2..ce3d24a7f7 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -186,9 +186,9 @@ true, display what would be built without actually building it." (define update-profile (store-lift build-and-use-profile)) - (mlet %store-monad ((manifest (channel-instances->manifest instances))) + (mlet %store-monad ((drv (channel-instances->derivation instances))) (mbegin %store-monad - (update-profile profile manifest + (update-profile profile drv #:dry-run? dry-run?) (munless dry-run? (return (display-profile-news profile)))))) -- 2.20.1