Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 633832 - >dev-python/m2crypto-0.26.0[libressl] - ImportError: No module named _m2crypto
Summary: >dev-python/m2crypto-0.26.0[libressl] - ImportError: No module named _m2crypto
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: libressl-support
  Show dependency tree
 
Reported: 2017-10-09 11:40 UTC by Michelangelo Scopelliti
Modified: 2018-04-12 21:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
properly support libressl (m2crypto-0.27.0-libressl.patch,5.99 KB, patch)
2017-10-15 04:19 UTC, Jory A. Pratt
Details | Diff
m2crypto-0.27.0-r1.ebuild (m2crypto-0.27.0-r1.ebuild,1.35 KB, text/plain)
2018-01-21 14:26 UTC, Daniel Kenzelmann
Details
m2crypto-0.27.0-libressl.patch (m2crypto-0.27.0-libressl.patch,5.53 KB, patch)
2018-01-21 14:28 UTC, Daniel Kenzelmann
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michelangelo Scopelliti 2017-10-09 11:40:56 UTC
>m2crypto-2.6 compile without error against libressl, but when used (e.g. in python shell) module fails. In turn, this cause build failures in packages using m2crypto (e.g. crda). No build failures with mcrypto-2.6.0

To reproduce:

$ python2
>>> import M2Crypto

results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/M2Crypto/__init__.py", line 26, in <module>
    from M2Crypto import (ASN1, AuthCookie, BIO, BN, DH, DSA, EVP, Engine, Err,
  File "/usr/lib64/python2.7/site-packages/M2Crypto/ASN1.py", line 15, in <module>
    from M2Crypto import BIO, m2, util
  File "/usr/lib64/python2.7/site-packages/M2Crypto/BIO.py", line 10, in <module>
    from M2Crypto import m2, six, util
  File "/usr/lib64/python2.7/site-packages/M2Crypto/m2.py", line 30, in <module>
    from M2Crypto.m2crypto import *
  File "/usr/lib64/python2.7/site-packages/M2Crypto/m2crypto.py", line 17, in <module>
    _m2crypto = swig_import_helper()
  File "/usr/lib64/python2.7/site-packages/M2Crypto/m2crypto.py", line 16, in swig_import_helper
    return importlib.import_module('_m2crypto')
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _m2crypto

I suspect the issue is with the API change introduced in 2.6.2 (see CHANGES in source tree).

---

emerge --info
Portage 2.3.11 (python 2.7.14-final-0, default/linux/amd64/13.0, gcc-6.4.0, glibc-2.25-r7, 4.13.5 x86_64)
=================================================================
System uname: Linux-4.13.5-x86_64-AMD_A8-3870_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.4.1
KiB Mem:    15889756 total,   5335844 free
KiB Swap:   18874352 total,  18874352 free
Timestamp of repository gentoo: Mon, 09 Oct 2017 07:15:01 +0000
Head commit of repository gentoo: a953099b852d3e3224f005c5593b823f63da069d
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p1.0) 2.29.1
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14::gentoo, 3.6.3::gentoo
dev-util/cmake:           3.9.4::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.32::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1::gentoo
sys-devel/gcc:            6.4.0::gentoo
sys-devel/gcc-config:     1.9.0::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 

kernelpanic
    location: /usr/local/portage/kernelpanic
    masters: gentoo
    priority: 0

libressl
    location: /var/lib/layman/libressl
    sync-type: laymansync
    sync-uri: https://github.com/gentoo/libressl.git
    masters: gentoo
    priority: 50

science
    location: /var/lib/layman/science
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/sci.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA @EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-march=native -mtune=native -O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup clean-logs compress-build-logs config-protect-if-modified distlocks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms split-elog split-log strict unknown-features-warn unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -mtune=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK=" /etc/systemd /usr/lib/systemd /usr/lib64/systemd"
LANG="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl alsa amd64 ao berkdb blas bluetooth branding bzip2 cairo caps cli cracklib crypt cups curl cxx dbus djvu dri dts dv dvb dvd encode exif ffmpeg fftw flac fontconfig fortran gdbm gif gimp gmp gpm gsm gstreamer iconv icu inotify ipv6 jbig jit jpeg jpeg2k lame lapack latex lcms libass libnotify libressl lzma lzo mad matroska mikmod mmap mms mng modplug modules mp3 mpeg mpi mtp multilib musepack ncurses nls nptl offensive ogg openal openexr opengl openmp pam pcre pdf png postscript qt5 raw readline scanner seccomp session smp sndfile sound sox speex sqlite ssl startup-notification svg theora threads tiff truetype udev unicode usb v4l vaapi vdpau vim-syntax vorbis wavpack webp wmf wxwidgets x264 xattr xcb xft xml xmp xpm xscreensaver xv xvid zlib" ABI_X86="32 64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 3dnow 3dnowext popcnt sse3 sse4a" CURL_SSL="libressl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" L10N="it en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="it en" LLVM_TARGETS="AMDGPU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby24" SANE_BACKENDS="xerox_mfp" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Michelangelo Scopelliti 2017-10-09 12:12:09 UTC
Sorry, some typos in the first report.
The issue is present for >dev-python/m2crypto-0.26.0, not 2.6
Comment 2 Jory A. Pratt gentoo-dev 2017-10-15 04:19:20 UTC
Created attachment 498696 [details, diff]
properly support libressl

I have copied the 0.26.4 ebuild to 0.27.0 and with included patch have been able to successfully rebuild crda. Patch is from OpenBSD, I have combined them all together instead of managing multiple patches.
Comment 3 Daniel Kenzelmann 2018-01-21 14:26:46 UTC
Created attachment 515646 [details]
m2crypto-0.27.0-r1.ebuild

Working ebuild conditionally applying Jory's patch
Comment 4 Daniel Kenzelmann 2018-01-21 14:28:23 UTC
Created attachment 515648 [details, diff]
m2crypto-0.27.0-libressl.patch

patch used by ebuild above
Comment 5 Daniel Kenzelmann 2018-01-21 14:31:41 UTC
This is a major blocker which affects all installations that use wifi and libressl.
(Blocks during build of crda)

Please push attached ebuild/patch to portage..
Comment 6 Larry the Git Cow gentoo-dev 2018-04-12 21:01:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51e7514a7882be4bbf2a5ca3177cf77d16e4c39e

commit 51e7514a7882be4bbf2a5ca3177cf77d16e4c39e
Author:     Aaron Bauman <bman@gentoo.org>
AuthorDate: 2018-04-12 02:01:53 +0000
Commit:     Aaron Bauman <bman@gentoo.org>
CommitDate: 2018-04-12 20:59:48 +0000

    dev-python/m2crypto: properly detect LibreSSL versions
    
    Ensure the build environment can determine the LibreSSL version. This
    also fixes dependencies such as net-wireless/crda which fail to find the
    m2crypto module due to the broken m2crypto build.
    
    Bug: https://bugs.gentoo.org/633832
    Package-Manager: Portage-2.3.28, Repoman-2.3.9
    Closes: https://github.com/gentoo/gentoo/pull/7947

 .../files/m2crypto-libressl-version-check.patch    | 154 +++++++++++++++++++++
 dev-python/m2crypto/m2crypto-0.27.0-r1.ebuild      |  56 ++++++++
 2 files changed, 210 insertions(+)}