From patchwork Mon Jan 7 10:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 694 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 595CD16A29; Mon, 7 Jan 2019 10:50:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id C70E816A27 for ; Mon, 7 Jan 2019 10:50:18 +0000 (GMT) Received: from localhost ([127.0.0.1]:32918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggSU6-0007yH-D9 for patchwork@mira.cbaines.net; Mon, 07 Jan 2019 05:50:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggSTu-0007xt-4V for guix-patches@gnu.org; Mon, 07 Jan 2019 05:50:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggSTr-0002rS-PO for guix-patches@gnu.org; Mon, 07 Jan 2019 05:50:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:48399) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggSTr-0002rM-LY for guix-patches@gnu.org; Mon, 07 Jan 2019 05:50:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ggSTr-0004J5-IO for guix-patches@gnu.org; Mon, 07 Jan 2019 05:50:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#34007] [PATCH 5/5] self: Drop support for Guix < 0.15 on Guile 2.0. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 07 Jan 2019 10:50:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34007 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34007@debbugs.gnu.org Received: via spool by 34007-submit@debbugs.gnu.org id=B34007.154685815416463 (code B ref 34007); Mon, 07 Jan 2019 10:50:03 +0000 Received: (at 34007) by debbugs.gnu.org; 7 Jan 2019 10:49:14 +0000 Received: from localhost ([127.0.0.1]:47675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggST3-0004HN-VR for submit@debbugs.gnu.org; Mon, 07 Jan 2019 05:49:14 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:60146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggSSx-0004Gk-7d for 34007@debbugs.gnu.org; Mon, 07 Jan 2019 05:49:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9151BE1E; Mon, 7 Jan 2019 11:49:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JIC_Njak5WQj; Mon, 7 Jan 2019 11:49:05 +0100 (CET) Received: from gnu.org (unknown [IPv6:2001:660:6102:320:e120:2c8f:8909:cdfe]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 9EC8BED1; Mon, 7 Jan 2019 11:49:03 +0100 (CET) From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 7 Jan 2019 11:48:57 +0100 Message-Id: <20190107104857.6456-5-ludo@gnu.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104857.6456-1-ludo@gnu.org> References: <20190107104857.6456-1-ludo@gnu.org> MIME-Version: 1.0 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/self.scm (false-if-wrong-guile, package-for-guile): Remove. (specification->package): Remove "guile2.0-" variants. (compiled-guix): #:guile-for-build defaults to (default-guile). Use 'specification->package' instead of 'package-for-guile'. (guile-for-build): Remove. (guix-derivation): Use 'default-guile' instead of 'guile-for-build'. Check whether we're running on Guile 2.0 with PULL-VERSION < 1. --- guix/self.scm | 89 +++++++++++---------------------------------------- 1 file changed, 19 insertions(+), 70 deletions(-) diff --git a/guix/self.scm b/guix/self.scm index 4e97cb7e98..c2ee5254f5 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -31,6 +31,7 @@ #:use-module ((guix build compile) #:select (%lightweight-optimizations)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (srfi srfi-35) #:use-module (ice-9 match) #:export (make-config.scm whole-package ;for internal use in 'guix pull' @@ -43,35 +44,6 @@ ;;; Dependency handling. ;;; -(define* (false-if-wrong-guile package - #:optional (guile-version (effective-version))) - "Return #f if PACKAGE depends on the \"wrong\" major version of Guile (e.g., -2.0 instead of 2.2), otherwise return PACKAGE." - (let ((guile (any (match-lambda - ((label (? package? dep) _ ...) - (and (string=? (package-name dep) "guile") - dep))) - (package-direct-inputs package)))) - (and (or (not guile) - (string-prefix? guile-version - (package-version guile))) - package))) - -(define (package-for-guile guile-version . names) - "Return the package with one of the given NAMES that depends on -GUILE-VERSION (\"2.0\" or \"2.2\"), or #f if none of the packages matches." - (let loop ((names names)) - (match names - (() - #f) - ((name rest ...) - (match (specification->package name) - (#f - (loop rest)) - ((? package? package) - (or (false-if-wrong-guile package guile-version) - (loop rest)))))))) - (define specification->package ;; Use our own variant of that procedure because that of (gnu packages) ;; would traverse all the .scm files, which is wasteful. @@ -89,12 +61,7 @@ GUILE-VERSION (\"2.0\" or \"2.2\"), or #f if none of the packages matches." ("gzip" (ref '(gnu packages compression) 'gzip)) ("bzip2" (ref '(gnu packages compression) 'bzip2)) ("xz" (ref '(gnu packages compression) 'xz)) - ("guile2.0-json" (ref '(gnu packages guile) 'guile2.0-json)) - ("guile2.0-ssh" (ref '(gnu packages ssh) 'guile2.0-ssh)) - ("guile2.0-git" (ref '(gnu packages guile) 'guile2.0-git)) - ;; XXX: No "guile2.0-sqlite3". - ("guile2.0-gnutls" (ref '(gnu packages tls) 'gnutls/guile-2.0)) - (_ #f)))) ;no such package + (_ #f)))) ;no such package ;;; @@ -488,7 +455,7 @@ assumed to be part of MODULES." (pull-version 1) (name (string-append "guix-" version)) (guile-version (effective-version)) - (guile-for-build (guile-for-build guile-version)) + (guile-for-build (default-guile)) (zlib (specification->package "zlib")) (gzip (specification->package "gzip")) (bzip2 (specification->package "bzip2")) @@ -496,32 +463,22 @@ assumed to be part of MODULES." (guix (specification->package "guix"))) "Return a file-like object that contains a compiled Guix." (define guile-json - (package-for-guile guile-version - "guile-json" - "guile2.0-json")) + (specification->package "guile-json")) (define guile-ssh - (package-for-guile guile-version - "guile-ssh" - "guile2.0-ssh")) + (specification->package "guile-ssh")) (define guile-git - (package-for-guile guile-version - "guile-git" - "guile2.0-git")) + (specification->package "guile-git")) (define guile-sqlite3 - (package-for-guile guile-version - "guile-sqlite3" - "guile2.0-sqlite3")) + (specification->package "guile-sqlite3")) (define guile-gcrypt - (package-for-guile guile-version - "guile-gcrypt")) + (specification->package "guile-gcrypt")) (define gnutls - (package-for-guile guile-version - "gnutls" "guile2.0-gnutls")) + (specification->package "gnutls")) (define dependencies (match (append-map (lambda (package) @@ -912,21 +869,6 @@ containing MODULE-FILES and possibly other files as well." ;;; Building. ;;; -(define (guile-for-build version) - "Return a derivation for Guile 2.0 or 2.2, whichever matches the currently -running Guile." - (define canonical-package ;soft reference - (module-ref (resolve-interface '(gnu packages base)) - 'canonical-package)) - - (match version - ("2.2" - (canonical-package (module-ref (resolve-interface '(gnu packages guile)) - 'guile-2.2))) - ("2.0" - (module-ref (resolve-interface '(gnu packages guile)) - 'guile-2.0)))) - (define* (guix-derivation source version #:optional (guile-version (effective-version)) #:key (pull-version 0)) @@ -943,9 +885,16 @@ is not supported." (define guile ;; When PULL-VERSION >= 1, produce a self-contained Guix and use Guile 2.2 ;; unconditionally. - (guile-for-build (if (>= pull-version 1) - "2.2" - guile-version))) + (default-guile)) + + (when (and (< pull-version 1) + (not (string=? (package-version guile) guile-version))) + ;; Guix < 0.15.0 has PULL-VERSION = 0, where the host Guile is reused and + ;; can be any version. When that happens and Guile is not current (e.g., + ;; it's Guile 2.0), just bail out. + (raise (condition + (&message + (message "Guix is too old and cannot be upgraded"))))) (mbegin %store-monad (set-guile-for-build guile)