From 838ba73d6e49bd2b1f2d4ed9329b65cc4e8c1f54 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 9 May 2017 17:04:02 +0200 Subject: pull: Build with the matching Guile major version. Previously, 'guix pull' would always build with Guile 2.0. Now it builds with the Guile that matches (effective-version). * build-aux/build-self.scm (false-if-wrong-guile) (package-for-current-guile): New procedures. (guile-json, guile-ssh): Use it. (guile-for-build): New procedure. (build): Use (effective-version) instead of the hard-coded "/2.0". Add (guix modules) closure to #:modules argument. Pass \#:guile-for-build argument to 'gexp->derivation'. * guix/build/pull.scm (depends-on-guile-ssh?, all-scheme-files): New procedures. (build-guix): Show the output of (version). Use the above procedures. Filter out files that match 'depends-on-guile-ssh?' when (ssh session) is missing. --- guix/build/pull.scm | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'guix/build/pull.scm') diff --git a/guix/build/pull.scm b/guix/build/pull.scm index 6034e93cbf..6825e74092 100644 --- a/guix/build/pull.scm +++ b/guix/build/pull.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2016 Ludovic Courtès +;;; Copyright © 2013, 2014, 2016, 2017 Ludovic Courtès ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; ;;; This file is part of GNU Guix. @@ -18,6 +18,7 @@ ;;; along with GNU Guix. If not, see . (define-module (guix build pull) + #:use-module (guix modules) #:use-module (guix build utils) #:use-module (system base compile) #:use-module (ice-9 ftw) @@ -35,6 +36,27 @@ ;;; ;;; Code: +(define (depends-on-guile-ssh? file) + "Return true if FILE is a Scheme source file that depends, directly or +indirectly, on Guile-SSH." + (find (match-lambda + (('ssh _ ...) #t) + (_ #f)) + (source-module-closure file #:select? (const #t)))) + +(define (all-scheme-files directory) + "Return a sorted list of Scheme files found in DIRECTORY." + ;; Load guix/ modules before gnu/ modules to get somewhat steadier + ;; progress reporting. + (sort (filter (cut string-suffix? ".scm" <>) + (find-files directory "\\.scm")) + (let ((guix (string-append directory "/guix")) + (gnu (string-append directory "/gnu"))) + (lambda (a b) + (or (and (string-prefix? guix a) + (string-prefix? gnu b)) + (string (FIXME). - (let* ((files - ;; Load guix/ modules before gnu/ modules to get somewhat steadier - ;; progress reporting. - (sort (filter (cut string-suffix? ".scm" <>) - (find-files out "\\.scm")) - (let ((guix (string-append out "/guix")) - (gnu (string-append out "/gnu"))) - (lambda (a b) - (or (and (string-prefix? guix a) - (string-prefix? gnu b)) - (string