From bb67b2224457656783d9b8f90518aeb7bfdfd640 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 21 Dec 2023 11:08:31 -0500 Subject: [PATCH 1/3] openvswitch*: run tests in parallel for significant speedup --- pkgs/os-specific/linux/openvswitch/generic.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/os-specific/linux/openvswitch/generic.nix b/pkgs/os-specific/linux/openvswitch/generic.nix index 83749782d274..fc4386953f7d 100644 --- a/pkgs/os-specific/linux/openvswitch/generic.nix +++ b/pkgs/os-specific/linux/openvswitch/generic.nix @@ -96,6 +96,8 @@ in stdenv.mkDerivation rec { doCheck = true; preCheck = '' + export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" + patchShebangs tests/ ''; From 32c6918ba519cfb7ee717481dd2d2997aaca8453 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 21 Dec 2023 11:08:12 -0500 Subject: [PATCH 2/3] ovn/ovn-lts: init at 23.09.1/22.03.5 --- pkgs/by-name/ov/ovn/generic.nix | 96 +++++++++++++++++++++++++++++++++ pkgs/by-name/ov/ovn/lts.nix | 5 ++ pkgs/by-name/ov/ovn/package.nix | 4 ++ pkgs/by-name/ov/ovn/update.nu | 19 +++++++ pkgs/top-level/all-packages.nix | 2 + 5 files changed, 126 insertions(+) create mode 100644 pkgs/by-name/ov/ovn/generic.nix create mode 100644 pkgs/by-name/ov/ovn/lts.nix create mode 100644 pkgs/by-name/ov/ovn/package.nix create mode 100755 pkgs/by-name/ov/ovn/update.nu diff --git a/pkgs/by-name/ov/ovn/generic.nix b/pkgs/by-name/ov/ovn/generic.nix new file mode 100644 index 000000000000..0dfe1f80d653 --- /dev/null +++ b/pkgs/by-name/ov/ovn/generic.nix @@ -0,0 +1,96 @@ +{ + version, + hash, + updateScriptArgs ? "", +}: + +{ + lib, + stdenv, + fetchFromGitHub, + autoreconfHook, + gnused, + libbpf, + libcap_ng, + numactl, + openssl, + pkg-config, + procps, + python3, + unbound, + xdp-tools, + writeScript, +}: + +stdenv.mkDerivation rec { + pname = "ovn"; + inherit version; + + src = fetchFromGitHub { + owner = "ovn-org"; + repo = "ovn"; + rev = "refs/tags/v${version}"; + inherit hash; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + python3 + ]; + + buildInputs = [ + libbpf + libcap_ng + numactl + openssl + unbound + xdp-tools + ]; + + # need to build the ovs submodule first + preConfigure = '' + pushd ovs + ./boot.sh + ./configure + make -j $NIX_BUILD_CORES + popd + ''; + + enableParallelBuilding = true; + + doCheck = true; + + nativeCheckInputs = [ + gnused + procps + ]; + + # https://docs.ovn.org/en/latest/topics/testing.html + preCheck = '' + export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" + # allow rechecks to retry flaky tests + export RECHECK=yes + + # hack to stop tests from trying to read /etc/resolv.conf + export OVS_RESOLV_CONF="$PWD/resolv.conf" + touch $OVS_RESOLV_CONF + ''; + + passthru.updateScript = writeScript "ovs-update.nu" '' + ${./update.nu} ${updateScriptArgs} + ''; + + meta = with lib; { + description = "Open Virtual Network"; + longDescription = '' + OVN (Open Virtual Network) is a series of daemons that translates virtual network configuration into OpenFlow, and installs them into Open vSwitch. + ''; + homepage = "https://github.com/ovn-org/ovn"; + changelog = "https://github.com/ovn-org/ovn/blob/${src.rev}/NEWS"; + license = licenses.asl20; + maintainers = with maintainers; [ adamcstephens ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/by-name/ov/ovn/lts.nix b/pkgs/by-name/ov/ovn/lts.nix new file mode 100644 index 000000000000..5a022fcd9f2d --- /dev/null +++ b/pkgs/by-name/ov/ovn/lts.nix @@ -0,0 +1,5 @@ +import ./generic.nix { + version = "22.03.5"; + hash = "sha256-DMDWR7Dbgak0azPcVqDdFHGovTbLX8byp+jQ3rYvvX4="; + updateScriptArgs = "--lts=true --regex '22.03.*'"; +} diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix new file mode 100644 index 000000000000..50050d49a088 --- /dev/null +++ b/pkgs/by-name/ov/ovn/package.nix @@ -0,0 +1,4 @@ +import ./generic.nix { + version = "23.09.1"; + hash = "sha256-t4DtV0wW/jQX7/TpsLFoDzzSPROrhUHHG09r9+lsdaQ="; +} diff --git a/pkgs/by-name/ov/ovn/update.nu b/pkgs/by-name/ov/ovn/update.nu new file mode 100755 index 000000000000..ba55fce087ea --- /dev/null +++ b/pkgs/by-name/ov/ovn/update.nu @@ -0,0 +1,19 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i nu -p nushell common-updater-scripts + +def main [--lts: bool = false, --regex: string] { + let tags = list-git-tags --url=https://github.com/ovn-org/ovn | lines | sort --natural | str replace v '' + + let latest_tag = if $regex == null { $tags } else { $tags | find --regex $regex } | last + let current_version = nix eval --raw -f default.nix $"ovn(if $lts {"-lts"}).version" | str trim + + if $latest_tag != $current_version { + if $lts { + update-source-version ovn-lts $latest_tag $"--file=(pwd)/pkgs/by-name/ov/ovn/lts.nix" + } else { + update-source-version ovn $latest_tag $"--file=(pwd)/pkgs/by-name/ov/ovn/package.nix" + } + } + + {"lts?": $lts, before: $current_version, after: $latest_tag} +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ae21ad1aeafb..5d1b23fe7d7b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11750,6 +11750,8 @@ with pkgs; openvswitch-lts = callPackage ../os-specific/linux/openvswitch/lts.nix { }; + ovn-lts = callPackage ../by-name/ov/ovn/lts.nix { }; + optifinePackages = callPackage ../tools/games/minecraft/optifine { }; optifine = optifinePackages.optifine-latest; From 0b871b9fc3dfa844ed2b2f07a104d20b8845fdb8 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Fri, 22 Dec 2023 23:56:00 -0500 Subject: [PATCH 3/3] openvswitch*: enable RECHECK to rerun failed tests --- pkgs/os-specific/linux/openvswitch/generic.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/os-specific/linux/openvswitch/generic.nix b/pkgs/os-specific/linux/openvswitch/generic.nix index fc4386953f7d..ce800a7ba992 100644 --- a/pkgs/os-specific/linux/openvswitch/generic.nix +++ b/pkgs/os-specific/linux/openvswitch/generic.nix @@ -97,6 +97,7 @@ in stdenv.mkDerivation rec { doCheck = true; preCheck = '' export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" + export RECHECK=yes patchShebangs tests/ '';