Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 582154 - =app-portage/layman-2.4.0-r1: ImportError: No module named g-sorcery
Summary: =app-portage/layman-2.4.0-r1: ImportError: No module named g-sorcery
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Layman Overlay Manager project
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2016-05-05 13:31 UTC by n0t3p4d.opensource
Modified: 2017-01-01 13:10 UTC (History)
0 users

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


Attachments
output of equery f layman (equery_output,24.69 KB, text/plain)
2016-05-05 14:33 UTC, n0t3p4d.opensource
Details
Attempt to fix the issue (582154-dash-into-underscore.patch,636 bytes, patch)
2016-05-10 20:32 UTC, Emile de Weerd
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description n0t3p4d.opensource 2016-05-05 13:31:23 UTC
A few days ago, layman started to output the following error message:

notepad ~ # layman -S

 * Fetching remote list...
 * Failed to fetch overlay list!
 *  Original Error was:
 * No module named g-sorcery

 * Syncing selected overlay(s)...
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/layman", line 45, in <module>
    main()
  File "/usr/lib64/python2.7/site-packages/layman/cli.py", line 196, in __call__
    result += getattr(self, action[1])()
  File "/usr/lib64/python2.7/site-packages/layman/cli.py", line 279, in Sync
    selection = self.api.get_installed()
  File "/usr/lib64/python2.7/site-packages/layman/api.py", line 513, in get_installed
    self._installed_ids = self._get_installed_db(dbreload).list_ids()
  File "/usr/lib64/python2.7/site-packages/layman/api.py", line 520, in _get_installed_db
    self._installed_db = DB(self.config)
  File "/usr/lib64/python2.7/site-packages/layman/db.py", line 63, in __init__
    allow_missing=True,
  File "/usr/lib64/python2.7/site-packages/layman/dbbase.py", line 114, in __init__
    success = self.read_db(path)
  File "/usr/lib64/python2.7/site-packages/layman/dbbase.py", line 222, in read_db
    return db_ctl.read_db(path, text=text)
  File "/usr/lib64/python2.7/site-packages/layman/db_modules/xml_db/xml_db.py", line 116, in read_db
    success = self.read(document, origin=path)
  File "/usr/lib64/python2.7/site-packages/layman/db_modules/xml_db/xml_db.py", line 137, in read
    ovl = Overlay(config=self.config, xml=overlay, ignore=self.ignore)
  File "/usr/lib64/python2.7/site-packages/layman/overlays/overlay.py", line 71, in __init__
    self.from_xml(xml, ignore)
  File "/usr/lib64/python2.7/site-packages/layman/overlays/overlay.py", line 452, in from_xml
    self.sources = [create_overlay_source(e) for e in _sources]
  File "/usr/lib64/python2.7/site-packages/layman/overlays/overlay.py", line 437, in create_overlay_source
    _class = self.module_controller.get_class(_type)
  File "/usr/lib64/python2.7/site-packages/layman/module.py", line 159, in get_class
    mod = self._modules[modname]['parent'].get_class(modname)
  File "/usr/lib64/python2.7/site-packages/layman/module.py", line 75, in get_class
    module = __import__(kid['module_name'], [], [], ["not empty"])
ImportError: No module named g-sorcery

I've tried reinstalling layman and g-sorcery, but the problem persists. Before, everything used to work as expected.

Installed version:
[ebuild   R    ] app-portage/g-sorcery-0.2.1-r1::gentoo  USE="bson git" PYTHON_TARGETS="python2_7 python3_4 -python3_3 -python3_5" 0 KiB
[ebuild   R    ] app-portage/layman-2.4.0-r1::gentoo  USE="g-sorcery git gpg subversion -bazaar -cvs -darcs -mercurial -sqlite -squashfs -sync-plugin-portage {-test}" PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_3 -python3_5" 0 KiB

notepad ~ # emerge --info
Portage 2.2.28 (python 2.7.11-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.23-r2, 4.4.6+ x86_64)
=================================================================
System uname: Linux-4.4.6+-x86_64-Intel-R-_Xeon-R-_CPU_E5-1620_v3_@_3.50GHz-with-gentoo-2.2
KiB Mem:    32841408 total,  19749724 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 05 May 2016 11:30:01 +0000
sh bash 4.3_p42-r2
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.3_p42-r2::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.2::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.3.5-r8::gentoo, 3.4.3-r7::gentoo, 3.5.1-r2::gentoo
dev-util/cmake:           3.5.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.20.5::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.5::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Repositories:

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

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

emacs
    location: /var/lib/layman/emacs
    masters: gentoo
    priority: 50

gnu-elpa
    location: /var/lib/layman/gnu-elpa
    masters: gentoo
    priority: 50

melpa
    location: /var/lib/layman/melpa
    masters: gnu-elpa gentoo
    priority: 50

pypi
    location: /var/lib/layman/pypi
    masters: gentoo
    priority: 50

virtualization
    location: /var/lib/layman/virtualization
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.2/conf /usr/share/maven-bin-3.3/conf"
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 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/Mirrors/gentoo http://mirror.netcologne.de/gentoo/ http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
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/compile"
USE="X a52 aac aacplus aacs acl alsa amd64 bdplus berkdb bluray bzip2 cdda cdio cli consolekit cracklib crypt cups cxx dbus device-mapper dri dts dvd dvdnav egl evdev exif ffmpeg flac fortran gdbm gif gnutls gpg gtk gtk3 gudev http iconv idn ipv6 jit jpeg jpeg2k kdrive lame libedit libnotify lm_sensors lzma mmx mmxext modules mp3 mpeg multilib ncurses network nls nptl nvidia ogg opengl openmp opus orc pam pch pcre pdf png policykit postproc pulseaudio qt3support qt5 readline replaygain rtmp samba sdl seccomp session smartcard smp sound spice sse sse2 sse4_1 ssl ssse3 subversion svg taglib tcpd theora threads tiff tpm truetype udev udisks unicode usb usbredir vcd vdpau vorbis vpx x264 xattr xcb xcomposite xft 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="x86_64 arm" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby20 ruby22" USERLAND="GNU" VIDEO_CARDS="nvidia nv modesetting" 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"
USE_PYTHON="2.7 3.4"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Brian Dolbec (RETIRED) gentoo-dev 2016-05-05 14:30:52 UTC
Please show the results of:

equery f layman
Comment 2 n0t3p4d.opensource 2016-05-05 14:33:06 UTC
Created attachment 433296 [details]
output of equery f layman
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2016-05-05 15:10:20 UTC
Thank you.

/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery
/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery/__init__.py
/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery/__init__.pyc
/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery/__init__.pyo
/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery/g_sorcery.py
/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery/g_sorcery.pyc
/usr/lib64/python2.7/site-packages/layman/overlays/modules/g_sorcery/g_sorcery.pyo

It clearly was installed...

ImportError: No module named g-sorcery

hmm, looks like it might be a typo... - is not allowed in a module name.
Comment 4 Devan Franchini (RETIRED) gentoo-dev 2016-05-10 01:31:58 UTC
Version 2.4.1 released to resolve this issue.

Thank you for reporting this!
Comment 5 n0t3p4d.opensource 2016-05-10 12:44:41 UTC
Thanks for your quick reply!
However, the problem seems to persist:
notepad ~ # emerge -pv layman

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-portage/layman-2.4.1::gentoo  USE="g-sorcery git gpg subversion -bazaar -cvs -darcs -mercurial -sqlite -squashfs -sync-plugin-portage {-test}" PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_3 -python3_5" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
notepad ~ # layman -L

 * Fetching remote list...
 * Failed to fetch overlay list!
 *  Original Error was:
 * No module named g-sorcery

Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/layman", line 45, in <module>
    main()
  File "/usr/lib64/python2.7/site-packages/layman/cli.py", line 196, in __call__
    result += getattr(self, action[1])()
  File "/usr/lib64/python2.7/site-packages/layman/cli.py", line 369, in ListRemote
    verbose=self.config['verbose'], width=list_printer.width)
  File "/usr/lib64/python2.7/site-packages/layman/api.py", line 296, in get_info_list
    return self._get_remote_db().list(verbose=verbose, width=width)
  File "/usr/lib64/python2.7/site-packages/layman/api.py", line 529, in _get_remote_db
    self._available_db = RemoteDB(self.config)
  File "/usr/lib64/python2.7/site-packages/layman/remotedb.py", line 93, in __init__
    ignore_init_read_errors=ignore_init_read_errors)
  File "/usr/lib64/python2.7/site-packages/layman/dbbase.py", line 114, in __init__
    success = self.read_db(path)
  File "/usr/lib64/python2.7/site-packages/layman/dbbase.py", line 222, in read_db
    return db_ctl.read_db(path, text=text)
  File "/usr/lib64/python2.7/site-packages/layman/db_modules/xml_db/xml_db.py", line 116, in read_db
    success = self.read(document, origin=path)
  File "/usr/lib64/python2.7/site-packages/layman/db_modules/xml_db/xml_db.py", line 137, in read
    ovl = Overlay(config=self.config, xml=overlay, ignore=self.ignore)
  File "/usr/lib64/python2.7/site-packages/layman/overlays/overlay.py", line 71, in __init__
    self.from_xml(xml, ignore)
  File "/usr/lib64/python2.7/site-packages/layman/overlays/overlay.py", line 452, in from_xml
    self.sources = [create_overlay_source(e) for e in _sources]
  File "/usr/lib64/python2.7/site-packages/layman/overlays/overlay.py", line 437, in create_overlay_source
    _class = self.module_controller.get_class(_type)
  File "/usr/lib64/python2.7/site-packages/layman/module.py", line 167, in get_class
    mod = self._modules[modname]['parent'].get_class(modname)
  File "/usr/lib64/python2.7/site-packages/layman/module.py", line 83, in get_class
    module = __import__(kid['module_name'], [], [], ["not empty"])
ImportError: No module named g-sorcery

Is there anything else I'm supposed to do besides upgrading layman?
Comment 6 Emile de Weerd 2016-05-10 20:30:58 UTC
I do not know if it is an OK fix, as I am not well-versed in python. But it seems I do not get the stacktrace any longer at least.

Opened a PR on GitHub: https://github.com/mederel/layman/pull/1
Diff/Patch file provided as well and uploaded here.

Have a nice evening!
Comment 7 Emile de Weerd 2016-05-10 20:32:15 UTC
Created attachment 433884 [details, diff]
Attempt to fix the issue
Comment 8 n0t3p4d.opensource 2016-05-10 20:37:46 UTC
Thanks for your patch - I've applied it, but now, another error appears:

notepad layman # layman -S

 * Fetching remote list...
 * Fetch Ok

 * Syncing selected overlay(s)...
 * Running Git... # ( cd /var/lib/layman/emacs  && /usr/bin/git pull )
Already up-to-date.
 * Overlay "gnu-elpa" is missing "g-sorcery" module!
 * Did you install layman with "g-sorcery" support?
 * Overlay "melpa" is missing "g-sorcery" module!
 * Did you install layman with "g-sorcery" support?
 * Overlay "pypi" is missing "g-sorcery" module!
 * Did you install layman with "g-sorcery" support?
 * Running Git... # ( cd /var/lib/layman/virtualization  && /usr/bin/git pull )
Already up-to-date.
 * 
 * Succeeded:
 * ------
 * Successfully synchronized overlay "emacs".
 * Successfully synchronized overlay "virtualization".
 * 
 * 
 * Errors:
 * ------
 * Failed to sync overlay "gnu-elpa".
 * Error was: Syncing overlay "gnu-elpa" returned status True!
 * db.sync()
 * Failed to sync overlay "melpa".
 * Error was: Syncing overlay "melpa" returned status True!
 * db.sync()
 * Failed to sync overlay "pypi".
 * Error was: Syncing overlay "pypi" returned status True!
 * db.sync()
 * 

 * CLI: Errors occurred processing action sync_all
 * Overlay "gnu-elpa" is missing "g-sorcery" module!
 * Overlay "melpa" is missing "g-sorcery" module!
 * Overlay "pypi" is missing "g-sorcery" module!
 * 
 * Errors:
 * ------
 * Failed to sync overlay "gnu-elpa".
 * Error was: Syncing overlay "gnu-elpa" returned status True!
 * db.sync()
 * Failed to sync overlay "melpa".
 * Error was: Syncing overlay "melpa" returned status True!
 * db.sync()
 * Failed to sync overlay "pypi".
 * Error was: Syncing overlay "pypi" returned status True!
 * db.sync()
 *
Comment 9 Emile de Weerd 2016-05-10 20:41:00 UTC
Sorry PR was wrong. Opened a new one to Gentoo repository:
https://github.com/gentoo/layman/pull/34
Comment 10 Emile de Weerd 2016-05-10 20:42:08 UTC
(In reply to n0t3p4d.opensource from comment #8)
> Thanks for your patch - I've applied it, but now, another error appears:
> 
> notepad layman # layman -S
> 
>  * Fetching remote list...
>  * Fetch Ok
> 
>  * Syncing selected overlay(s)...
>  * Running Git... # ( cd /var/lib/layman/emacs  && /usr/bin/git pull )
> Already up-to-date.
>  * Overlay "gnu-elpa" is missing "g-sorcery" module!
>  * Did you install layman with "g-sorcery" support?
>  * Overlay "melpa" is missing "g-sorcery" module!
>  * Did you install layman with "g-sorcery" support?
>  * Overlay "pypi" is missing "g-sorcery" module!
>  * Did you install layman with "g-sorcery" support?
>  * Running Git... # ( cd /var/lib/layman/virtualization  && /usr/bin/git
> pull )
> Already up-to-date.
>  * 
>  * Succeeded:
>  * ------
>  * Successfully synchronized overlay "emacs".
>  * Successfully synchronized overlay "virtualization".
>  * 
>  * 
>  * Errors:
>  * ------
>  * Failed to sync overlay "gnu-elpa".
>  * Error was: Syncing overlay "gnu-elpa" returned status True!
>  * db.sync()
>  * Failed to sync overlay "melpa".
>  * Error was: Syncing overlay "melpa" returned status True!
>  * db.sync()
>  * Failed to sync overlay "pypi".
>  * Error was: Syncing overlay "pypi" returned status True!
>  * db.sync()
>  * 
> 
>  * CLI: Errors occurred processing action sync_all
>  * Overlay "gnu-elpa" is missing "g-sorcery" module!
>  * Overlay "melpa" is missing "g-sorcery" module!
>  * Overlay "pypi" is missing "g-sorcery" module!
>  * 
>  * Errors:
>  * ------
>  * Failed to sync overlay "gnu-elpa".
>  * Error was: Syncing overlay "gnu-elpa" returned status True!
>  * db.sync()
>  * Failed to sync overlay "melpa".
>  * Error was: Syncing overlay "melpa" returned status True!
>  * db.sync()
>  * Failed to sync overlay "pypi".
>  * Error was: Syncing overlay "pypi" returned status True!
>  * db.sync()
>  *

OK forget it... Thanks for the trial.
Comment 11 n0t3p4d.opensource 2016-05-10 20:52:35 UTC
Quick and dirty hack which solves the problem:
Replace line 83 of module.py with something like 

                mname = kid['module_name']
                if ("-" in mname):
                    mname = re.sub("-", "_", mname)
                module = __import__(mname, [], [], ["not empty"])

Of course, don't forget to import re somewhere.
Comment 12 Brian Dolbec (RETIRED) gentoo-dev 2016-05-10 21:52:33 UTC
Yes, the main error was a mis-typed g-sorcery module that should have been g_sorcery everywhere.  But I made a change in the original portage code where module.py came from.  It adds the capability for a module to have one name, but import a file by a different name.  That patch was not applied correctly to layman's module.py.

I'll push the full fix shortly.
Comment 13 Brian Dolbec (RETIRED) gentoo-dev 2016-05-10 22:15:23 UTC
This is fixed in git commit: https://gitweb.gentoo.org/proj/layman.git/commit/?id=90fe6724d0a8d1ebfe6443dee118432e20432b8b

The easiest way to get this is emerge layman-9999.  The release 2.4.0 release should be bumped later today with the fix.
Comment 14 n0t3p4d.opensource 2016-05-10 22:21:12 UTC
The commit fixes the problem for me. Thank you very much!
Comment 15 Kolbjørn Barmen 2016-05-31 13:14:30 UTC
I had the same issue with 2.4.1 (that was release May 10th 2016), and applying the patch helped. How come it is not applied in 2.4.1 already? When can one expect a fixed version to be available in portage?
Comment 16 Brian Dolbec (RETIRED) gentoo-dev 2016-05-31 14:25:13 UTC
Sorry, I've been very busy with work, etc... 
I forgot about this, so thank you for the reminder.  I didn't want to push the fix right away in case any more bugs came in, as this one was not likely to affect a great number of users.

P just pushed layman-2.4.1-r1 to the tree.  It should be in an rsync tree in the next few hours.