From 4561a649f41554f9c47c0405079a909a1b51db2f Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@users.noreply.github.com>
Date: Sat, 28 May 2016 15:02:04 +0100
Subject: [PATCH] openvswitch: 2.3.1 -> 2.5.0 (#15729)

---
 .../os-specific/linux/openvswitch/default.nix | 21 ++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/pkgs/os-specific/linux/openvswitch/default.nix b/pkgs/os-specific/linux/openvswitch/default.nix
index 0e5dbeebf921..b1e24884557a 100644
--- a/pkgs/os-specific/linux/openvswitch/default.nix
+++ b/pkgs/os-specific/linux/openvswitch/default.nix
@@ -1,22 +1,24 @@
-{ stdenv, fetchurl, makeWrapper
-, openssl, python27, iproute, perl, kernel ? null }:
+{ stdenv, fetchurl, makeWrapper, pkgconfig, utillinux, which
+, procps, libcap_ng, openssl, python27, iproute , perl
+, kernel ? null }:
 
 with stdenv.lib;
 
 let
   _kernel = kernel;
 in stdenv.mkDerivation rec {
-  version = "2.3.1";
+  version = "2.5.0";
   name = "openvswitch-${version}";
 
   src = fetchurl {
     url = "http://openvswitch.org/releases/${name}.tar.gz";
-    sha256 = "1lmwyhm5wmdv1l4v1v5xd36d5ra21jz9ix57nh1lgm8iqc0lj5r1";
+    sha256 = "08bgsqjjn2q5hvxsjqs7n3jir7k7291wlj3blsqhacjhmpxm9nil";
   };
 
   kernel = optional (_kernel != null) _kernel.dev;
 
-  buildInputs = [ makeWrapper openssl python27 perl ];
+  buildInputs = [ makeWrapper pkgconfig utillinux openssl libcap_ng python27
+                  perl procps which ];
 
   configureFlags = [
     "--localstatedir=/var"
@@ -31,6 +33,15 @@ in stdenv.mkDerivation rec {
     "PKIDIR=$(TMPDIR)/dummy"
   ];
 
+  postBuild = ''
+    # fix tests
+    substituteInPlace xenserver/opt_xensource_libexec_interface-reconfigure --replace '/usr/bin/env python' '${python27.interpreter}'
+    substituteInPlace vtep/ovs-vtep --replace '/usr/bin/env python' '${python27.interpreter}'
+  '';
+
+  enableParallelBuilding = true;
+  doCheck = false; # bash-completion test fails with "compgen: command not found"
+
   postInstall = ''
     cp debian/ovs-monitor-ipsec $out/share/openvswitch/scripts
     makeWrapper \