3
0
Fork 0
forked from mirrors/nixpkgs

* Module aggregator: use buildEnv, which is much faster because it

creates symlinks lazily (i.e., it creates a single symlink to an
  entire tree unless another input has an overlapping tree).  As a
  result it creates only a few dozen symlinks instead of ~ 12000
  (which can take almost 2 minutes on my laptop).

svn path=/nixpkgs/branches/stdenv-updates/; revision=15200
This commit is contained in:
Eelco Dolstra 2009-04-20 19:13:40 +00:00
parent 15f1feb702
commit 089eef511c
2 changed files with 24 additions and 25 deletions

View file

@ -1,28 +1,27 @@
{stdenv, module_init_tools, modules}:
{stdenv, module_init_tools, modules, buildEnv}:
stdenv.mkDerivation {
buildEnv {
name = "kernel-modules";
buildCommand = ''
ensureDir $out/lib/modules
cd $out/
modules="${toString modules}"
for i in $modules; do
cp -rfs $i/* .
chmod -R u+w .
v=$(cd $i/lib/modules && ls -d *)
if test -n "$version" -a "$v" != "$version"; then
echo "kernel version mismatch: $version versus $v (in the module paths $modules)";
paths = modules;
postBuild =
''
source ${stdenv}/setup
kernelVersion=$(cd $out/lib/modules && ls -d *)
if test "$(echo $kernelVersion | wc -w)" != 1; then
echo "inconsistent kernel versions: $kernelVersion"
exit 1
fi
version=$v
done
echo "kernel version is $version"
rm -rf nix-support
cd lib/modules/
rm */modules.*
# linux-* will pass the new kernel version to depmod to take rather than `uname -r` (see man page)
MODULE_DIR=$PWD/ ${module_init_tools}/sbin/depmod -a $(basename lib/modules/2.*)
cd $out/
echo "kernel version is $kernelVersion"
# Regenerate the depmod map files. Be sure to pass an explicit
# kernel version number, otherwise depmod will use `uname -r'.
if test -w $out/lib/modules/$kernelVersion; then
rm -f $out/lib/modules/$kernelVersion/modules.*
MODULE_DIR=$out/lib/modules/ ${module_init_tools}/sbin/depmod -a $kernelVersion
fi
'';
}

View file

@ -7313,7 +7313,7 @@ let
aggregateModules = modules:
import ../os-specific/linux/module-init-tools/aggregator.nix {
inherit stdenv module_init_tools modules;
inherit stdenv module_init_tools modules buildEnv;
};
modutils = import ../os-specific/linux/modutils {