about summary refs log tree commit diff
path: root/pkgs/by-name/op/openvswitch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/op/openvswitch')
-rw-r--r--pkgs/by-name/op/openvswitch/generic.nix143
-rw-r--r--pkgs/by-name/op/openvswitch/lts.nix5
-rw-r--r--pkgs/by-name/op/openvswitch/package.nix161
-rw-r--r--pkgs/by-name/op/openvswitch/patches/fix-python313.patch12
-rwxr-xr-xpkgs/by-name/op/openvswitch/update.nu19
5 files changed, 158 insertions, 182 deletions
diff --git a/pkgs/by-name/op/openvswitch/generic.nix b/pkgs/by-name/op/openvswitch/generic.nix
deleted file mode 100644
index dadccc1c39473..0000000000000
--- a/pkgs/by-name/op/openvswitch/generic.nix
+++ /dev/null
@@ -1,143 +0,0 @@
-{
-  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
-    ]);
-
-  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;
-  };
-}
diff --git a/pkgs/by-name/op/openvswitch/lts.nix b/pkgs/by-name/op/openvswitch/lts.nix
deleted file mode 100644
index 93ccbfcee95d6..0000000000000
--- a/pkgs/by-name/op/openvswitch/lts.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-import ./generic.nix {
-  version = "2.17.9";
-  hash = "sha256-4bP6RyZ2YmhT8i1j+VnlrQYeG/V+G71ETQ7Yj5R++LE=";
-  updateScriptArgs = "--lts=true --regex '2\.17.*'";
-}
diff --git a/pkgs/by-name/op/openvswitch/package.nix b/pkgs/by-name/op/openvswitch/package.nix
index 0ea5b6391605a..4502031120c01 100644
--- a/pkgs/by-name/op/openvswitch/package.nix
+++ b/pkgs/by-name/op/openvswitch/package.nix
@@ -1,4 +1,159 @@
-import ./generic.nix {
-  version = "3.3.0";
-  hash = "sha256-Gvy4H7lHwL6IWGaZXWwIjmHfQ1YRFXiSBqKzP3vBsF8=";
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  autoconf,
+  automake,
+  installShellFiles,
+  iproute2,
+  kernel ? null,
+  libcap_ng,
+  libtool,
+  nix-update-script,
+  openssl,
+  perl,
+  pkg-config,
+  procps,
+  python3,
+  tcpdump,
+  sphinxHook,
+  util-linux,
+  which,
+  makeWrapper,
+  withDPDK ? false,
+  dpdk,
+  numactl,
+  libpcap,
+}:
+
+let
+  _kernel = kernel;
+in
+stdenv.mkDerivation rec {
+  pname = if withDPDK then "openvswitch-dpdk" else "openvswitch";
+  version = "3.4.0";
+
+  kernel = lib.optional (_kernel != null) _kernel.dev;
+
+  src = fetchFromGitHub {
+    owner = "openvswitch";
+    repo = "ovs";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-oe6RnSEaK/mFPzTLfsyyd7wijKbv2/tlNUlXZYrb+ko=";
+  };
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
+  patches = [
+    # 8: vsctl-bashcomp - argument completion FAILED (completion.at:664)
+    ./patches/disable-bash-arg-completion-test.patch
+  ];
+
+  nativeBuildInputs = [
+    autoconf
+    automake
+    installShellFiles
+    libtool
+    pkg-config
+    sphinxHook
+    makeWrapper
+  ];
+
+  sphinxBuilders = [ "man" ];
+
+  sphinxRoot = "./Documentation";
+
+  buildInputs =
+    [
+      libcap_ng
+      openssl
+      perl
+      procps
+      python3
+      util-linux
+      which
+    ]
+    ++ (lib.optionals withDPDK [
+      dpdk
+      numactl
+      libpcap
+    ]);
+
+  preConfigure = "./boot.sh";
+
+  configureFlags =
+    [
+      "--localstatedir=/var"
+      "--sharedstatedir=/var"
+      "--sbindir=$(out)/bin"
+    ]
+    ++ (lib.optionals (_kernel != null) [ "--with-linux" ])
+    ++ (lib.optionals withDPDK [ "--with-dpdk=shared" ]);
+
+  # 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
+
+    wrapProgram $out/bin/ovs-l3ping \
+      --prefix PYTHONPATH : $out/share/openvswitch/python
+
+    wrapProgram $out/bin/ovs-tcpdump \
+      --prefix PATH : ${lib.makeBinPath [ tcpdump ]} \
+      --prefix PYTHONPATH : $out/share/openvswitch/python
+  '';
+
+  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 = nix-update-script { };
+
+  meta = with lib; {
+    changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";
+    description = "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
+      xddxdd
+    ];
+    platforms = platforms.linux;
+  };
 }
diff --git a/pkgs/by-name/op/openvswitch/patches/fix-python313.patch b/pkgs/by-name/op/openvswitch/patches/fix-python313.patch
deleted file mode 100644
index 0b68c0560d51e..0000000000000
--- a/pkgs/by-name/op/openvswitch/patches/fix-python313.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/tests/vlog.at b/tests/vlog.at
-index 785014956e7..efe91479a63 100644
---- a/tests/vlog.at
-+++ b/tests/vlog.at
-@@ -8,6 +8,7 @@ AT_CHECK([$PYTHON3 $srcdir/test-vlog.py --log-file log_file \
- 
- AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z |//' \
- -e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \
-+-e '/\^\+/d' \
- stderr_log], [0], [dnl
-   0  | module_0 | EMER | emergency
-   1  | module_0 | ERR | error
diff --git a/pkgs/by-name/op/openvswitch/update.nu b/pkgs/by-name/op/openvswitch/update.nu
deleted file mode 100755
index 60e462f4625ed..0000000000000
--- a/pkgs/by-name/op/openvswitch/update.nu
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env nix-shell
-#!nix-shell -i nu -p nushell common-updater-scripts
-
-def main [--lts = false, --regex: string] {
-  let tags = list-git-tags --url=https://github.com/openvswitch/ovs | 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 $"openvswitch(if $lts {"-lts"}).version" | str trim
-
-  if $latest_tag != $current_version {
-    if $lts {
-      update-source-version openvswitch-lts $latest_tag $"--file=(pwd)/pkgs/by-name/op/openvswitch/lts.nix"
-    } else {
-      update-source-version openvswitch $latest_tag $"--file=(pwd)/pkgs/by-name/op/openvswitch/default.nix"
-    }
-  }
-
-  {"lts?": $lts, before: $current_version, after: $latest_tag}
-}