in emerge there is code starting from 28 line: try: from _emerge.main import emerge_main except ImportError: from os import path as osp import sys sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import _emerge if "from _emerge.main import emerge_main" fail now we "import _emerge" but we should "from _emerge.main import emerge_main": try: from _emerge.main import emerge_main except ImportError: from os import path as osp import sys sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) from _emerge.main import emerge_main Reproducible: Always Steps to Reproduce: Happens in unladed-swallow python, but it can happens in normal python
Thanks, this is in svn r13895.
I'm having the same problem. Today I tried to upgrade portage and now emerge is not working anymore. The problem seems to be with the Python upgrade. # head -n4 /usr/bin/emerge #!/usr/bin/python # Copyright Gentoo Foundation 2006 # Portage Emerge bits # $Id: emerge 12321 2008-12-25 01:23:32Z zmedico $ head -n4 /usr/bin/python #!/bin/bash # Gentoo Python wrapper script [[ "${EPYTHON}" =~ (/|^python$) ]] && EPYTHON="python2.5" # eselect python list Available python interpreters: [1] python2.4 [2] python2.5 This happened when I was upgrading portage... >>> Emerging (5 of 5) sys-apps/portage-2.1.6.13 to / >>> Downloading 'http://mirror.usu.edu/mirrors/gentoo/distfiles/portage-2.1.6.13.patch.bz2' --14:04:52-- http://mirror.usu.edu/mirrors/gentoo/distfiles/portage-2.1.6.13.patch.bz2 => `/usr/portage/distfiles/portage-2.1.6.13.patch.bz2' Resolving mirror.usu.edu... 129.123.1.18 Connecting to mirror.usu.edu|129.123.1.18|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 177,383 (173K) [application/x-bzip2] 100%[====================================================================================================>] 177,383 134.62K/s 14:04:55 (134.29 KB/s) - `/usr/portage/distfiles/portage-2.1.6.13.patch.bz2' saved [177383/177383] >>> Downloading 'http://mirror.usu.edu/mirrors/gentoo/distfiles/portage-2.1.6.tar.bz2' --14:04:55-- http://mirror.usu.edu/mirrors/gentoo/distfiles/portage-2.1.6.tar.bz2 => `/usr/portage/distfiles/portage-2.1.6.tar.bz2' Resolving mirror.usu.edu... 129.123.1.18 Connecting to mirror.usu.edu|129.123.1.18|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 518,771 (507K) [application/x-bzip2] 100%[====================================================================================================>] 518,771 294.31K/s 14:04:57 (293.64 KB/s) - `/usr/portage/distfiles/portage-2.1.6.tar.bz2' saved [518771/518771] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] * checking portage-2.1.6.tar.bz2 ;-) ... [ ok ] * checking portage-2.1.6.13.patch.bz2 ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking portage-2.1.6.tar.bz2 to /var/tmp/portage/sys-apps/portage-2.1.6.13/work >>> Unpacking portage-2.1.6.13.patch.bz2 to /var/tmp/portage/sys-apps/portage-2.1.6.13/work * Applying portage-2.1.6.13.patch ... [ ok ] * Setting portage.VERSION to 2.1.6.13 ... >>> Source unpacked. >>> Compiling source in /var/tmp/portage/sys-apps/portage-2.1.6.13/work/portage-2.1.6 ... >>> Source compiled. >>> Test phase [not enabled]: sys-apps/portage-2.1.6.13 >>> Install portage-2.1.6.13 into /var/tmp/portage/sys-apps/portage-2.1.6.13/image/ category sys-apps patching file make.conf >>> Completed installing portage-2.1.6.13 into /var/tmp/portage/sys-apps/portage-2.1.6.13/image/ ecompressdir: bzip2 -9 /usr/share/man strip: x86_64-pc-linux-gnu-strip --strip-unneeded -R .comment * checking 257 files for package collisions >>> Merging sys-apps/portage-2.1.6.13 to / /var/tmp/._portage_reinstall_.nwJbmp/bin/portageq: line 6: import: command not found /var/tmp/._portage_reinstall_.nwJbmp/bin/portageq: line 8: try:: command not found /var/tmp/._portage_reinstall_.nwJbmp/bin/portageq: line 9: import: command not found /var/tmp/._portage_reinstall_.nwJbmp/bin/portageq: line 11: syntax error near unexpected token `(' /var/tmp/._portage_reinstall_.nwJbmp/bin/portageq: line 11: ` def exithandler(signum, frame):' * * ERROR: sys-apps/portage-2.1.6.13 failed. * Call stack: * ebuild.sh, line 49: Called pkg_preinst * environment, line 2271: Called has_version 'pkg_preinst' * ebuild.sh, line 180: Called die * The specific snippet of code: * die "unexpected portageq exit code: ${retval}" * The die message: * unexpected portageq exit code: 2 * * If you need support, post the topmost build error, and the call stack if relevant. * A complete build log is located at '/var/tmp/portage/sys-apps/portage-2.1.6.13/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/sys-apps/portage-2.1.6.13/temp/environment'. * !!! FAILED preinst: 1 * Messages for package sys-apps/portage-2.1.6.13: * * ERROR: sys-apps/portage-2.1.6.13 failed. * Call stack: * ebuild.sh, line 49: Called pkg_preinst * environment, line 2271: Called has_version 'pkg_preinst' * ebuild.sh, line 180: Called die * The specific snippet of code: * die "unexpected portageq exit code: ${retval}" * The die message: * unexpected portageq exit code: 2 * * If you need support, post the topmost build error, and the call stack if relevant. * A complete build log is located at '/var/tmp/portage/sys-apps/portage-2.1.6.13/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/sys-apps/portage-2.1.6.13/temp/environment'. * * GNU info directory index is up-to-date. * IMPORTANT: 1 config files in '/etc' need updating. * See the CONFIGURATION FILES section of the emerge * man page to learn how to update config files. I first thought that the problem was with portage.. but it does not seems to be. I did follow instructions in http://www.gentoo.org/proj/en/portage/doc/manually-fixing-portage.xml but had no success. # emerge --info /usr/bin/emerge: line 6: import: command not found /usr/bin/emerge: line 8: try:: command not found /usr/bin/emerge: line 9: import: command not found /usr/bin/emerge: line 11: syntax error near unexpected token `(' /usr/bin/emerge: line 11: ` def exithandler(signum,frame):' When I tried to replace python, I got this new error: bin # rm /usr/bin/python bin # ln -s /usr/bin/python2.4 /usr/bin/python bin # emerge --info Traceback (most recent call last): File "/usr/bin/emerge", line 34, in ? import _emerge ImportError: No module named _emerge taurus temp # rm /usr/bin/python taurus temp # ln -s /usr/bin/python2.5 /usr/bin/python taurus temp # emerge Traceback (most recent call last): File "/usr/bin/emerge", line 34, in <module> import _emerge ImportError: No module named _emerge I just noticed that there is not dir: /usr/lib/portage/pym/_emerge What might have happened to it? k, but what can I do to have emerge working back? Does anybody have a solution so we can have portage/emerge working back? Now my system seems to be dead for updates. Thanks.
(In reply to comment #2) Wrong bug. See bug #279915, comment #76 for solution.
(In reply to comment #3) They said it should be reported here. See comment #81.
Created attachment 200216 [details, diff] fix import (In reply to comment #4) > They said it should be reported here. > See comment #81. I see. If this patch is saved as /tmp/emerge_import.patch, then it can be applied as follows: patch /usr/lib/portage/bin/emerge /tmp/emerge_import.patch
This is fixed in 2.2_rc36.
(In reply to comment #6) > This is fixed in 2.2_rc36. > But how can I fix it if my emerge is not working?
(In reply to comment #7) > (In reply to comment #6) > > This is fixed in 2.2_rc36. > > > > But how can I fix it if my emerge is not working? Comment #5 describes what you should do.
That file does not exist on my server. (In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #6) > > > This is fixed in 2.2_rc36. > > > > > > > But how can I fix it if my emerge is not working? > > Comment #5 describes what you should do. >
(In reply to comment #9) > That file does not exist on my server. Which file doesn't exist, /usr/lib/portage/bin/emerge or /tmp/emerge_import.patch? If it's just /tmp/emerge_import.patch that's missing then you only need to download it from the attachment on this bug. If it's /usr/lib/portage/bin/emerge that's missing then you can use these steps: http://www.gentoo.org/proj/en/portage/doc/manually-fixing-portage.xml
(In reply to comment #10) patch /usr/lib/portage/bin/emerge /tmp/portage_import.patch patching file /usr/lib/portage/bin/emerge Hunk #1 FAILED at 31. 1 out of 1 hunk FAILED -- saving rejects to file /usr/lib/portage/bin/emerge.rej cat /usr/lib/portage/bin/emerge.rej *************** *** 31,37 **** from os import path as osp import sys sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) - import _emerge if __name__ == "__main__": import sys --- 31,37 ---- from os import path as osp import sys sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) + from _emerge.main import emerge_main if __name__ == "__main__": import sys Didnt work out. :( What next?
It seems to get better. Now I can run emerge, but it does not merge files: emerge iptraf Calculating dependencies... done! >>> Verifying ebuild manifests >>> Emerging (1 of 1) net-analyzer/iptraf-3.0.0-r5 Traceback (most recent call last): File "/usr/lib64/portage/bin/ebuild", line 26, in <module> import portage, portage_util, portage_const File "/usr/lib/portage/pym/portage_util.py", line 5, in <module> from portage_exception import PortageException, FileNotFound, \ File "/usr/lib/portage/pym/portage_exception.py", line 5, in <module> from portage_exception import PortageException, FileNotFound, \ ImportError: cannot import name PortageException * Fetch failed for 'net-analyzer/iptraf-3.0.0-r5', Log file: * '/var/tmp/portage/net-analyzer/iptraf-3.0.0-r5/temp/build.log' >>> Failed to emerge net-analyzer/iptraf-3.0.0-r5, Log file: >>> '/var/tmp/portage/net-analyzer/iptraf-3.0.0-r5/temp/build.log' * Messages for package net-analyzer/iptraf-3.0.0-r5: * Fetch failed for 'net-analyzer/iptraf-3.0.0-r5', Log file: * '/var/tmp/portage/net-analyzer/iptraf-3.0.0-r5/temp/build.log'
(In reply to comment #12) When all else fails, use this approach: http://www.gentoo.org/proj/en/portage/doc/manually-fixing-portage.xml
(In reply to comment #13) I did that. Still not working.
(In reply to comment #14) > (In reply to comment #13) > > I did that. Still not working. > Which release did you try? You should try portage-2.1.6.tar.bz2.
Nice. Worked perfect! Thanks.