Merge pull request #294353 from lf-/jade/buildbot-untie

buildbot: tie the knot through a scope to make it overridable
This commit is contained in:
Jörg Thalheim 2024-03-09 09:20:10 +01:00 committed by GitHub
commit 52d9c7906c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 121 additions and 126 deletions

View file

@ -1,36 +1,31 @@
{ python3 { lib
, fetchPypi , newScope
, python3
, recurseIntoAttrs , recurseIntoAttrs
, callPackage
}: }:
let # Take packages from self first, then python.pkgs (and secondarily pkgs)
lib.makeScope (self: newScope (self.python.pkgs // self)) (self: {
python = python3.override { python = python3.override {
packageOverrides = self: super: { packageOverrides = self: super: {
sqlalchemy = super.sqlalchemy_1_4; sqlalchemy = super.sqlalchemy_1_4;
moto = super.moto.overridePythonAttrs (oldAttrs: rec { moto = super.moto.overridePythonAttrs (oldAttrs: {
# a lot of tests -> very slow, we already build them when building python packages # a lot of tests -> very slow, we already build them when building python packages
doCheck = false; doCheck = false;
}); });
}; };
}; };
buildbot-pkg = python.pkgs.callPackage ./pkg.nix { buildbot-pkg = self.callPackage ./pkg.nix { };
inherit buildbot;
}; buildbot-worker = self.callPackage ./worker.nix { };
buildbot-worker = python3.pkgs.callPackage ./worker.nix {
inherit buildbot; buildbot = self.callPackage ./master.nix { };
};
buildbot = python.pkgs.callPackage ./master.nix { buildbot-plugins = recurseIntoAttrs (self.callPackage ./plugins.nix { });
inherit buildbot-pkg buildbot-worker buildbot-plugins;
}; buildbot-ui = self.buildbot.withPlugins (with self.buildbot-plugins; [ www ]);
buildbot-plugins = recurseIntoAttrs (callPackage ./plugins.nix {
inherit buildbot-pkg; buildbot-full = self.buildbot.withPlugins (with self.buildbot-plugins; [
});
in
{
inherit buildbot buildbot-plugins buildbot-worker;
buildbot-ui = buildbot.withPlugins (with buildbot-plugins; [ www ]);
buildbot-full = buildbot.withPlugins (with buildbot-plugins; [
www console-view waterfall-view grid-view wsgi-dashboards badges www console-view waterfall-view grid-view wsgi-dashboards badges
]); ]);
} })

View file

@ -1,9 +1,11 @@
{ lib { lib
, stdenv , stdenv
, buildPythonPackage
, buildPythonApplication , buildPythonApplication
, fetchPypi , fetchPypi
, makeWrapper , makeWrapper
# Tie withPlugins through the fixed point here, so it will receive an
# overridden version properly
, buildbot
, pythonOlder , pythonOlder
, python , python
, twisted , twisted
@ -38,13 +40,12 @@
, unidiff , unidiff
, glibcLocales , glibcLocales
, nixosTests , nixosTests
, callPackage
}: }:
let let
withPlugins = plugins: buildPythonApplication { withPlugins = plugins: buildPythonApplication {
pname = "${package.pname}-with-plugins"; pname = "${buildbot.pname}-with-plugins";
inherit (package) version; inherit (buildbot) version;
format = "other"; format = "other";
dontUnpack = true; dontUnpack = true;
@ -55,20 +56,20 @@ let
makeWrapper makeWrapper
]; ];
propagatedBuildInputs = plugins ++ package.propagatedBuildInputs; propagatedBuildInputs = plugins ++ buildbot.propagatedBuildInputs;
installPhase = '' installPhase = ''
makeWrapper ${package}/bin/buildbot $out/bin/buildbot \ makeWrapper ${buildbot}/bin/buildbot $out/bin/buildbot \
--prefix PYTHONPATH : "${package}/${python.sitePackages}:$PYTHONPATH" --prefix PYTHONPATH : "${buildbot}/${python.sitePackages}:$PYTHONPATH"
ln -sfv ${package}/lib $out/lib ln -sfv ${buildbot}/lib $out/lib
''; '';
passthru = package.passthru // { passthru = buildbot.passthru // {
withPlugins = morePlugins: withPlugins (morePlugins ++ plugins); withPlugins = morePlugins: withPlugins (morePlugins ++ plugins);
}; };
}; };
in
package = buildPythonApplication rec { buildPythonApplication rec {
pname = "buildbot"; pname = "buildbot";
version = "3.11.1"; version = "3.11.1";
format = "pyproject"; format = "pyproject";
@ -160,5 +161,4 @@ let
license = licenses.gpl2Only; license = licenses.gpl2Only;
broken = stdenv.isDarwin; broken = stdenv.isDarwin;
}; };
}; }
in package

View file

@ -3581,8 +3581,8 @@ with pkgs;
bucklespring-libinput = callPackage ../applications/audio/bucklespring { }; bucklespring-libinput = callPackage ../applications/audio/bucklespring { };
bucklespring-x11 = callPackage ../applications/audio/bucklespring { legacy = true; }; bucklespring-x11 = callPackage ../applications/audio/bucklespring { legacy = true; };
inherit (python3.pkgs.callPackage ../development/tools/continuous-integration/buildbot {}) buildbotPackages = recurseIntoAttrs (python3.pkgs.callPackage ../development/tools/continuous-integration/buildbot { });
buildbot buildbot-ui buildbot-full buildbot-plugins buildbot-worker; inherit (buildbotPackages) buildbot buildbot-ui buildbot-full buildbot-plugins buildbot-worker;
bunyan-rs = callPackage ../development/tools/bunyan-rs { }; bunyan-rs = callPackage ../development/tools/bunyan-rs { };