Skip to content
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

stdenv: implement most of #33599 #39464

Merged
merged 8 commits into from Apr 30, 2018
Merged

Conversation

oxij
Copy link
Member

@oxij oxij commented Apr 25, 2018

Motivation for this change

#33599. This PR implements the main feature needed to implement #33599: checkTarget autodetection.

Set config.doCheckByDefault = true and behold how many failed tests there are. I will PR a huge bunch of fixes for those bugs later (after I rebuild everything myself on top of this version), see #39463 and linked PRs.

Things done
  • When combined with other patches in the series the system builds.
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

shrinking /nix/store/6xnnwblimc9pdwllz119k54npqgl8hv5-findutils-4.6.0/libexec/code
shrinking /nix/store/6xnnwblimc9pdwllz119k54npqgl8hv5-findutils-4.6.0/libexec/bigram
gzipping man pages under /nix/store/6xnnwblimc9pdwllz119k54npqgl8hv5-findutils-4.6.0/share/man/
strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
stripping (with command strip and flags -S) in /nix/store/6xnnwblimc9pdwllz119k54npqgl8hv5-findutils-4.6.0/libexec  /nix/store/6xnnwblimc9pdwllz119k54npqgl8hv5-findutils-4.6.0/bin
checking for references to /build in /nix/store/6xnnwblimc9pdwllz119k54npqgl8hv5-findutils-4.6.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/slrm1xv0sb8wyqr60rnxwy8mar0w2fmb-findutils-4.6.0-info
strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/slrm1xv0sb8wyqr60rnxwy8mar0w2fmb-findutils-4.6.0-info...
building '/nix/store/2kn3am97iq2r4jhmxwasgz14sdhv3vh4-stdenv-linux.drv'...

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

shrinking /nix/store/l380pczq5y1l4rbairiq8x3s6cfc3php-findutils-4.6.0/bin/find
gzipping man pages under /nix/store/l380pczq5y1l4rbairiq8x3s6cfc3php-findutils-4.6.0/share/man/
strip is /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip
stripping (with command strip and flags -S) in /nix/store/l380pczq5y1l4rbairiq8x3s6cfc3php-findutils-4.6.0/libexec  /nix/store/l380pczq5y1l4rbairiq8x3s6cfc3php-findutils-4.6.0/bin
checking for references to /build in /nix/store/l380pczq5y1l4rbairiq8x3s6cfc3php-findutils-4.6.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/5ikaxdddw47vpxfc766g0gydhqc9d2p6-findutils-4.6.0-info
strip is /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/5ikaxdddw47vpxfc766g0gydhqc9d2p6-findutils-4.6.0-info...
building '/nix/store/hs5i64d6gq40l2fwlcwvwwbd504jqfaw-stdenv-linux.drv'...
/nix/store/y8yzlxjada4rh72wb9ggiibaqqh0b5qv-stdenv-linux

@oxij
Copy link
Member Author

oxij commented Apr 25, 2018

@GrahamcOfBorg build hello

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: hello

Partial log (click to expand)

make[1]: Leaving directory '/build/hello-2.10'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10
shrinking /nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10/bin/hello
gzipping man pages under /nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10/share/man/
strip is /nix/store/0ll7k5c24dr5dx9cq7g7nbiviy1ql340-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10/bin
patching script interpreter paths in /nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10
checking for references to /build in /nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10...
/nix/store/80p7kj1a8lwaip48ssa5nry120flq6l4-hello-2.10

@oxij oxij changed the title stdenv: implement checkTarget and installCheckTarget autodetection [WIP] stdenv: implement checkTarget and installCheckTarget autodetection Apr 25, 2018
@oxij oxij changed the title [WIP] stdenv: implement checkTarget and installCheckTarget autodetection stdenv: implement checkTarget and installCheckTarget autodetection Apr 25, 2018
@oxij
Copy link
Member Author

oxij commented Apr 25, 2018

Since #39463 got merged I pushed the rest of the infrastructure here. Feel free to play with this.

@oxij oxij changed the title stdenv: implement checkTarget and installCheckTarget autodetection stdenv: implementt #33599 Apr 25, 2018
@oxij oxij changed the title stdenv: implementt #33599 stdenv: implement #33599 Apr 25, 2018
@7c6f434c
Copy link
Member

Do I understand correctly that for Python packages it unconditionally changes the default to true?

@7c6f434c
Copy link
Member

Given «nobody» reads the afterglow of merged PRs:

@Ekleog @Profpatsch @shlevy @grahamc

@7c6f434c
Copy link
Member

I generally like it, but will try to read it again.

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

cannot build derivation '/nix/store/gqj4f3ndvqkf5b742akvph2k95xsvikw-gnutar-1.30.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/195ry64n1q9y7ycxih8mqp2d0bnndddw-lzip-1.20.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/krwgh8xv2v8f0w0yqs9x1jp8v83cbp0r-binutils-wrapper-2.30.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/4qzxj0cr9c1fl3hz8gml9zz9kdbjfh3n-diffutils-3.6.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/2n4750yd7fvy2akybvi80ai9vi74p2sf-ed-1.14.2.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/0al95qv0i3w7br6h93kjd19jqh7vjlg3-findutils-4.6.0.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/qddq5p0j1b7a7smbmsl3lmy655azq36q-gcc-wrapper-7.3.0.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/5l59kccx3q9yd0g47vw1srydlwhxiyvr-patch-2.7.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/pg7629bbv8h9nr3ygy3ysi3v2d6770i7-stdenv-linux.drv': 25 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/pg7629bbv8h9nr3ygy3ysi3v2d6770i7-stdenv-linux.drv' failed

Copy link
Member

@Ekleog Ekleog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the python default doCheck value change that doesn't depend on config.doCheckByDefault, I think this shouldn't break anything when config.doCheckByDefault is set to false, and that it's a good path forward. That said I don't know much about some parts of the code touched here, so… :)

@@ -53,7 +53,7 @@

, passthru ? {}

, doCheck ? false
, doCheck ? true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a bit violent? The rest of the PR appears harmless, but wouldn't this set doCheck default to true regardless of config.doCheckByDefault?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Will fix.

@@ -85,6 +84,7 @@ toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
# Python packages don't have a checkPhase, only an installCheckPhase
doCheck = false;
doInstallCheck = doCheck;
installCheckInputs = checkInputs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be wrapped in a lib.optionals?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could, but it doesn't matter, the mkDerivation takes care of it.

@@ -36,6 +36,9 @@ rec {
, depsTargetTarget ? [] # 1 -> 1
, depsTargetTargetPropagated ? [] # 1 -> 1

, checkInputs ? []
, installCheckInputs ? []

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs documentation in nixpkgs manual §3.5

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Will do.

} // lib.optionalAttrs (outputs' != [ "out" ]) {
outputs = outputs';
} // lib.optionalAttrs (attrs ? doCheck) {
# TODO(@Ericson2314): Make unconditional / resolve #33599
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you lost this TODO comment when moving this code upwards: I don't think with this PR #33599 would be solved yet? As it would require at least turning config.doCheckByDefault to default to true, which isn't coming until at least hydra has performed a world-rebuild with it and checked it failed no additional package, I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Will fix.

${installCheckTarget:-installcheck}
)
if [[ -z "${foundMakefile:-}" ]]; then
echo "no Makefile or custom buildPhase, doing nothing"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you meant installCheckPhase here?

${checkTarget:-check}
)
if [[ -z "${foundMakefile:-}" ]]; then
echo "no Makefile or custom buildPhase, doing nothing"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you meant checkPhase here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the previous one. No. Custom buildPhase implies custom checkPhase (or else it will run no tests): since you don't use make to build, this can't use make to test (in general).

Note that a bunch of non-python packages use this attribute already.
Some of those are clearly unaware of the fact that this attribute does
not exists in stdenv because they define it but don't to add it to
their `bulidInputs` :)

Also note that I use `buildInputs` here and only handle regular
builds because python and haskell builders do it this way and I'm not
sure how to properly handle the cross-compilation case.
@oxij oxij changed the title stdenv: implement most of #33599 [WIP, I want to rebase once more before merging] stdenv: implement most of #33599 Apr 26, 2018
@oxij
Copy link
Member Author

oxij commented Apr 26, 2018

Rebase done.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/l6gqww4gk0g72ah025pvgzj8xj4h75ia-stdenv-linux

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/waw47w7ar0xkj7s7r27frqxk0igb6q56-binutils-2.30/bin
checking for references to /build in /nix/store/waw47w7ar0xkj7s7r27frqxk0igb6q56-binutils-2.30...
shrinking RPATHs of ELF executables and libraries in /nix/store/i312ym69ljwchszigiihprgc3cpn0nh9-binutils-2.30-info
strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/i312ym69ljwchszigiihprgc3cpn0nh9-binutils-2.30-info...
shrinking RPATHs of ELF executables and libraries in /nix/store/xj5gn1ilip82kz9y6iplqp3kn425hhcg-binutils-2.30-man
gzipping man pages under /nix/store/xj5gn1ilip82kz9y6iplqp3kn425hhcg-binutils-2.30-man/share/man/
strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/xj5gn1ilip82kz9y6iplqp3kn425hhcg-binutils-2.30-man...
/nix/store/zpz5va07y02f6wnjls61mqkz4apr4ll8-stdenv-linux

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

  /nix/store/hixf6xzc993b70xwf6vv1fvld48yy68i-gcc-wrapper-7.3.0.drv
  /nix/store/q7vsy0ykx12h8q1jfsvp4jwhfmy1l8rk-lzip-1.20.drv
  /nix/store/m5mxhwfxlic8qn53qbfkq2823xrlp2j7-ed-1.14.2.drv
  /nix/store/j170v41m13c25hxcrini1131lar9sqwd-patch-2.7.6.drv
  /nix/store/m74239nydr9p7dhw99prz21akpl74nqd-patchelf-0.9.drv
  /nix/store/s07v5qikiwjfg7jqnmfyw4zrc6rmrrqq-bzip2-1.0.6.0.1.drv
  /nix/store/xxxzwgmn4cxjpbif8xakschzd561zj03-gnused-4.5.drv
  /nix/store/jbc443g8s87x6rvadw7li18ayk53gc5w-stdenv-linux.drv
waiting for locks or build slots...
/nix/store/zpz5va07y02f6wnjls61mqkz4apr4ll8-stdenv-linux

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

  /nix/store/5z3nj2r1l7fkdinvb0kgqq6jpvl5wh5h-binutils-2.30.drv
  /nix/store/fhh73fyf1mf7rlycy1gmc5rssw35rgz0-diffutils-3.6.drv
  /nix/store/v3d0gyd3kdzw9wa3h7xzlzysrxb5cfrf-binutils-wrapper-2.30.drv
  /nix/store/hixf6xzc993b70xwf6vv1fvld48yy68i-gcc-wrapper-7.3.0.drv
  /nix/store/q7vsy0ykx12h8q1jfsvp4jwhfmy1l8rk-lzip-1.20.drv
  /nix/store/m5mxhwfxlic8qn53qbfkq2823xrlp2j7-ed-1.14.2.drv
  /nix/store/j170v41m13c25hxcrini1131lar9sqwd-patch-2.7.6.drv
  /nix/store/jbc443g8s87x6rvadw7li18ayk53gc5w-stdenv-linux.drv
waiting for locks or build slots...
/nix/store/zpz5va07y02f6wnjls61mqkz4apr4ll8-stdenv-linux

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

shrinking /nix/store/wy2jq4zrrihg6275lhzah7ybipd0fbym-findutils-4.6.0/libexec/code
shrinking /nix/store/wy2jq4zrrihg6275lhzah7ybipd0fbym-findutils-4.6.0/libexec/bigram
gzipping man pages under /nix/store/wy2jq4zrrihg6275lhzah7ybipd0fbym-findutils-4.6.0/share/man/
strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
stripping (with command strip and flags -S) in /nix/store/wy2jq4zrrihg6275lhzah7ybipd0fbym-findutils-4.6.0/libexec  /nix/store/wy2jq4zrrihg6275lhzah7ybipd0fbym-findutils-4.6.0/bin
checking for references to /build in /nix/store/wy2jq4zrrihg6275lhzah7ybipd0fbym-findutils-4.6.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/kskmgg7x0pmmfhd7xkyzpdvhymprl5f9-findutils-4.6.0-info
strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/kskmgg7x0pmmfhd7xkyzpdvhymprl5f9-findutils-4.6.0-info...
building '/nix/store/jbc443g8s87x6rvadw7li18ayk53gc5w-stdenv-linux.drv'...

@oxij
Copy link
Member Author

oxij commented Apr 26, 2018

Heh. I think we just witnessed a bug in nix: waiting for locks doesn't count towards timeouts in nix-build.

This then suggests a way to force @GrahamcOfBorg to make long rebuilds multiple times: you can push several dependent changes one-by-one and all but the very first one would hang waiting for lock, but then the first one timeouts the next one immediately picks up where the previous one left and extends the timeout.

/cc @grahamc

@oxij oxij mentioned this pull request Apr 28, 2018
8 tasks
@oxij
Copy link
Member Author

oxij commented Apr 28, 2018 via email

@oxij
Copy link
Member Author

oxij commented Apr 30, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants