From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: (guix modules) and =?utf-8?Q?=E2=80=98source-module-closure?= =?utf-8?Q?=E2=80=99?= Date: Mon, 05 Sep 2016 00:24:41 +0200 Message-ID: <8760qbi9qu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgfqM-0005oE-1n for guix-devel@gnu.org; Sun, 04 Sep 2016 18:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgfqH-0006ij-Lh for guix-devel@gnu.org; Sun, 04 Sep 2016 18:24:48 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgfqH-0006id-I3 for guix-devel@gnu.org; Sun, 04 Sep 2016 18:24:45 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:53742 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1bgfqF-0002SP-NA for guix-devel@gnu.org; Sun, 04 Sep 2016 18:24:44 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel Hi! Commit 7ca87354db53fd1e1a7a3dfeddb9a598ea064bbe adds (guix module), which provides a way to compute the closure of a Scheme module by looking at its source code. This has to do with typical =E2=80=98with-imported-modules=E2=80=99 usage, = as explained in the manual: --8<---------------cut here---------------start------------->8--- Usually you want the _closure_ of the module to be imported=E2=80=94i.e.= , the module itself and all the modules it depends on=E2=80=94rather than just the module; failing to do that, attempts to use the module will fail because of missing dependent modules. The =E2=80=98source-module-closure=E2=80=99 = procedure computes the closure of a module by looking at its source file headers, which comes in handy in this case: (use-modules (guix modules)) ;for 'source-module-closure' (with-imported-modules (source-module-closure '((guix build utils) (gnu build vm))) (gexp->derivation "something-with-vms" #~(begin (use-modules (guix build utils) (gnu build vm)) ...))) --8<---------------cut here---------------end--------------->8--- The benefit can be seen in the next commit: http://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D239c6e276214813f59= f761c9dc5cc0e9d266b49b Comments welcome! Ludo=E2=80=99.