Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 683932 - sys-apps/portage-2.3.64 failed to install due to missing module 'portage._compat_upgrade'
Summary: sys-apps/portage-2.3.64 failed to install due to missing module 'portage._com...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-21 05:24 UTC by Francois Chenier
Modified: 2019-04-23 22:41 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Chenier 2019-04-21 05:24:49 UTC
That's a chicken and egg issue. This little snippet of code 

env -u DISTDIR \
       -u PORTAGE_OVERRIDE_EPREFIX \
       -u PORTAGE_REPOSITORIES \
       -u PORTDIR \
       -u PORTDIR_OVERLAY \
       PYTHONPATH="${ED%/}${PYTHON_SITEDIR}${PYTHONPATH:+:${PYTHONPATH}}" \
       "${PYTHON}" -m portage._compat_upgrade.default_locations || die

in portage 2.3.64 ebuild will always fail because default_location.py does not exist in previous version of portage.

Reproducible: Always

Steps to Reproduce:
1.sudo emerge portage (I got 2.3.63 installed at the time)
Actual Results:  
 * ERROR: sys-apps/portage-2.3.64::gentoo failed (preinst phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 124:  Called pkg_preinst
 *   environment, line 3257:  Called die
 * The specific snippet of code:
 *       env -u DISTDIR -u PORTAGE_OVERRIDE_EPREFIX -u PORTAGE_REPOSITORIES -u PORTDIR -u PORTDIR_OVERLAY PYTHONPATH="${ED%/}${PYTHON_SITEDIR}${PYTHONPATH:+:${PYTHONPATH}}" "${PYTHON}" -m portage._compat_upgrade.default_locations || die;
 


WORKAROUND to install version 2.3.64
1) Remove offending "|| die" in portage ebuild
2) emerge portage twice (first time portage will complain about missing module, second time will work)
Comment 1 Arfrever Frehtes Taifersar Arahesis 2019-04-21 05:43:26 UTC
However this code sets PYTHONPATH...
Comment 2 Zac Medico gentoo-dev 2019-04-21 06:29:28 UTC
Maybe the PYTHONPATH="${ED%/}${PYTHON_SITEDIR}" setting is somehow incorrect.
Comment 3 Larry the Git Cow gentoo-dev 2019-04-22 07:14:49 UTC
The bug has been referenced in the following commit(s):

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

commit c3a95fc7560502ad7494862c49a4c0a0ed33c58b
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-04-22 07:02:01 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-04-22 07:14:39 +0000

    sys-apps/portage: fix PYTHONPATH in pkg_postinst (bug 683932)
    
    Since PYTHON_SITEDIR begins with ${EPREFIX}, avoid a double prefix
    by using ${D} instead of ${ED}.
    
    Bug: https://bugs.gentoo.org/683932
    Package-Manager: Portage-2.3.64, Repoman-2.3.12
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/portage-2.3.64.ebuild | 2 +-
 sys-apps/portage/portage-9999.ebuild   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 4 Zac Medico gentoo-dev 2019-04-22 07:17:12 UTC
(In reply to Zac Medico from comment #2)
> Maybe the PYTHONPATH="${ED%/}${PYTHON_SITEDIR}" setting is somehow incorrect.

It could fail if python_setup selects a python interpreter that is not enabled in PYTHON_TARGETS for the current instance of portage that's being installed.
Comment 5 Larry the Git Cow gentoo-dev 2019-04-22 21:38:12 UTC
The bug has been referenced in the following commit(s):

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

commit cd42be9b33ca5b54a6429305acea8000bb268483
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-04-22 21:36:15 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-04-22 21:36:21 +0000

    sys-apps/portage: validate PYTHON_SITEDIR (bug 683932)
    
    Bug: https://bugs.gentoo.org/683932
    Package-Manager: Portage-2.3.64, Repoman-2.3.12
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/portage-2.3.64.ebuild | 1 +
 sys-apps/portage/portage-9999.ebuild   | 1 +
 2 files changed, 2 insertions(+)
Comment 6 Zac Medico gentoo-dev 2019-04-22 21:44:32 UTC
Please test the current ebuild which validates that ${D%/}${PYTHON_SITEDIR} exists.
Comment 7 Francois Chenier 2019-04-23 09:16:21 UTC
(In reply to Zac Medico from comment #6)
> Please test the current ebuild which validates that ${D%/}${PYTHON_SITEDIR}
> exists.

Still doesn't work but I found the issue. Problem is with python_export() function call which sets PYTHON_SITEDIR variable to /usr/lib/python3.7/site-packages on my system. If I add missing /local/ to the path, so using

PYTHON_SITEDIR="/usr/local/lib/${EPYTHON}/site-packages"

sys-apps/portage-2.3.64 install fine, no complains.

More oddities. This issue is only present if I upgrade from older portage releases. Re-installing portage 2.3.64 (on top of 2.3.64) works perfectly with the original unmodified ebuild.
Comment 8 Arfrever Frehtes Taifersar Arahesis 2019-04-23 15:11:19 UTC
No Python packages should install anything into /usr/local/... in Gentoo.
You have done something to break your Python.
Comment 9 Francois Chenier 2019-04-23 22:41:33 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #8)
> No Python packages should install anything into /usr/local/... in Gentoo.
> You have done something to break your Python.

I disagree because first I have no Python package in /usr/local/ in my system (/usr/local point to /usr with a symlink) and as far I remember (10 years+) I never had any issue with any Python 2.x/3.x packages (or others) complaining about that.

BTW, I don't really care too much about that bug because I consider it as a glitch. If I can reinstall version 2.3.64 with an unmodified ebuild (which works) it should succeed as well on any portage future releases.