From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#26987: [PATCH 2/2] build: pull: Fix compilation list construction. Date: Fri, 19 May 2017 14:58:48 +0200 Message-ID: <87o9updmuv.fsf@gnu.org> References: <20170519075623.13836-1-m.othacehe@gmail.com> <20170519075623.13836-3-m.othacehe@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBhVn-0000xK-28 for bug-guix@gnu.org; Fri, 19 May 2017 09:00:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBhVj-0000Gu-68 for bug-guix@gnu.org; Fri, 19 May 2017 09:00:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:51888) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBhVj-0000Gq-1v for bug-guix@gnu.org; Fri, 19 May 2017 09:00:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dBhVi-000132-Qi for bug-guix@gnu.org; Fri, 19 May 2017 09:00:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20170519075623.13836-3-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Fri, 19 May 2017 09:56:23 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Mathieu Othacehe Cc: 26987@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mathieu Othacehe 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 =C2=A9 2013, 2014, 2016, 2017 Ludovic Court=C3=A8s > ;;; Copyright =C2=A9 2015 Taylan Ulrich Bay=C4=B1rl=C4=B1/Kammer > +;;; Copyright =C2=A9 2017 Mathieu Othacehe > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -36,26 +37,14 @@ > ;;; > ;;; Code: >=20=20 > -(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 + (let ((modules (map module-name > + ((@@ (guix discovery) scheme-modules) directory)))) > + (map (lambda (module) > + (string-append directory "/" > + (module-name->file-name module))) > + modules))) >=20=20 > (cond-expand > (guile-2.2 (use-modules (language tree-il optimize) > @@ -145,11 +134,7 @@ containing the source code. Write any debugging out= put to DEBUG-PORT." > ;; Compile the .scm files. Load all the files before compiling them= to > ;; work around (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: --=-=-= Content-Type: text/x-patch Content-Disposition: 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." --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpXRFlUPw0KDQpMdWRv4oCZLg0K --=-=-=--