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

Fix pythonPackages.sentry-sdk build #75039

Merged
merged 1 commit into from Dec 7, 2019
Merged

Conversation

duijf
Copy link
Contributor

@duijf duijf commented Dec 5, 2019

Motivation for this change

The following command fails on Nixpkgs master:

nix-build -A python37Packages.sentry-sdk
Build output before
sentry_sdk (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: sentry_sdk (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: sentry_sdk
Traceback (most recent call last):
  File "/nix/store/drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5/lib/python3.7/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/nix/store/drr8qcgiccfc5by09r5zc30flgwh1mbx-python3-3.7.5/lib/python3.7/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/build/sentry-sdk-0.13.2/sentry_sdk/__init__.py", line 1, in <module>
    from sentry_sdk.hub import Hub, init
  File "/build/sentry-sdk-0.13.2/sentry_sdk/hub.py", line 9, in <module>
    from sentry_sdk.scope import Scope
  File "/build/sentry-sdk-0.13.2/sentry_sdk/scope.py", line 6, in <module>
    from sentry_sdk.utils import logger, capture_internal_exceptions
  File "/build/sentry-sdk-0.13.2/sentry_sdk/utils.py", line 772, in <module>
    HAS_REAL_CONTEXTVARS, ContextVar = _get_contextvars()
  File "/build/sentry-sdk-0.13.2/sentry_sdk/utils.py", line 740, in _get_contextvars
    if not _is_threading_local_monkey_patched():
  File "/build/sentry-sdk-0.13.2/sentry_sdk/utils.py", line 721, in _is_threading_local_monkey_patched
    from eventlet.patcher import is_monkey_patched  # type: ignore
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/__init__.py", line 10, in <module>
    from eventlet import convenience
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/convenience.py", line 7, in <module>
    from eventlet.green import socket
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/green/socket.py", line 21, in <module>
    from eventlet.support import greendns
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/support/greendns.py", line 69, in <module>
    setattr(dns.rdtypes.IN, pkg, import_patched('dns.rdtypes.IN.' + pkg))
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/support/greendns.py", line 59, in import_patched
    return patcher.import_patched(module_name, **modules)
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/patcher.py", line 126, in import_patched
    *additional_modules + tuple(kw_additional_modules.items()))
  File "/nix/store/c7gzwdfhpq2a9ix6xy15fv4fjn1s57fs-python3.7-eventlet-0.25.1/lib/python3.7/site-packages/eventlet/patcher.py", line 100, in inject
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
  File "/nix/store/grdm0zv2b7blma4ykb11nvb6g7xw8jcz-python3.7-dnspython-1.16.0/lib/python3.7/site-packages/dns/rdtypes/IN/WKS.py", line 25, in <module>
    _proto_tcp = socket.getprotobyname('tcp')
OSError: protocol not found


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
builder for '/nix/store/aq3bs2hpacj0jaj0zgpjlkajgxvpxhm0-python3.7-sentry-sdk-0.13.2.drv' failed with exit code 1
error: build of '/nix/store/aq3bs2hpacj0jaj0zgpjlkajgxvpxhm0-python3.7-sentry-sdk-0.13.2.drv' failed

The test suite wants to read /etc/protocols, but this file isn't available in the sandbox by default.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date (Could not find docs)
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @gebner

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

I meant to fix this actually, but thanks for doing it for me! :)

do you mind squashing the commits? otherwise LGTM

@duijf duijf force-pushed the fix-sentry-sdk branch 2 times, most recently from c6e2b5e to 87af0c7 Compare December 7, 2019 11:00
@duijf
Copy link
Contributor Author

duijf commented Dec 7, 2019

Squashed!

@duijf duijf requested a review from jonringer December 7, 2019 11:00
This package could not build because the tests require /etc/protocols.
Therefore, make this file available using libredirect.
@gebner gebner merged commit f669d0c into NixOS:master Dec 7, 2019
@duijf duijf deleted the fix-sentry-sdk branch December 9, 2019 11:10
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