krebs buildbot: reintroduce packages with minimal overrides

This commit is contained in:
lassulus 2017-07-25 23:10:51 +02:00
parent 826da6c222
commit 7aa31b7bab
4 changed files with 76 additions and 39 deletions

View File

@ -2,22 +2,6 @@
with import <stockholm/lib>;
let
# https://github.com/NixOS/nixpkgs/issues/14026
nixpkgs-fix = import (pkgs.fetchgit {
url = https://github.com/nixos/nixpkgs;
rev = "e026b5c243ea39810826e68362718f5d703fb5d0";
sha256 = "11lqd480bi6xbi7xbh4krrxmbp6a6iafv1d0q3sj461al0x0has8";
}) {};
buildbot = nixpkgs-fix.buildbot.overrideDerivation (old: {
postUnpack = "sourceRoot=\${sourceRoot}/master";
patches = [];
src = pkgs.fetchFromGitHub {
owner = "krebscode";
repo = "buildbot-classic";
rev = "5b4f5f6f1";
sha256 = "1j3xn1gjzvsf90jvfmyln71fzlhjx642ivrqf47zfxpkacljja93"; };});
buildbot-master-config = pkgs.writeText "buildbot-master.cfg" ''
# -*- python -*-
from buildbot.plugins import *
@ -364,7 +348,7 @@ let
set -efux
if [ ! -e ${workdir} ];then
mkdir -p ${workdir}
${buildbot}/bin/buildbot create-master -r -l 10 -f ${workdir}
${pkgs.buildbot-classic}/bin/buildbot create-master -r -l 10 -f ${workdir}
fi
# always override the master.cfg
cp ${buildbot-master-config} ${workdir}/master.cfg
@ -373,18 +357,18 @@ let
${ concatMapStringsSep "\n"
(f: "cp ${secretsdir}/${f} ${workdir}/${f}" ) cfg.secrets }
# sanity
${buildbot}/bin/buildbot checkconfig ${workdir}
${pkgs.buildbot-classic}/bin/buildbot checkconfig ${workdir}
# TODO: maybe upgrade? not sure about this
# normally we should write buildbot.tac by our own
# ${buildbot}/bin/buildbot upgrade-master ${workdir}
# ${pkgs.buildbot-classic}/bin/buildbot upgrade-master ${workdir}
chmod 700 -R ${workdir}
chown buildbotMaster:buildbotMaster -R ${workdir}
'';
ExecStart = "${buildbot}/bin/buildbot start ${workdir}";
ExecStop = "${buildbot}/bin/buildbot stop ${workdir}";
ExecReload = "${buildbot}/bin/buildbot reconfig ${workdir}";
ExecStart = "${pkgs.buildbot-classic}/bin/buildbot start ${workdir}";
ExecStop = "${pkgs.buildbot-classic}/bin/buildbot stop ${workdir}";
ExecReload = "${pkgs.buildbot-classic}/bin/buildbot reconfig ${workdir}";
PrivateTmp = "true";
User = "buildbotMaster";
Restart = "always";

View File

@ -2,20 +2,6 @@
with import <stockholm/lib>;
let
# https://github.com/NixOS/nixpkgs/issues/14026
nixpkgs-fix = import (pkgs.fetchgit {
url = https://github.com/nixos/nixpkgs;
rev = "e026b5c243ea39810826e68362718f5d703fb5d0";
sha256 = "11lqd480bi6xbi7xbh4krrxmbp6a6iafv1d0q3sj461al0x0has8";
}) {};
pkg = nixpkgs-fix.buildbot-slave.overrideDerivation (old: {
postUnpack = "sourceRoot=\${sourceRoot}/slave";
patches = [];
src = pkgs.fetchFromGitHub {
owner = "krebscode";
repo = "buildbot-classic";
rev = "5b4f5f6f1";
sha256 = "1j3xn1gjzvsf90jvfmyln71fzlhjx642ivrqf47zfxpkacljja93"; };});
buildbot-slave-init = pkgs.writeText "buildbot-slave.tac" ''
import os
@ -166,7 +152,6 @@ let
workdir = shell.escape cfg.workDir;
contact = shell.escape cfg.contact;
description = shell.escape cfg.description;
buildbot = pkg;
# TODO:make this
in {
PermissionsStartOnly = true;
@ -183,8 +168,8 @@ let
chown buildbotSlave:buildbotSlave -R ${workdir}
chmod 700 -R ${workdir}
'';
ExecStart = "${buildbot}/bin/buildslave start ${workdir}";
ExecStop = "${buildbot}/bin/buildslave stop ${workdir}";
ExecStart = "${pkgs.buildbot-classic-slave}/bin/buildslave start ${workdir}";
ExecStop = "${pkgs.buildbot-classic-slave}/bin/buildslave stop ${workdir}";
PrivateTmp = "true";
User = "buildbotSlave";
Restart = "always";

View File

@ -0,0 +1,21 @@
{ coreutils, fetchgit, fetchFromGitHub, buildbot-classic, python2Packages, ... }:
python2Packages.buildPythonApplication {
name = "buildbot-slave-0.8.12";
namePrefix = "";
src = buildbot-classic.src;
postUnpack = "sourceRoot=\${sourceRoot}/slave";
patchPhase = ''
substituteInPlace buildslave/scripts/logwatcher.py --replace /usr/bin/tail ${coreutils}/bin/tail
'';
propagatedBuildInputs = [ python2Packages.twisted ];
doCheck = false;
postInstall = ''
mkdir -p "$out/share/man/man1"
cp docs/buildslave.1 "$out/share/man/man1"
'';
}

View File

@ -0,0 +1,47 @@
{ fetchgit, fetchFromGitHub, python2Packages, ... }:
let
# https://github.com/NixOS/nixpkgs/issues/14026
nixpkgs-fix = import (fetchgit {
url = https://github.com/nixos/nixpkgs;
rev = "e026b5c243ea39810826e68362718f5d703fb5d0";
sha256 = "11lqd480bi6xbi7xbh4krrxmbp6a6iafv1d0q3sj461al0x0has8";
}) {};
in nixpkgs-fix.buildPythonApplication {
name = "buildbot-0.8.12";
namePrefix = "";
patches = [];
src = fetchFromGitHub {
owner = "krebscode";
repo = "buildbot-classic";
rev = "5b4f5f6f1";
sha256 = "1j3xn1gjzvsf90jvfmyln71fzlhjx642ivrqf47zfxpkacljja93";
};
postUnpack = "sourceRoot=\${sourceRoot}/master";
patchPhase =
# The code insists on /usr/bin/tail, /usr/bin/make, etc.
'' echo "patching erroneous absolute path references..."
for i in $(find -name \*.py)
do
sed -i "$i" \
-e "s|/usr/bin/python|$(type -P python)|g ; s|/usr/bin/||g"
done
sed -i 's/==/>=/' setup.py
'';
propagatedBuildInputs = [
python2Packages.jinja2
python2Packages.twisted
nixpkgs-fix.pythonPackages.dateutil_1_5
nixpkgs-fix.pythonPackages.sqlalchemy_migrate_0_7
];
doCheck = false;
postInstall = ''
mkdir -p "$out/share/man/man1"
cp docs/buildbot.1 "$out/share/man/man1"
'';
}