
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19
.tar.gz \
--argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
result/bin/apply-formatting $NIXPKGS_PATH
80 lines
2.2 KiB
Nix
80 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
bash,
|
|
flex,
|
|
bison,
|
|
valgrind,
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "lockdep";
|
|
|
|
# it would be nice to be able to pick a kernel version in sync with something
|
|
# else we already ship, but it seems userspace lockdep isn't very well maintained
|
|
# and appears broken in many kernel releases
|
|
version = "5.0.21";
|
|
fullver = "5.0.21";
|
|
src = fetchurl {
|
|
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
|
|
sha256 = "1my2m9hvnvdrvzcg0fgqgaga59y2cd5zlpv7xrfj2nn98sjhglwq";
|
|
};
|
|
|
|
# ensure *this* kernel's userspace-headers are picked up before we
|
|
# fall back to those in glibc, as they will be from a mismatched
|
|
# kernel version
|
|
postPatch = ''
|
|
substituteInPlace tools/lib/lockdep/Makefile \
|
|
--replace 'CONFIG_INCLUDES =' $'CONFIG_INCLUDES = -I../../../usr/include\n#'
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
flex
|
|
bison
|
|
];
|
|
|
|
# Workaround build failure on -fno-common toolchains like upstream
|
|
# gcc-10. Otherwise build fails as:
|
|
# ld: lockdep.o:/build/linux-5.0.21/tools/lib/lockdep/../../include/linux/rcu.h:5: multiple definition of
|
|
# `rcu_scheduler_active'; common.o:/build/linux-5.0.21/tools/lib/lockdep/../../include/linux/rcu.h:5: first defined here
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
|
|
|
buildPhase = ''
|
|
make defconfig
|
|
make headers_install
|
|
cd tools/lib/lockdep
|
|
make
|
|
'';
|
|
|
|
doCheck = true;
|
|
nativeCheckInputs = [ valgrind ];
|
|
checkPhase = ''
|
|
# there are more /bin/bash references than just shebangs
|
|
for f in lockdep run_tests.sh tests/*.sh; do
|
|
substituteInPlace $f \
|
|
--replace '/bin/bash' '${bash}/bin/bash'
|
|
done
|
|
|
|
./run_tests.sh
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin $out/lib $out/include
|
|
|
|
cp -R include/liblockdep $out/include
|
|
make install DESTDIR=$out prefix=""
|
|
|
|
substituteInPlace $out/bin/lockdep --replace "./liblockdep.so" "$out/lib/liblockdep.so.$fullver"
|
|
'';
|
|
|
|
meta = {
|
|
description = "Userspace locking validation tool built on the Linux kernel";
|
|
mainProgram = "lockdep";
|
|
homepage = "https://kernel.org/";
|
|
license = lib.licenses.gpl2Only;
|
|
platforms = lib.platforms.linux;
|
|
maintainers = [ lib.maintainers.thoughtpolice ];
|
|
};
|
|
}
|