GNU bug report logs -
#26987
guix pull without guile-ssh.
Previous Next
Full log
Message #20 received at 26987 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:
> * guix/build/pull.scm (depends-on-guile-ssh?): Remove.
> (all-scheme-files): Use "scheme-modules" to detect all loadable
> modules in given directory and rebuild a file list from those modules.
> ---
> guix/build/pull.scm | 31 ++++++++-----------------------
> 1 file changed, 8 insertions(+), 23 deletions(-)
>
> diff --git a/guix/build/pull.scm b/guix/build/pull.scm
> index d2e0404b1..e6ec71a54 100644
> --- a/guix/build/pull.scm
> +++ b/guix/build/pull.scm
> @@ -1,6 +1,7 @@
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2013, 2014, 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
> ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli <at> gmail.com>
> +;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -36,26 +37,14 @@
> ;;;
> ;;; 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<? a b))))))
> + (let ((modules (map module-name
> + ((@@ (guix discovery) scheme-modules) directory))))
> + (map (lambda (module)
> + (string-append directory "/"
> + (module-name->file-name module)))
> + modules)))
>
> (cond-expand
> (guile-2.2 (use-modules (language tree-il optimize)
> @@ -145,11 +134,7 @@ containing the source code. Write any debugging output to DEBUG-PORT."
> ;; Compile the .scm files. Load all the files before compiling them to
> ;; work around <http://bugs.gnu.org/15602> (FIXME).
> ;; Filter out files depending on Guile-SSH when Guile-SSH is missing.
> - (let* ((files (remove (if (false-if-exception
> - (resolve-interface '(ssh session)))
> - (const #f)
> - depends-on-guile-ssh?)
> - (all-scheme-files out)))
> + (let* ((files (all-scheme-files out))
> (total (length files)))
I think this patch does to thing: (1) fixing the bug at hand, and (2)
using (guix discovery).
For (1), I think this should work:
[Message part 2 (text/x-patch, inline)]
diff --git a/guix/build/pull.scm b/guix/build/pull.scm
index d2e0404b1..84629f6b0 100644
--- a/guix/build/pull.scm
+++ b/guix/build/pull.scm
@@ -39,10 +39,15 @@
(define (depends-on-guile-ssh? file)
"Return true if FILE is a Scheme source file that depends, directly or
indirectly, on Guile-SSH."
+ (let ((module (call-with-input-file file
+ (lambda (port)
+ (match (read port)
+ (('define-module name _ ...)
+ name))))))
(find (match-lambda
(('ssh _ ...) #t)
(_ #f))
- (source-module-closure file #:select? (const #t))))
+ (source-module-closure module #:select? (const #t)))))
(define (all-scheme-files directory)
"Return a sorted list of Scheme files found in DIRECTORY."
[Message part 3 (text/plain, inline)]
WDYT?
Ludo’.
This bug report was last modified 8 years and 47 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.