nixpkgs/pkgs/by-name/op/openvswitch/generic.nix
Bryan T. Richardson a4db457ffd
openvswitch: include Python setuptools for tests
Fixes test(s) that fail with the following output:

```
2611: Pytest unit tests - Python3                     ok

ERROR: 2600 tests were run,
1 failed unexpectedly.
12 tests were skipped.

Please send 'tests/testsuite.log' and all information you think might help:

   To: <bugs@openvswitch.org>
   Subject: [openvswitch 3.3.0] testsuite: 2531 failed

You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point.  Its output may
be found below 'tests/testsuite.dir'.

Traceback (most recent call last):
  File "<string>", line 4, in <module>
ModuleNotFoundError: No module named 'pkg_resources'
```
2024-05-03 14:25:13 -06:00

145 lines
2.9 KiB
Nix

{
version,
hash,
updateScriptArgs ? "",
}:
{
lib,
stdenv,
fetchurl,
autoconf,
automake,
installShellFiles,
iproute2,
kernel ? null,
libcap_ng,
libtool,
openssl,
perl,
pkg-config,
procps,
python3,
sphinxHook,
util-linux,
which,
writeScript,
}:
let
_kernel = kernel;
in
stdenv.mkDerivation rec {
pname = "openvswitch";
inherit version;
kernel = lib.optional (_kernel != null) _kernel.dev;
src = fetchurl {
url = "https://www.openvswitch.org/releases/${pname}-${version}.tar.gz";
inherit hash;
};
outputs = [
"out"
"man"
];
patches = [
# 8: vsctl-bashcomp - argument completion FAILED (completion.at:664)
./patches/disable-bash-arg-completion-test.patch
# https://github.com/openvswitch/ovs/commit/9185793e75435d890f18d391eaaeab0ade6f1415
./patches/fix-python313.patch
];
nativeBuildInputs = [
autoconf
automake
installShellFiles
libtool
pkg-config
sphinxHook
];
sphinxBuilders = [ "man" ];
sphinxRoot = "./Documentation";
buildInputs = [
libcap_ng
openssl
perl
procps
python3
util-linux
which
];
preConfigure = "./boot.sh";
configureFlags = [
"--localstatedir=/var"
"--sharedstatedir=/var"
"--sbindir=$(out)/bin"
] ++ (lib.optionals (_kernel != null) [ "--with-linux" ]);
# Leave /var out of this!
installFlags = [
"LOGDIR=$(TMPDIR)/dummy"
"RUNDIR=$(TMPDIR)/dummy"
"PKIDIR=$(TMPDIR)/dummy"
];
enableParallelBuilding = true;
postInstall = ''
installShellCompletion --bash utilities/ovs-appctl-bashcomp.bash
installShellCompletion --bash utilities/ovs-vsctl-bashcomp.bash
'';
doCheck = true;
preCheck = ''
export TESTSUITEFLAGS="-j$NIX_BUILD_CORES"
export RECHECK=yes
patchShebangs tests/
'';
nativeCheckInputs =
[ iproute2 ]
++ (with python3.pkgs; [
netaddr
pyparsing
pytest
setuptools
]);
passthru.updateScript = writeScript "ovs-update.nu" ''
${./update.nu} ${updateScriptArgs}
'';
meta = with lib; {
changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";
description = "A multilayer virtual switch";
longDescription = ''
Open vSwitch is a production quality, multilayer virtual switch
licensed under the open source Apache 2.0 license. It is
designed to enable massive network automation through
programmatic extension, while still supporting standard
management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
support distribution across multiple physical servers similar
to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
'';
homepage = "https://www.openvswitch.org/";
license = licenses.asl20;
maintainers = with maintainers; [
adamcstephens
kmcopper
netixx
];
platforms = platforms.linux;
};
}