ucg: cleanup

- Use rec-less, overlay-style overridable recursive attributes (in effect since
https://github.com/NixOS/nixpkgs/pull/119942);
- Remove installCheckPhase
  - Change it to a separated derivation inside passthru.tests
- Set meta.mainProgram
This commit is contained in:
Anderson Torres 2023-09-12 23:42:19 -03:00
parent 74ebb96a9d
commit 8485cdfad5
3 changed files with 35 additions and 18 deletions

View File

@ -2,11 +2,12 @@
, stdenv
, fetchFromGitHub
, autoreconfHook
, callPackage
, pkg-config
, pcre
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "ucg";
version = "unstable-2022-09-03";
@ -28,20 +29,11 @@ stdenv.mkDerivation {
pcre
];
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
testFile=$(mktemp /tmp/ucg-test.XXXX)
echo -ne 'Lorem ipsum dolor sit amet\n2.7182818284590' > $testFile
$out/bin/ucg 'dolor' $testFile || { rm $testFile; exit -1; }
$out/bin/ucg --ignore-case 'lorem' $testFile || { rm $testFile; exit -1; }
$out/bin/ucg --word-regexp '2718' $testFile && { rm $testFile; exit -1; }
$out/bin/ucg 'pisum' $testFile && { rm $testFile; exit -1; }
rm $testFile
runHook postInstallCheck
'';
passthru.tests = {
simple = callPackage ./tests/simple.nix {
ucg = finalAttrs.finalPackage;
};
};
meta = {
homepage = "https://gvansickle.github.io/ucg/";
@ -53,9 +45,10 @@ stdenv.mkDerivation {
appropriate with grep. Search patterns are specified as PCRE regexes.
'';
license = lib.licenses.gpl3Plus;
mainProgram = "ucg";
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.unix;
broken = stdenv.isAarch64 || stdenv.isDarwin;
};
}
})
# TODO: report upstream

View File

@ -0,0 +1,26 @@
{ lib
, stdenv
, ucg
}:
stdenv.mkDerivation {
pname = "ucg-test";
inherit (ucg) version;
nativeBuildInputs = [ ucg ];
dontInstall = true;
buildCommand = ''
testFile=$(mktemp /tmp/ucg-test.XXXX)
echo -ne 'Lorem ipsum dolor sit amet\n2.7182818284590' > $testFile
ucg 'dolor' $testFile || { rm $testFile; exit -1; }
ucg --ignore-case 'lorem' $testFile || { rm $testFile; exit -1; }
ucg --word-regexp '2718' $testFile && { rm $testFile; exit -1; }
ucg 'pisum' $testFile && { rm $testFile; exit -1; }
rm $testFile
touch $out
'';
meta.timeout = 10;
}

View File

@ -8864,8 +8864,6 @@ with pkgs;
robodoc = callPackage ../tools/text/robodoc { };
ucg = callPackage ../tools/text/ucg { };
grive2 = callPackage ../tools/filesystems/grive2 { };
groff = callPackage ../tools/text/groff { };