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.
This commit is contained in:
Luflosi 2024-11-07 11:04:18 +01:00
parent 2c1a608bf7
commit 7b77b4ab6c
No known key found for this signature in database
GPG Key ID: 743C5DD6900A1FF0

View File

@ -3,30 +3,34 @@
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
''
substituteInPlace \
apfs-snap/Makefile apfsck/Makefile mkapfs/Makefile apfs-label/Makefile \
--replace-fail \
'$(shell git describe --always HEAD | tail -c 9)' \
'${shortRev}'
'';
postPatch = ''
substituteInPlace \
apfs-snap/Makefile apfsck/Makefile mkapfs/Makefile apfs-label/Makefile \
--replace-fail \
'$(shell git describe --always HEAD | tail -c 9)' \
'v${finalAttrs.version}'
'';
buildPhase = ''
runHook preBuild
@ -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 ];