Hello,
[email protected] writes:
> Each build-system sets its own imported-modules and modules, but in the
> case where we would want to generalize a function which takes a
> build-system in its arguments, there doesn't seem to be a way to access
> the imported-modules and modules from this build-system. (I have a
> specific use-case in mind for extending/modifying arbitrary
> build-systems, related to 68315).
I’m not sure I understand how this information could be used, but…
> (set-procedure-properties!
> gnu-build
> `((imported-modules . ,%default-gnu-imported-modules)
> (modules . ,%default-gnu-modules)))
Instead of procedure properties (which are a hack, really), you could
add one or two fields to <build-system> and be done with that.
Now, “imported modules” are information that is already part of the
gexps. Why do we still have #:imported-modules, I wonder. :-)
That is, in theory, gnu.scm could have:
(define (gnu-build …)
…
(with-imported-modules %default-gnu-imported-modules ;hardcoded
#~(…))
…)
and then, in a package, one can write:
(arguments
#:phases (with-imported-modules '((guix build whatever))
#~(modify-phases …)))
and it just works.
The other bit, the “modules in scope”, could still be useful in
<build-system>.
I hope this makes sense.
Ludo’.