[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reducing useless module imports
From: |
Julien Lepiller |
Subject: |
Reducing useless module imports |
Date: |
Fri, 3 Feb 2023 18:11:26 +0100 |
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
- Reducing useless module imports,
Julien Lepiller <=