From: "Ludovic Courtès" <ludo@gnu.org>
To: 34007@debbugs.gnu.org
Subject: [bug#34007] [PATCH 5/5] self: Drop support for Guix < 0.15 on Guile 2.0.
Date: Mon, 7 Jan 2019 11:48:57 +0100 [thread overview]
Message-ID: <20190107104857.6456-5-ludo@gnu.org> (raw)
In-Reply-To: <20190107104857.6456-1-ludo@gnu.org>
* 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
\f
;;;
@@ -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)
--
2.20.1
next prev parent reply other threads:[~2019-01-07 10:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 10:47 [bug#34007] [PATCH 0/5] Drop Guile 2.0 support Ludovic Courtès
2019-01-07 10:48 ` [bug#34007] [PATCH 1/5] build: Require Guile 2.2 Ludovic Courtès
2019-01-07 10:48 ` [bug#34007] [PATCH 2/5] maint: Remove 'cond-expand' forms for Guile 2.0 Ludovic Courtès
2019-01-07 10:48 ` [bug#34007] [PATCH 3/5] download: Remove Guile 2.0 workaround Ludovic Courtès
2019-01-07 10:48 ` [bug#34007] [PATCH 4/5] Remove most uses of the _IO*F constants Ludovic Courtès
2019-01-07 10:48 ` Ludovic Courtès [this message]
2019-01-09 14:44 ` bug#34007: [PATCH 0/5] Drop Guile 2.0 support Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190107104857.6456-5-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=34007@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).