Commit Graph

10 Commits

Author SHA1 Message Date
Ludovic Courtès 1d90e9d7c9
discovery: Add 'fold-module-public-variables*'.
* guix/discovery.scm (fold-module-public-variables*): New procedure.
2019-01-15 20:24:09 +01:00
Ludovic Courtès 02fa1d251c
discovery: Add 'scheme-modules*'.
* guix/self.scm (scheme-modules*): Move to...
* guix/discovery.scm (scheme-modules*): ... here.  New procedure.  Make
'sub-directory' an optional parameter.
2018-09-02 16:43:10 +02:00
Ludovic Courtès 3c0128b035
discovery: Remove dependency on (guix ui).
This reduces the closure of (guix discovery) from 28 to 8 modules.

* guix/discovery.scm (scheme-files): Use 'format' instead of 'warning'.
(scheme-modules): Add #:warn parameter.  Use it instead of
'warn-about-load-error'.
(fold-modules): Add #:warn and pass it to 'scheme-modules'.
(all-modules): Likewise.
* gnu/bootloader.scm (bootloader-modules): Pass #:warn to 'all-modules'.
* gnu/packages.scm (fold-packages): Likewise.
* gnu/services.scm (all-service-modules): Likewise.
* guix/upstream.scm (importer-modules): Likewise.
2018-04-08 17:48:33 +02:00
Ludovic Courtès eaae07ec28
Add (guix self).
* guix/self.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm (%distro-root-directory): Rewrite to try different
directories.
* guix/discovery.scm (guix): Export 'scheme-files'.
2018-04-08 17:41:08 +02:00
Ludovic Courtès 7a51c78c6e
discovery: Move 'file-name->module-name' to (guix modules).
* guix/discovery.scm (file-name->module-name): Move to...
* guix/modules.scm (file-name->module-name): ... here.
* guix/build/compile.scm: Use (guix modules) instead of (guix discovery).
2017-10-22 22:09:00 -07:00
Ludovic Courtès 2890ad332f
build: Factorize module compilation in (guix build compile).
* guix/build/compile.scm: New file.
* Makefile.am (MODULES): Add it.
* build-aux/compile-all.scm: Use it.
(warnings, file->module, load-module-file)
(%default-optimizations, %lightweight-optimizations)
(optimization-options, compile-file*): Remove.
<top level>: Use 'compile-files'.
* guix/build/pull.scm (%default-optimizations)
(%lightweight-optimizations, optimization-options): Remove.
(build-guix): Rewrite as a call to 'compile-files'.
* guix/discovery.scm (file-name->module-name): Export.
2017-10-22 22:09:00 -07:00
Ludovic Courtès 960c6ce96d
discovery: Recurse into directories pointed to by a symlink.
Reported by Christopher Baines <mail@cbaines.net>
and Alex Kost <alezost@gmail.com>
at <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00290.html>.

* guix/discovery.scm (scheme-files): When ENTRY is a symlink that
doesn't end in '.scm', call 'stat' and recurse if it points to a
directory.
* tests/discovery.scm ("scheme-modules recurses in symlinks to
directories"): New test.
2017-07-03 23:51:23 +02:00
Ludovic Courtès d46c4423f4
discovery: 'scheme-files' returns '() for a non-accessible directory.
Fixes a regression introduced in
d27cc3bfaa.

Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/discovery.scm (scheme-files): Catch 'scandir*' system errors.
Return '() and optionally raise a warning upon 'system-error'.
* tests/discovery.scm ("scheme-modules, non-existent directory"): New
test.
2017-06-18 00:14:07 +02:00
Ludovic Courtès d27cc3bfaa
discovery: Rewrite 'scheme-files' using 'scandir*'.
On a command like:

  guix environment --ad-hoc coreutils -- true

this reduces the number of 'stat' calls from 14.1K to 9.7K on my
setup (previously each getdents(2) call would be followed by one stat(2)
call per entry).

* guix/discovery.scm (scheme-files): Rewrite using 'scandir*'.
2017-06-16 17:08:22 +02:00
Ludovic Courtès cd903ef787
Add (guix discovery).
* guix/discovery.scm, tests/discovery.scm: New files.
* gnu/packages.scm (scheme-files, file-name->module-name)
(scheme-modules, all-package-modules): Remove.
(fold-packages): Rewrite in terms of 'fold-module-public-variables'.
* gnu/tests.scm: Use (guix discovery).
* Makefile.am (MODULES): Add guix/discovery.scm.
(SCM_TESTS): Add tests/discovery.scm.
2017-05-03 23:50:15 +02:00