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

[RFC] pythonPackages.libnl: init+bump at 3.4.0 #40470

Merged
merged 2 commits into from May 21, 2018
Merged

Conversation

teto
Copy link
Member

@teto teto commented May 14, 2018

Netlink is the userspace <-> kernelspace coomunication protocol.

Motivation for this change

I need it
Note: I don't know if it's because netlink examples are outdated or because of my packaging but
import netlink.genl.capi, one would need to do import netlink.genl._capi. Maybe I should rename _capi.so to capi.so ?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented May 14, 2018

It looks like we have a name collision here. Is something else importing libnl in pythonPackages?
There should not be this many rebuilds.


nativeBuildInputs = libnl.nativeBuildInputs ++ [ swig file ];

propagatedBuildInputs = [ libnl ];
Copy link
Member

Choose a reason for hiding this comment

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

This should not be required if libnl is used to build an internal binding.

'';

postConfigure=''
cd python
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have a python output in libnl instead? What python versions does libnl support at the moment?

@Mic92
Copy link
Member

Mic92 commented May 14, 2018

@FRidh might have a better idea how optional python bindings in libraries is handled better.

@teto
Copy link
Member Author

teto commented May 15, 2018

It looks like we have a name collision here. Is something else importing libnl in pythonPackages?
There should not be this many rebuilds.

The rebuild is triggered only if the derivation .drv file changes right ? could my addition of the version field in the derivation have triggered this ? many things depend on netlink (not sure though if they depend specifically from libnl though).

@Mic92
Copy link
Member

Mic92 commented May 15, 2018

All packages in python that do not take libnl from pkgs. can potentially inherit the wrong package.

@FRidh
Copy link
Member

FRidh commented May 15, 2018

Typically we build packages with bindings, and put those in a separate output. We can then wrap that output in python-packages.nix. There are some examples there.

@Mic92
Copy link
Member

Mic92 commented May 15, 2018

Could you give an example? I have not found any example so far.

@teto
Copy link
Member Author

teto commented May 15, 2018 via email

@FRidh
Copy link
Member

FRidh commented May 15, 2018

Related issue regarding bindings #20516.

Look for toPythonModule.

Some examples:

  • boost
  • opencv
  • librepo
  • libplist
  • libxml2
  • libxslt
  • rivet

@teto
Copy link
Member Author

teto commented May 15, 2018

The examples you've shown seem to all have the binding generation part of their buildsystem. That's not the case for libnl so I will still need some kind of python packaging (to run python tests)
I ended up moving the python folder to a py output but it just contains the source, not a python package.
Also there seems to be tests to run too. I managed to

{ buildPythonPackage, pkgconfig, src, isPy3k, libnl, swig, file }:
buildPythonPackage {
  pname = "libnl";
  inherit (libnl) version  patches meta;

  src=libnl.py;

  disabled = isPy3k;

  buildInputs = [ pkgconfig swig libnl libnl.dev ];
}

what I don't get though is why the python package won't compile even though I provided the libnl.dev output aong with pkgconfig; the correct include path (sthg like /nix/store/d29dwbldfg8qsgcsgp4ic14av9iw5rlw-libnl-3.4.0-dev/include/libnl3) won't appear in gcc command line:


building 'netlink/_capi' extension
swigging ./netlink/capi.i to ./netlink/capi_wrap.c
swig -python -O -nodefaultctor -o ./netlink/capi_wrap.c ./netlink/capi.i
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/netlink
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../include -I../include -I/nix/store/l9j2jsc9flrbmpf799nw9wdq59gpwms8-python-2.7.14/include/python2.7 -c ./netlink/capi_wrap.c -o build/temp.linux-x86_64-2.7/./netlink/capi_wrap.o
./netlink/capi_wrap.c:3070:10: fatal error: netlink/netlink.h: No such file or directory
 #include <netlink/netlink.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
note: keeping build directory '/tmp/nix-build-python2.7-libnl-3.4.0.drv-0'

@teto
Copy link
Member Author

teto commented May 17, 2018

I think this addresses the concern: I run the setup.py install with --prefix and that works. I renamed the python bindings to libnl-python to prevent name clashes
nix-shell -p 'python.withPackages(ps: with ps; [ libnl-python ])' --run "python -c 'import netlink'" should work

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libnl

Partial log (click to expand)

strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/hvvj1rprkfl4qkkkwsw9gz8p9f48l025-libnl-3.4.0/lib
patching script interpreter paths in /nix/store/hvvj1rprkfl4qkkkwsw9gz8p9f48l025-libnl-3.4.0
checking for references to /build in /nix/store/hvvj1rprkfl4qkkkwsw9gz8p9f48l025-libnl-3.4.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/z5lyxx3x8z9pfamxqba3n4s8a7y1f147-libnl-3.4.0-man
gzipping man pages under /nix/store/z5lyxx3x8z9pfamxqba3n4s8a7y1f147-libnl-3.4.0-man/share/man/
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/z5lyxx3x8z9pfamxqba3n4s8a7y1f147-libnl-3.4.0-man
checking for references to /build in /nix/store/z5lyxx3x8z9pfamxqba3n4s8a7y1f147-libnl-3.4.0-man...
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libnl

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/3gj71lgsh14wskxm0207a0i96fz2pnnw-libnl-3.4.0/lib
patching script interpreter paths in /nix/store/3gj71lgsh14wskxm0207a0i96fz2pnnw-libnl-3.4.0
checking for references to /build in /nix/store/3gj71lgsh14wskxm0207a0i96fz2pnnw-libnl-3.4.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/ga635qzbypxlf4xi7knfajpvjrf35y9w-libnl-3.4.0-man
gzipping man pages under /nix/store/ga635qzbypxlf4xi7knfajpvjrf35y9w-libnl-3.4.0-man/share/man/
strip is /nix/store/jk6j4lh9v5mvjdbdc35sj0zffhhf6s56-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/ga635qzbypxlf4xi7knfajpvjrf35y9w-libnl-3.4.0-man
checking for references to /build in /nix/store/ga635qzbypxlf4xi7knfajpvjrf35y9w-libnl-3.4.0-man...
strip is /nix/store/jk6j4lh9v5mvjdbdc35sj0zffhhf6s56-binutils-2.30/bin/strip
/nix/store/xlqhggsvar0md4rp6m2nfjpgm0b2innr-libnl-3.4.0-bin

@teto teto changed the title [RFC] pythonPackages.libnl: init at 3.3.0 [RFC] pythonPackages.libnl: init+bump at 3.4.0 May 17, 2018

postBuild = lib.optionalString (pythonSupport) ''
cd python
${python}/bin/python setup.py install --prefix=../pythonlib
Copy link
Member Author

Choose a reason for hiding this comment

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

maybe I could just use --prefix=$py straightaway ?

Copy link
Member

Choose a reason for hiding this comment

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

Try it.

It's a pity building a wheel does not work.

${python.interpreter} instead of ${python}/bin/python

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried it and it generates the folder so that I don't need the postFixup phase anymore \o/

'';

postFixup = lib.optionalString pythonSupport ''
mv "pythonlib/" "$py"
Copy link
Member

Choose a reason for hiding this comment

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

use moveToOutput

Copy link
Member Author

Choose a reason for hiding this comment

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

I had tried several times but I could never get moveToOutput to do anything. I wonder if I don't get the usag right.

Copy link
Member Author

@teto teto May 19, 2018

Choose a reason for hiding this comment

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

anyway this hook is not needed anymore

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libnl

Partial log (click to expand)

patching script interpreter paths in /nix/store/1zx706hivamg2p79430n29rjj1dm3kz9-libnl-3.4.0-man
checking for references to /build in /nix/store/1zx706hivamg2p79430n29rjj1dm3kz9-libnl-3.4.0-man...
shrinking RPATHs of ELF executables and libraries in /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py
shrinking /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py/lib/python2.7/site-packages/netlink/route/_capi.so
shrinking /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py/lib/python2.7/site-packages/netlink/genl/_capi.so
shrinking /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py/lib/python2.7/site-packages/netlink/_capi.so
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py/lib
patching script interpreter paths in /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py
checking for references to /build in /nix/store/7dssqjwm8kyw9zg8z9prpr2v6g42ivzk-libnl-3.4.0-py...

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libnl

Partial log (click to expand)

checking for references to /build in /nix/store/g9ykdbfa8gaacc80w41qybq94yspzl08-libnl-3.4.0-man...
shrinking RPATHs of ELF executables and libraries in /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py
shrinking /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py/lib/python2.7/site-packages/netlink/genl/_capi.so
shrinking /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py/lib/python2.7/site-packages/netlink/route/_capi.so
shrinking /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py/lib/python2.7/site-packages/netlink/_capi.so
strip is /nix/store/jk6j4lh9v5mvjdbdc35sj0zffhhf6s56-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py/lib
patching script interpreter paths in /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py
checking for references to /build in /nix/store/08p2afxgfpmrpzm5g181ymnys4zvjcj8-libnl-3.4.0-py...
/nix/store/bq6pfvzdwcd6rqvz9z0z9n2k8iaycdfi-libnl-3.4.0-bin

@teto teto changed the base branch from master to staging May 21, 2018 09:50
teto added 2 commits May 21, 2018 18:51
Netlink is the userspace <-> kernelspace communication protocol.
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libnl

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/6g3i8xz29yl74y421wkv36ci87n329sm-libnl-3.4.0/lib
patching script interpreter paths in /nix/store/6g3i8xz29yl74y421wkv36ci87n329sm-libnl-3.4.0
checking for references to /build in /nix/store/6g3i8xz29yl74y421wkv36ci87n329sm-libnl-3.4.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/rm0hcspvs18qj8qf95q8i7xp09cnr3cp-libnl-3.4.0-man
gzipping man pages under /nix/store/rm0hcspvs18qj8qf95q8i7xp09cnr3cp-libnl-3.4.0-man/share/man/
strip is /nix/store/mgyvr3kil9qv0mywikpi0dbli061bpg4-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/rm0hcspvs18qj8qf95q8i7xp09cnr3cp-libnl-3.4.0-man
checking for references to /build in /nix/store/rm0hcspvs18qj8qf95q8i7xp09cnr3cp-libnl-3.4.0-man...
strip is /nix/store/mgyvr3kil9qv0mywikpi0dbli061bpg4-binutils-2.30/bin/strip
/nix/store/6r6f9840sw1a0yh6r1c7f8bsn70zwsk5-libnl-3.4.0-bin

@Mic92
Copy link
Member

Mic92 commented May 21, 2018

@FRidh package looks good to me. What do you say?

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libnl

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/xa4d4dirgbrsj84lzdiwlv8rwzl6zkvw-libnl-3.4.0/lib
patching script interpreter paths in /nix/store/xa4d4dirgbrsj84lzdiwlv8rwzl6zkvw-libnl-3.4.0
checking for references to /build in /nix/store/xa4d4dirgbrsj84lzdiwlv8rwzl6zkvw-libnl-3.4.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/452crwdd7pcxw40vafhbk7gflnvzl872-libnl-3.4.0-man
gzipping man pages under /nix/store/452crwdd7pcxw40vafhbk7gflnvzl872-libnl-3.4.0-man/share/man/
strip is /nix/store/8yfik687kfccisxnad42j19lfb7ij9b4-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/452crwdd7pcxw40vafhbk7gflnvzl872-libnl-3.4.0-man
checking for references to /build in /nix/store/452crwdd7pcxw40vafhbk7gflnvzl872-libnl-3.4.0-man...
strip is /nix/store/8yfik687kfccisxnad42j19lfb7ij9b4-binutils-2.30/bin/strip
/nix/store/306ji4as6nj66szw3zkqwq69f7z8gavb-libnl-3.4.0-bin

@Mic92 Mic92 merged commit 99c1d03 into NixOS:staging May 21, 2018
@teto teto deleted the libnl_python branch May 21, 2018 12:11
@teto
Copy link
Member Author

teto commented May 21, 2018

thanks for the guidance.

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

4 participants