mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-26 02:05:02 +00:00
netcat-openbsd: refactor, enable checks
This commit is contained in:
@@ -2,14 +2,21 @@
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitLab,
|
||||
quilt,
|
||||
pkg-config,
|
||||
libbsd,
|
||||
installShellFiles,
|
||||
strace,
|
||||
iproute2,
|
||||
procps,
|
||||
util-linux,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "netcat-openbsd";
|
||||
version = "1.234-2";
|
||||
__structuredAttrs = true;
|
||||
strictDeps = true;
|
||||
|
||||
src = fetchFromGitLab {
|
||||
domain = "salsa.debian.org";
|
||||
@@ -19,41 +26,74 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-kA9QzEI4nutQrKonHw+SxWYbuBLtn91edMAk8JBdAhU=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
postPatch = ''
|
||||
QUILT_PATCHES=debian/patches quilt push -a
|
||||
'';
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"man"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
quilt
|
||||
pkg-config
|
||||
installShellFiles
|
||||
];
|
||||
buildInputs = [ libbsd ];
|
||||
|
||||
postPatch = ''
|
||||
for file in $(cat debian/patches/series); do
|
||||
patch -p1 < debian/patches/$file
|
||||
done
|
||||
'';
|
||||
buildInputs = [
|
||||
libbsd
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
strace
|
||||
iproute2
|
||||
procps
|
||||
util-linux
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm755 -t $out/bin nc
|
||||
installBin nc
|
||||
installManPage nc.1
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
$out/bin/nc -h 2> /dev/null
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
substituteInPlace debian/tests/client-server debian/checks/netcat \
|
||||
--replace-fail 'PATH="/usr/bin:/bin"' ""
|
||||
patchShebangs debian/tests/client-server debian/checks/netcat
|
||||
|
||||
# normally built by debian/rules
|
||||
$CC -shared -o debian/checks/readpassphrase.so debian/checks/readpassphrase.c
|
||||
$CC -o debian/checks/sun_path-size debian/checks/sun_path-size.c
|
||||
|
||||
# name resolution does not really exists in sandbox
|
||||
rm debian/checks/07-name-resolution
|
||||
|
||||
debian/tests/client-server
|
||||
debian/checks/netcat
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "TCP/IP swiss army knife. OpenBSD variant";
|
||||
homepage = "https://salsa.debian.org/debian/netcat-openbsd";
|
||||
maintainers = with lib.maintainers; [ artturin ];
|
||||
license = lib.licenses.bsd3;
|
||||
license = with lib.licenses; [
|
||||
bsd2
|
||||
bsd3
|
||||
];
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "nc";
|
||||
# never built on aarch64-darwin, x86_64-darwin since first introduction in nixpkgs
|
||||
broken = stdenv.hostPlatform.isDarwin;
|
||||
# never built on aarch64-darwin since first introduction in nixpkgs
|
||||
badPlatforms = lib.platforms.darwin;
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user