Unverified Commit 7b77b4ab authored by Luflosi's avatar Luflosi
Browse files

apfsprogs: 0-unstable-2024-09-27 -> 0.2.0

https://github.com/linux-apfs/apfsprogs/releases/tag/v0.2.0

Also add some simple tests to check that all tools can output the correct version.
parent 2c1a608b
Loading
Loading
Loading
Loading
+37 −18
Original line number Diff line number Diff line
@@ -3,29 +3,33 @@
  stdenv,
  fetchFromGitHub,
  nixosTests,
  testers,
}:

let
  tools = [
    "apfsck"
    "apfs-label"
    "apfs-snap"
    "mkapfs"
  ];
in
stdenv.mkDerivation (finalAttrs: {
  pname = "apfsprogs";
  version = "0-unstable-2024-09-27";
  version = "0.2.0";

  src = fetchFromGitHub {
    owner = "linux-apfs";
    repo = "apfsprogs";
    rev = "f31d7c2d69d212ce381399d2bb1e91410f592484";
    hash = "sha256-+c+wU52XKNOTxSpSrkrNWoGEYw6Zo4CGEOyKMvkXEa0=";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-rolbBLdE98jqlKC06fTo6eJU3abKzgB3QIlaw4bza9U=";
  };

  postPatch =
    let
      shortRev = builtins.substring 0 9 finalAttrs.src.rev;
    in
    ''
  postPatch = ''
    substituteInPlace \
      apfs-snap/Makefile apfsck/Makefile mkapfs/Makefile apfs-label/Makefile \
      --replace-fail \
        '$(shell git describe --always HEAD | tail -c 9)' \
          '${shortRev}'
        'v${finalAttrs.version}'
  '';

  buildPhase = ''
@@ -46,15 +50,30 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  passthru.tests = {
    apfs = nixosTests.apfs;
  passthru.tests =
    let
      mkVersionTest = tool: {
        "version-${tool}" = testers.testVersion {
          package = finalAttrs.finalPackage;
          command = "${tool} -v";
          version = "v${finalAttrs.version}";
        };
      };
      versionTestList = builtins.map mkVersionTest tools;

      versionTests = lib.mergeAttrsList versionTestList;
    in
    {
      apfs = nixosTests.apfs;
    }
    // versionTests;

  strictDeps = true;

  meta = with lib; {
    description = "Experimental APFS tools for linux";
    homepage = "https://github.com/linux-apfs/apfsprogs";
    changelog = "https://github.com/linux-apfs/apfsprogs/releases/tag/v${finalAttrs.version}";
    license = licenses.gpl2Only;
    platforms = platforms.linux;
    maintainers = with maintainers; [ Luflosi ];