From 164036d728eea2ee487500816ccfc95d3042992b Mon Sep 17 00:00:00 2001
From: Fernando J Pando <fernando.pando@stelligent.com>
Date: Thu, 15 Sep 2016 19:16:23 -0400
Subject: [PATCH 1/3] buildbot: 0.9.0rc2 -> 0.9.0rc3

Tested on Linux
Tested Binary Execution
---
 .../buildbot/{9.nix => default.nix}           | 13 +-----
 .../tools/build-managers/buildbot/plugins.nix | 41 +++++++++----------
 .../tools/build-managers/buildbot/worker.nix  |  9 ++--
 3 files changed, 27 insertions(+), 36 deletions(-)
 rename pkgs/development/tools/build-managers/buildbot/{9.nix => default.nix} (66%)

diff --git a/pkgs/development/tools/build-managers/buildbot/9.nix b/pkgs/development/tools/build-managers/buildbot/default.nix
similarity index 66%
rename from pkgs/development/tools/build-managers/buildbot/9.nix
rename to pkgs/development/tools/build-managers/buildbot/default.nix
index 0f33cd0c664..b38395693e3 100644
--- a/pkgs/development/tools/build-managers/buildbot/9.nix
+++ b/pkgs/development/tools/build-managers/buildbot/default.nix
@@ -7,10 +7,10 @@
 pythonPackages.buildPythonApplication (rec {
   name = "${pname}-${version}";
   pname = "buildbot";
-  version = "0.9.0rc2";
+  version = "0.9.0rc3";
   src = fetchurl {
     url = "mirror://pypi/b/${pname}/${name}.tar.gz";
-    sha256 = "06xzbjzji3by4hldwr850fc989ymsfl2s8nil21klv2g00dgmcmk";
+    sha256 = "18238n9l0pfivb23csy5lnkx91fcm4jgmhxn03f2nfnp00rlppzb";
   };
 
   buildInputs = with pythonPackages; [
@@ -59,15 +59,6 @@ pythonPackages.buildPythonApplication (rec {
   ] ++ plugins;
 
   preInstall = ''
-    # buildbot tries to import 'buildslaves' but does not
-    # include the module in it's package, so get rid of those references
-    sed -i.bak -e '66,$d' buildbot/test/__init__.py
-    sed -i.bak -e '506,$d' buildbot/test/unit/test_worker_base.py
-    sed -i.bak -e '648,$d' buildbot/test/unit/test_worker_ec2.py
-    sed -i.bak -e '289,$d' buildbot/test/unit/test_worker_libvirt.py
-    sed -i.bak -e '190,$d' buildbot/test/unit/test_worker_openstack.py
-    sed -i.bak -e '60,84d' buildbot/test/integration/test_configs.py
-
     # writes out a file that can't be read properly
     sed -i.bak -e '69,84d' buildbot/test/unit/test_www_config.py
   '';
diff --git a/pkgs/development/tools/build-managers/buildbot/plugins.nix b/pkgs/development/tools/build-managers/buildbot/plugins.nix
index 177b7b3d946..384452e27d9 100644
--- a/pkgs/development/tools/build-managers/buildbot/plugins.nix
+++ b/pkgs/development/tools/build-managers/buildbot/plugins.nix
@@ -5,21 +5,17 @@
 
 let
   buildbot-pkg = pythonPackages.buildPythonPackage rec {
-    name = "buildbot-pkg-${version}";
-    version = "0.9.0rc2";
+    name = "${pname}-${version}";
+    pname = "buildbot-pkg";
+    version = "0.9.0rc3";
 
     src = fetchurl {
-      url = "https://pypi.python.org/packages/95/47/1fef931d410cc24127564c2e193e7c1c184f5c5f481930f77c6d6840cfab/${name}.tar.gz";
-      sha256 = "01wc9bmqq1rfayqnjm7rkjhbcj7h6ah4vv10s6hglnq9s4axvxp6";
+      url = "mirror://pypi/b/${pname}/${name}.tar.gz";
+      sha256 = "0a05dgc5nn6sx3nicfvqwar9iy8yxhq92688dhs5p6mzjxaprlxm";
     };
 
     propagatedBuildInputs = with pythonPackages; [ setuptools ];
 
-    # doesn't seem to break without this...
-    patchPhase = ''
-      sed -i.bak -e '/"setuptools >= 21.2.1",/d' setup.py
-    '';
-
     meta = with stdenv.lib; {
       homepage = http://buildbot.net/;
       description = "Buildbot Packaging Helper";
@@ -31,14 +27,15 @@ let
 in {
 
   www = pythonPackages.buildPythonPackage rec {
-    name = "buildbot_www-${version}";
-    version = "0.9.0rc2";
+    name = "${pname}-${version}";
+    pname = "buildbot_www";
+    version = "0.9.0rc3";
 
     # NOTE: wheel is used due to buildbot circular dependency
     format = "wheel";
     src = fetchurl {
-      url = "https://pypi.python.org/packages/e0/d7/f1023cdb7340a15ee1fc9916e87c4d634405a87164a051e2c59bf9d51ef1/${name}-py2-none-any.whl";
-      sha256 = "1006x56x4w4p2mbrzm7jy51c0xxz48lzhdwvx7j4hrjs07mapndj";
+      url = "https://pypi.python.org/packages/93/1e/09e329fc831ae4f5be05eb3363c9028ab7e26e9c7e5d89e3aa66c3f25d9d/${name}-py2-none-any.whl";
+      sha256 = "0fy2v7y1kc53zm67ddx85yz5qh4b7hmcbfzmsziiv9n83a0qh1i6";
     };
 
     propagatedBuildInputs = [ buildbot-pkg ];
@@ -52,12 +49,13 @@ in {
   };
 
   console-view = pythonPackages.buildPythonPackage rec {
-    name = "buildbot-console-view-${version}";
-    version = "0.9.0rc2";
+    name = "${pname}-${version}";
+    pname = "buildbot-console-view";
+    version = "0.9.0rc3";
 
     src = fetchurl {
-      url = "https://pypi.python.org/packages/f4/51/e24cc1b596e5b262a272cba3687476a13ec7d9ea24bf1f4fd0cd72902bb6/${name}.tar.gz";
-      sha256 = "0970gq1sxnfd0nlrnd3mj25i3cginlw2pj5ffqsd57n5hlqg48ib";
+      url = "mirror://pypi/b/${pname}/${name}.tar.gz";
+      sha256 = "09yfqrnwfambg1j4x7ywnjg4xfhvv6f242zzh35fwj64cnqmqx07";
     };
 
     propagatedBuildInputs = [ buildbot-pkg ];
@@ -71,12 +69,13 @@ in {
   };
 
   waterfall-view = pythonPackages.buildPythonPackage rec {
-    name = "buildbot-waterfall-view-${version}";
-    version = "0.9.0rc2";
+    name = "${pname}-${version}";
+    pname = "buildbot-waterfall-view";
+    version = "0.9.0rc3";
 
     src = fetchurl {
-      url = "https://pypi.python.org/packages/c2/21/3895355b05f91977a8b8e5435f85354e927c2ef547a25432a6bacf792a67/${name}.tar.gz";
-      sha256 = "1zybrbbsyplv93zkin8cb3z1bqqr6px4p203ldcpn7lds5s9vk00";
+      url = "mirror://pypi/b/${pname}/${name}.tar.gz";
+      sha256 = "0xpqxj3mmwl5xdhm3p52shl24d85qapdk4v66f9hrb9pnk5k4a81";
     };
 
     propagatedBuildInputs = [ buildbot-pkg ];
diff --git a/pkgs/development/tools/build-managers/buildbot/worker.nix b/pkgs/development/tools/build-managers/buildbot/worker.nix
index 36b57a41aa7..2c8e17a37c0 100644
--- a/pkgs/development/tools/build-managers/buildbot/worker.nix
+++ b/pkgs/development/tools/build-managers/buildbot/worker.nix
@@ -4,12 +4,13 @@
 }:
 
 pythonPackages.buildPythonApplication (rec {
-  name = "buildbot-worker-${version}";
-  version = "0.9.0rc2";
+  name = "${pname}-${version}";
+  pname = "buildbot-worker";
+  version = "0.9.0rc3";
 
   src = fetchurl {
-    url = "https://pypi.python.org/packages/6a/be/ae80e5e87bc92ac813cd944c08d3b6168090145fc168e7a553e88c07067a/${name}.tar.gz";
-    sha256 = "19l28s2fyzln6nv2ypbdg11xiz7lrjy0n64fzhngfalv61x2bp8j";
+    url = "mirror://pypi/b/${pname}/${name}.tar.gz";
+    sha256 = "0wqn2176rk7hc27r4hfy5qnxp0nr9iis5nyzg5x07xljnsspnhy1";
   };
 
   buildInputs = with pythonPackages; [ setuptoolsTrial mock ];

From 57726b54aff392d9bc88387bcd4b36d34a934d1d Mon Sep 17 00:00:00 2001
From: Fernando J Pando <fernando.pando@stelligent.com>
Date: Thu, 15 Sep 2016 19:17:49 -0400
Subject: [PATCH 2/3] Remove obsolete buildbot slave

buildbot-slave has been replaced with buildbot-worker.
---
 .../build-managers/buildbot-slave/default.nix | 66 -------------------
 pkgs/top-level/aliases.nix                    |  1 -
 pkgs/top-level/all-packages.nix               |  6 +-
 3 files changed, 1 insertion(+), 72 deletions(-)
 delete mode 100644 pkgs/development/tools/build-managers/buildbot-slave/default.nix

diff --git a/pkgs/development/tools/build-managers/buildbot-slave/default.nix b/pkgs/development/tools/build-managers/buildbot-slave/default.nix
deleted file mode 100644
index a5f86d105c3..00000000000
--- a/pkgs/development/tools/build-managers/buildbot-slave/default.nix
+++ /dev/null
@@ -1,66 +0,0 @@
-{ stdenv, buildPythonApplication, fetchurl, coreutils, twisted }:
-
-buildPythonApplication (rec {
-  name = "buildbot-slave-0.8.10";
-  namePrefix = "";
-
-  src = fetchurl {
-    url = "mirror://pypi/b/buildbot-slave/${name}.tar.gz";
-    sha256 = "09pncw44c7vqrl7zyn1nvfismiqi9s51axk9cqxn9gq7jhj38mpg";
-  };
-
-  patchPhase = ''
-    substituteInPlace buildslave/scripts/logwatcher.py --replace /usr/bin/tail ${coreutils}/bin/tail
-  '';
-
-  propagatedBuildInputs = [ twisted ];
-
-  # What's up with this?! 'trial' should be 'test', no?
-  #
-  # running tests
-  # usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
-  #    or: setup.py --help [cmd1 cmd2 ...]
-  #    or: setup.py --help-commands
-  #    or: setup.py cmd --help
-  #
-  # error: invalid command 'trial'
-  doCheck = false;
-
-  postInstall = ''
-    mkdir -p "$out/share/man/man1"
-    cp docs/buildslave.1 "$out/share/man/man1"
-  '';
-
-  meta = with stdenv.lib; {
-    homepage = http://buildbot.net/;
-
-    license = stdenv.lib.licenses.gpl2Plus;
-
-    description = "Continuous integration system that automates the build/test cycle";
-
-    longDescription =
-      '' The BuildBot is a system to automate the compile/test cycle
-         required by most software projects to validate code changes.  By
-         automatically rebuilding and testing the tree each time something
-         has changed, build problems are pinpointed quickly, before other
-         developers are inconvenienced by the failure.  The guilty
-         developer can be identified and harassed without human
-         intervention.  By running the builds on a variety of platforms,
-         developers who do not have the facilities to test their changes
-         everywhere before checkin will at least know shortly afterwards
-         whether they have broken the build or not.  Warning counts, lint
-         checks, image size, compile time, and other build parameters can
-         be tracked over time, are more visible, and are therefore easier
-         to improve.
-
-         The overall goal is to reduce tree breakage and provide a platform
-         to run tests or code-quality checks that are too annoying or
-         pedantic for any human to waste their time with.  Developers get
-         immediate (and potentially public) feedback about their changes,
-         encouraging them to be more careful about testing before checking
-         in code.
-      '';
-    maintainers = with maintainers; [ bjornfor ];
-    platforms = platforms.all;
-  };
-})
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index ee3aaa70b24..07ec4a424a5 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -26,7 +26,6 @@ doNotDisplayTwice rec {
   bar-xft = lemonbar-xft;  # added 2015-01-16
   bridge_utils = bridge-utils;  # added 2015-02-20
   btrfsProgs = btrfs-progs; # added 2016-01-03
-  buildbotSlave = buildbot-slave;  # added 2014-12-09
   bundler_HEAD = bundler; # added 2015-11-15
   checkbashism = checkbashisms; # added 2016-08-16
   cheetahTemplate = pythonPackages.cheetah; # 2015-06-15
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a008a119e76..fa8d57cf8ea 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6227,11 +6227,7 @@ in
     wxGTK = wxGTK30;
   };
 
-  buildbot-slave = callPackage ../development/tools/build-managers/buildbot-slave {
-    inherit (pythonPackages) twisted;
-  };
-
-  buildbot = callPackage ../development/tools/build-managers/buildbot/9.nix { };
+  buildbot = callPackage ../development/tools/build-managers/buildbot { };
   buildbot-worker = callPackage ../development/tools/build-managers/buildbot/worker.nix { };
   buildbot-plugins = callPackage ../development/tools/build-managers/buildbot/plugins.nix { };
   buildbot-ui = self.buildbot.override {

From b31b26262360c67332f60c4f6caef9a51a12b4c8 Mon Sep 17 00:00:00 2001
From: Fernando J Pando <fernando.pando@stelligent.com>
Date: Fri, 16 Sep 2016 16:27:45 -0400
Subject: [PATCH 3/3] buildbot: 0.9.0rc3 wrapper fix

- Tested on Linux
- Tested binary execution
- Fixes missing PYTHONPATH
---
 .../tools/build-managers/buildbot/default.nix          | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pkgs/development/tools/build-managers/buildbot/default.nix b/pkgs/development/tools/build-managers/buildbot/default.nix
index b38395693e3..4431105d18f 100644
--- a/pkgs/development/tools/build-managers/buildbot/default.nix
+++ b/pkgs/development/tools/build-managers/buildbot/default.nix
@@ -63,6 +63,16 @@ pythonPackages.buildPythonApplication (rec {
     sed -i.bak -e '69,84d' buildbot/test/unit/test_www_config.py
   '';
 
+  postFixup = ''
+    buildPythonPath "$out"
+    patchPythonScript "$out/bin/buildbot"
+    mv -v $out/bin/buildbot $out/bin/.wrapped-buildbot
+    echo "#!/bin/bash" > $out/bin/buildbot
+    echo "export PYTHONPATH=$out/lib/python2.7/site-packages:$PYTHONPATH" >> $out/bin/buildbot
+    echo "exec $out/bin/.wrapped-buildbot \"\$@\"" >> $out/bin/buildbot
+    chmod -c 755 $out/bin/buildbot
+  '';
+
   meta = with stdenv.lib; {
     homepage = http://buildbot.net/;
     description = "Continuous integration system that automates the build/test cycle";