convmv: add Darwin support, reformat & migrate to pkgs/by-name
Add support for Darwin to convmv. This required disabling the tests as APFS requires filenames to be valid UTF-8[^1]. This will also affect Linux if a filesystem that enforces valid UTF-8 is used (such as ZFS with `utf8only=on`). While we're here, make some changes to clean up the derivation: - Replace use of `rec` with `finalAttrs` pattern - Replace `fetchurl` with `fetchzip` - Added separate `man` output - Replace `preBuild` hook with explicit `makeFlags` initialization - Replace explicit `patchPhase` override with `prePatch` hook - Enable `strictDeps` - Disable redundant `patchShebangs` call (already done in `prePatch` hook) - Address lints from `nixpkgs-hammer` - Reformat with `nixfmt-rfc-style` - Migrate to pkgs/by-name [^1]: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/FAQ/FAQ.html
This commit is contained in:
parent
ecd9a5753a
commit
9f51e9102d
60
pkgs/by-name/co/convmv/package.nix
Normal file
60
pkgs/by-name/co/convmv/package.nix
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchzip,
|
||||||
|
perl,
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "convmv";
|
||||||
|
version = "2.05";
|
||||||
|
|
||||||
|
outputs = [
|
||||||
|
"out"
|
||||||
|
"man"
|
||||||
|
];
|
||||||
|
|
||||||
|
src = fetchzip {
|
||||||
|
url = "https://www.j3e.de/linux/convmv/convmv-${finalAttrs.version}.tar.gz";
|
||||||
|
hash = "sha256-ts9xAPRGUoS0XBRTmpb+BlGW1hmGyUs+rQLyUEgiZ54=";
|
||||||
|
};
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ perl ];
|
||||||
|
|
||||||
|
buildInputs = [ perl ];
|
||||||
|
|
||||||
|
makeFlags = [
|
||||||
|
"PREFIX=${placeholder "out"}"
|
||||||
|
"MANDIR=${placeholder "man"}/share/man"
|
||||||
|
];
|
||||||
|
|
||||||
|
checkTarget = "test";
|
||||||
|
|
||||||
|
# testsuite.tar contains filenames that aren't valid UTF-8. Extraction of
|
||||||
|
# testsuite.tar will fail as APFS enforces that filenames are valid UTF-8.
|
||||||
|
doCheck = !stdenv.isDarwin;
|
||||||
|
|
||||||
|
prePatch =
|
||||||
|
lib.optionalString finalAttrs.doCheck ''
|
||||||
|
tar -xf testsuite.tar
|
||||||
|
''
|
||||||
|
+ ''
|
||||||
|
patchShebangs --host .
|
||||||
|
'';
|
||||||
|
|
||||||
|
dontPatchShebangs = true;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Converts filenames from one encoding to another";
|
||||||
|
downloadPage = "https://www.j3e.de/linux/convmv/";
|
||||||
|
license = with licenses; [
|
||||||
|
gpl2Only
|
||||||
|
gpl3Only
|
||||||
|
];
|
||||||
|
maintainers = with maintainers; [ ];
|
||||||
|
mainProgram = "convmv";
|
||||||
|
platforms = platforms.unix;
|
||||||
|
};
|
||||||
|
})
|
@ -1,33 +0,0 @@
|
|||||||
{ lib, stdenv, fetchurl, perl }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "convmv";
|
|
||||||
version = "2.05";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://www.j3e.de/linux/convmv/convmv-${version}.tar.gz";
|
|
||||||
sha256 = "19hwv197p7c23f43vvav5bs19z9b72jzca2npkjsxgprwj5ardjk";
|
|
||||||
};
|
|
||||||
|
|
||||||
preBuild=''
|
|
||||||
makeFlags="PREFIX=$out"
|
|
||||||
'';
|
|
||||||
|
|
||||||
patchPhase=''
|
|
||||||
tar -xf testsuite.tar
|
|
||||||
patchShebangs .
|
|
||||||
'';
|
|
||||||
|
|
||||||
doCheck = true;
|
|
||||||
checkTarget = "test";
|
|
||||||
|
|
||||||
buildInputs = [ perl ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "Converts filenames from one encoding to another";
|
|
||||||
platforms = platforms.linux ++ platforms.freebsd ++ platforms.cygwin;
|
|
||||||
maintainers = [ ];
|
|
||||||
license = licenses.gpl2Plus;
|
|
||||||
mainProgram = "convmv";
|
|
||||||
};
|
|
||||||
}
|
|
@ -6988,8 +6988,6 @@ with pkgs;
|
|||||||
|
|
||||||
convfont = callPackage ../tools/misc/convfont { };
|
convfont = callPackage ../tools/misc/convfont { };
|
||||||
|
|
||||||
convmv = callPackage ../tools/misc/convmv { };
|
|
||||||
|
|
||||||
cpcfs = callPackage ../tools/filesystems/cpcfs { };
|
cpcfs = callPackage ../tools/filesystems/cpcfs { };
|
||||||
|
|
||||||
coreutils = callPackage ../tools/misc/coreutils { };
|
coreutils = callPackage ../tools/misc/coreutils { };
|
||||||
|
Loading…
Reference in New Issue
Block a user