all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe@gmail.com>
Cc: 26987@debbugs.gnu.org
Subject: bug#26987: [PATCH 2/2] build: pull: Fix compilation list construction.
Date: Fri, 19 May 2017 14:58:48 +0200	[thread overview]
Message-ID: <87o9updmuv.fsf@gnu.org> (raw)
In-Reply-To: <20170519075623.13836-3-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Fri, 19 May 2017 09:56:23 +0200")

[-- Attachment #1: Type: text/plain, Size: 2993 bytes --]

Mathieu Othacehe <m.othacehe@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@gnu.org>
>  ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
> +;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 812 bytes --]

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."

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


WDYT?

Ludo’.

  reply	other threads:[~2017-05-19 13:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 19:53 bug#26987: guix pull without guile-ssh Mathieu Othacehe
2017-05-19  7:56 ` bug#26987: [PATCH 0/2] Fix compilation list construction Mathieu Othacehe
2017-05-19  7:56   ` bug#26987: [PATCH 1/2] guix: modules: Export module-name->file-name Mathieu Othacehe
2017-05-19  8:18     ` Ludovic Courtès
2017-05-19  7:56   ` bug#26987: [PATCH 2/2] build: pull: Fix compilation list construction Mathieu Othacehe
2017-05-19 12:58     ` Ludovic Courtès [this message]
2017-05-19 13:55       ` Mathieu Othacehe
2017-05-19 14:26         ` Mathieu Othacehe
2017-05-19 15:41           ` Ludovic Courtès
2017-05-25 12:33           ` Ludovic Courtès
2017-06-02  9:16             ` Mathieu Othacehe
2017-06-02 15:09               ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9updmuv.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=26987@debbugs.gnu.org \
    --cc=m.othacehe@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.