Unverified Commit f2846893 authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

zfs: revamp and test compatible Kernel versions (#352399)

parents a0aa3f24 3d589fc8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -10,8 +10,9 @@ callPackage ./generic.nix args {
  # You have to ensure that in `pkgs/top-level/linux-kernels.nix`
  # this attribute is the correct one for this package.
  kernelModuleAttribute = "zfs_2_2";
  # check the release notes for compatible kernels
  kernelCompatible = kernel: kernel.kernelOlder "6.16";

  kernelMinSupportedMajorMinor = "4.18";
  kernelMaxSupportedMajorMinor = "6.15";

  # this package should point to the latest release.
  version = "2.2.8";
+3 −2
Original line number Diff line number Diff line
@@ -10,8 +10,9 @@ callPackage ./generic.nix args {
  # You have to ensure that in `pkgs/top-level/linux-kernels.nix`
  # this attribute is the correct one for this package.
  kernelModuleAttribute = "zfs_2_3";
  # check the release notes for compatible kernels
  kernelCompatible = kernel: kernel.kernelOlder "6.16";

  kernelMinSupportedMajorMinor = "4.18";
  kernelMaxSupportedMajorMinor = "6.15";

  # this package should point to the latest release.
  version = "2.3.3";
+29 −2
Original line number Diff line number Diff line
@@ -48,7 +48,9 @@ let
      extraLongDescription ? "",
      extraPatches ? [ ],
      rev ? "zfs-${version}",
      kernelCompatible ? null,
      kernelMinSupportedMajorMinor,
      kernelMaxSupportedMajorMinor,
      enableUnsupportedExperimentalKernel ? false, # allows building against unsupported Kernel versions
      maintainers ? (with lib.maintainers; [ amarshall ]),
      tests,
    }@innerArgs:
@@ -72,6 +74,22 @@ let
        "user"
        "all"
      ];
      kernelIsCompatible =
        kernel:
        let
          nextMajorMinor =
            ver:
            "${lib.versions.major ver}.${
              lib.pipe ver [
                lib.versions.minor
                lib.toInt
                (x: x + 1)
                toString
              ]
            }";
        in
        (lib.versionAtLeast kernel.version kernelMinSupportedMajorMinor)
        && (lib.versionOlder kernel.version (nextMajorMinor kernelMaxSupportedMajorMinor));

      # XXX: You always want to build kernel modules with the same stdenv as the
      # kernel was built with. However, since zfs can also be built for userspace we
@@ -139,6 +157,14 @@ let
              "bashcompletiondir=$out/share/bash-completion/completions"

          substituteInPlace ./cmd/arc_summary --replace-fail "/sbin/modinfo" "modinfo"
        ''
        + ''
          echo 'Supported Kernel versions:'
          grep '^Linux-' META
          echo 'Checking kernelMinSupportedMajorMinor is correct...'
          grep --quiet '^Linux-Minimum: *${lib.escapeRegex kernelMinSupportedMajorMinor}$' META
          echo 'Checking kernelMaxSupportedMajorMinor is correct...'
          grep --quiet '^Linux-Maximum: *${lib.escapeRegex kernelMaxSupportedMajorMinor}$' META
        '';

      nativeBuildInputs = [
@@ -176,6 +202,7 @@ let
        "--with-tirpc=1"
        (lib.withFeatureAs (buildUser && enablePython) "python" python3.interpreter)
      ]
      ++ optional enableUnsupportedExperimentalKernel "--enable-linux-experimental"
      ++ optionals buildUser [
        "--with-dracutdir=$(out)/lib/dracut"
        "--with-udevdir=$(out)/lib/udev"
@@ -330,7 +357,7 @@ let

        inherit maintainers;
        mainProgram = "zfs";
        broken = buildKernel && (kernelCompatible != null) && !(kernelCompatible kernel);
        broken = buildKernel && !((kernelIsCompatible kernel) || enableUnsupportedExperimentalKernel);
      };
    };
in
+3 −2
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@ callPackage ./generic.nix args {
  # You have to ensure that in `pkgs/top-level/linux-kernels.nix`
  # this attribute is the correct one for this package.
  kernelModuleAttribute = "zfs_unstable";
  # check the release notes for compatible kernels
  kernelCompatible = kernel: kernel.kernelOlder "6.16";

  kernelMinSupportedMajorMinor = "4.18";
  kernelMaxSupportedMajorMinor = "6.15";

  # this package should point to a version / git revision compatible with the latest kernel release
  # IMPORTANT: Always use a tagged release candidate or commits from the