Re: Reducing useless module imports

2023-02-04 Thread Maxime Devos



On 03-02-2023 18:11, Julien Lepiller wrote:

gnu packages minetest) imports (guix build-system
minetest) but never uses the minetest-build-system. (gnu packages
abiword) uses (guix build-system gnu) but does not use the
gnu-build-system.



The build-system minetest-build-system does not exist; it's 
minetest-mod-build-system, which happens to be defined in (guix 
build-system build-system).  As such, (gnu packages minetest) actually 
does use (guix build-system minetest).


The idea was that in the future we might also package 'subgames' and 
texture packages, for which a 'minetest-subgame-build-system' and 
'minetest-texture-pack-build-system' build system could be defined.
It seemed a bit pointless to me to put those not-yet-defined build 
systems in separate modules.


Greetings,
Maxime.


OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Reducing useless module imports

2023-02-03 Thread Julien Lepiller
Hi Guix!

during the Guix Days, we talked about reducing module imports. First,
let's note there's an empty module (gnu packages key-mon).

Then, we looked at build systems modules that are imported, but for
which the build system is never used:

```
for f in *.scm; do systems=$(grep '#:use-module (guix build-system' $f
| sed 's|^.*use-module (guix build-system \([^)]*\).*|\1|'); for s in
$systems; do if grep "${s}-build-system" $f >/dev/null; then :; else
echo $s is not used in $f; fi; done; done
```

For instance, (gnu packages minetest) imports (guix build-system
minetest) but never uses the minetest-build-system. (gnu packages
abiword) uses (guix build-system gnu) but does not use the
gnu-build-system.

Many modules seem to use a lot of imports that are actually useless,
for instance (gnu packages heads) imports 20 package modules, but
only uses 4 of them.

Removing these module imports would help a lot with reducing the number
of loops. If anyone wants to volunteer a lint checker for that,
raise hands :D