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:
@@ -2,11 +2,12 @@
|
|||||||
, stdenv
|
, stdenv
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, autoreconfHook
|
, autoreconfHook
|
||||||
|
, callPackage
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, pcre
|
, pcre
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "ucg";
|
pname = "ucg";
|
||||||
version = "unstable-2022-09-03";
|
version = "unstable-2022-09-03";
|
||||||
|
|
||||||
@@ -28,20 +29,11 @@ stdenv.mkDerivation {
|
|||||||
pcre
|
pcre
|
||||||
];
|
];
|
||||||
|
|
||||||
doInstallCheck = true;
|
passthru.tests = {
|
||||||
installCheckPhase = ''
|
simple = callPackage ./tests/simple.nix {
|
||||||
runHook preInstallCheck
|
ucg = finalAttrs.finalPackage;
|
||||||
|
};
|
||||||
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
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "https://gvansickle.github.io/ucg/";
|
homepage = "https://gvansickle.github.io/ucg/";
|
||||||
@@ -53,9 +45,10 @@ stdenv.mkDerivation {
|
|||||||
appropriate with grep. Search patterns are specified as PCRE regexes.
|
appropriate with grep. Search patterns are specified as PCRE regexes.
|
||||||
'';
|
'';
|
||||||
license = lib.licenses.gpl3Plus;
|
license = lib.licenses.gpl3Plus;
|
||||||
|
mainProgram = "ucg";
|
||||||
maintainers = with lib.maintainers; [ AndersonTorres ];
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||||
platforms = lib.platforms.unix;
|
platforms = lib.platforms.unix;
|
||||||
broken = stdenv.isAarch64 || stdenv.isDarwin;
|
broken = stdenv.isAarch64 || stdenv.isDarwin;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
# TODO: report upstream
|
# TODO: report upstream
|
||||||
26
pkgs/by-name/uc/ucg/tests/simple.nix
Normal file
26
pkgs/by-name/uc/ucg/tests/simple.nix
Normal 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;
|
||||||
|
}
|
||||||
@@ -8864,8 +8864,6 @@ with pkgs;
|
|||||||
|
|
||||||
robodoc = callPackage ../tools/text/robodoc { };
|
robodoc = callPackage ../tools/text/robodoc { };
|
||||||
|
|
||||||
ucg = callPackage ../tools/text/ucg { };
|
|
||||||
|
|
||||||
grive2 = callPackage ../tools/filesystems/grive2 { };
|
grive2 = callPackage ../tools/filesystems/grive2 { };
|
||||||
|
|
||||||
groff = callPackage ../tools/text/groff { };
|
groff = callPackage ../tools/text/groff { };
|
||||||
|
|||||||
Reference in New Issue
Block a user