-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildbot: Python 3 support and other improvements #45890
Conversation
cc @dotlambda |
ln -sfv ${package}/lib $out/lib | ||
''; | ||
# Can't use runCommand because it does not support propagatedBuildInputs | ||
withPlugins = plugins: toPythonModule (stdenv.mkDerivation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use buildPythonPackage
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can simply be python.withPackages
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we really should move buildbot into python-packages, however, if we do this, then the expressions should live there as well (python-modules/
), and more importantly, no expressions should use buildPythonApplication
.
propagatedBuildInputs = [ six twisted zope_interface txaio ] ++ | ||
(stdenv.lib.optional isPy33 asyncio) ++ | ||
(stdenv.lib.optionals (!isPy3k) [ trollius futures ]); | ||
|
||
# Upstream claim python2 support, but tests require pytest-asyncio which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trollius 2 is needed for asyncio support
ln -sfv ${package}/lib $out/lib | ||
''; | ||
# Can't use runCommand because it does not support propagatedBuildInputs | ||
withPlugins = plugins: toPythonModule (stdenv.mkDerivation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can simply be python.withPackages
.
I still think that it is easier if we put it in |
856b4b4
to
6586375
Compare
73c3ff0
to
87a3737
Compare
87a3737
to
2977cd6
Compare
I think I have addressed all the issues that were brought up. I had to add a few new commits to fix @nand0p I kept you as the maintainer of the 1.x branches of Buildbot just updated to 1.4.0, and its tests now pass for Python 2 and 3. |
69fb188
to
c99bfcb
Compare
ff936f2
to
b56e346
Compare
I rebased against master and moved the changelog entry to the 19.03 changelog. |
cf05986
to
86c10a7
Compare
nixos/modules/services/continuous-integration/buildbot/master.nix
Outdated
Show resolved
Hide resolved
nixos/modules/services/continuous-integration/buildbot/worker.nix
Outdated
Show resolved
Hide resolved
@GrahamcOfBorg test buildbot.python2 buildbot.python3 |
Success on aarch64-linux (full log) Attempted: tests.buildbot.python2, tests.buildbot.python3 Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: tests.buildbot.python2, tests.buildbot.python3 Partial log (click to expand)
|
86c10a7
to
73c523a
Compare
@infinisil I fixed the issues you brought up. Should this go into staging? Also, there may be some buildbot users on 18.03 who will find their configs broken when they upgrade to 18.09, so we may want to backport this eventually. I'm not sure if we would backport the whole PR, or just the minimum to fix the build. |
I think master is alright. Feel free to open another PR with a backport if you feel it's necessary. Thanks for the PR, the NixOS test is very nice too :) |
Motivation for this change
The latest versions of
pylint
andastroid
do not support Python 2, which breaks buildbot (#45782) because it only supports Python 2 in nixpkgs. Buildbot supports Python 3, but this is potentially a breaking change because buildbot uses Python in its configuration files. Therefore, this PR adds configurable support for Python 2 or 3, which Python 2 being the default. The 1.0 branches ofpylint
andastroid
are still supported until Python 2's EOL, so they are used to build buildbot with Python 2.This PR supersedes #45789.
Things done
First, I updated and added Python 3 support to
sphinx-jinja
. This mainly required fixing how the tests were run. This commit supersedes #45763.I updated
tempita
to use a fork that adds Python 3 support. The upstream tempita package appears to be abandoned. This fork is used by the official Arch Linux package of tempita, but is somewhat undesirable because it is not an official release. This commit supersedes #39692.I updated
astroid
andpylint
to their latest versions, and addedastroid1
andpylint1
packages which use the still maintained 1.0 branch of these packages. Because there are a number of different ways to implement packages with multiple versions in Nix, I'm not sure if I chose the best way.While I was testing I ran into #40273, which is supposedly fixed but does not seem to be (see #40273 (comment)). To work around this I changed
hyperlink
to not use pytest to run its tests (the defaultcheckPhase
seems to work fine) and made some changes toautobahn
(which do not fix the problem, but only one package needs to be fixed for the conflict to be resolved). These changes are not critical, because they should not be necessary once #40273 is truly fixed, but I included them anyway because I believe they result in cleaner derivations.I then updated all the components of buildbot to 1.3.0.
buildbot-worker
had already been updated by an automated update, but the rest of the components had not. This has happened a number of times recently and sometimes causes problems, especially whenbuildbot-pkg
is updated without updating the plugins.The last commit adds Python 3 support as well as a number of other improvements that I have been running locally for about a year. There are no intentional breaking changes, but I have not tested every possible scenario.
All the buildbot packages are moved to
pythonPackages
. A newpython
attribute is added to each package's passthru, allowing the NixOS module to determine which version of Python to use. The tests are currently disabled for both Python 2 and 3, because a test fails due to what appears to be a bug in buildbot. I attempted to disable the failing test, but this simply causes the error to move to a different test and so on. The error message (see comment abovedoCheck = false
) relates to a recently added buildbot feature, so this points to a problem with buildbot.I changed how the plugin wrapper works, making the wrapped package into a Python module that can be added to a Python environment using
python.withPackages
.In the
buildbot-master
NixOS module, I switched to directly invokingtwistd
(as was already done withbuildbot-worker
) in order to log to stdout and therefore the systemd journal, rather than a file. I also added a newpythonPackages
option, which takes a function that is passed topython.withPackages
and is used to set the service'sPYTHONPATH
. I also generate the twisted tac file within the module, rather than usingcreate-master
(create-master
is still necessary to create the database). This gives more control over the initialization process (especially useful forbuildbot-worker
).In the
buildbot-worker
NixOS module, I made similar improvements to thePYTHONPATH
handling, but did not add apythonPackages
option because workers never run user Python code AFAIK. I also generate the tac file in the module, which makes it possible to implement theworkerPassFile
option (checks one of the boxes in #24288). I also addedhostMessage
andadminMessage
options, which allow users to declaratively set those messages.The
buildbot
NixOS test passes, including the commented out daemon test, which supposedly was previously broken. I configured the tests to run with both Python 2 and 3.I would appreciate it if other buildbot users would test this PR. I have only run the tests and used it with my buildbot deployment, which has a number of customizations with might obscure bugs.
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)