Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 718578 - 'ebuild.sh clean' fails ("ModuleNotFoundError: No module named 'portage.util.netlink'") during rebuilding of sys-apps/portage with changed PYTHON_TARGETS
Summary: 'ebuild.sh clean' fails ("ModuleNotFoundError: No module named 'portage.util....
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 706142 711148
  Show dependency tree
 
Reported: 2020-04-20 08:32 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2020-04-21 04:35 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 Arfrever Frehtes Taifersar Arahesis 2020-04-20 08:32:25 UTC
[ebuild   R    ] sys-apps/portage-2.3.99-r1::gentoo  USE="(ipc) native-extensions xattr -apidoc -build -doc -gentoo-dev -rsync-verify (-selinux)" KERNEL="(linux)" PYTHON_TARGETS="python3_8* -pypy3 -python3_6 -python3_7*" 0 KiB

...
<<<          dir /usr/lib/portage/python3.7/preinst-qa-check.d
<<<          dir /usr/lib/portage/python3.7/postinst-qa-check.d
<<<          dir /usr/lib/portage/python3.7/install-qa-check.d
<<<          dir /usr/lib/portage/python3.7/ebuild-helpers/xattr
<<<          dir /usr/lib/portage/python3.7/ebuild-helpers/unprivileged
<<<          dir /usr/lib/portage/python3.7/ebuild-helpers/bsd
<<<          dir /usr/lib/portage/python3.7/ebuild-helpers
<<<          dir /usr/lib/portage/python3.7
No module named 'portage.util.netlink':
   /bin/bash -c /var/tmp/portage/._portage_reinstall_.w6hi1uuu/bin/ebuild.sh clean
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/portage/process.py", line 384, in spawn
  File "/usr/lib/python3.7/site-packages/portage/process.py", line 716, in _exec
  File "/usr/lib/python3.7/site-packages/portage/process.py", line 508, in _configure_loopback_interface
ModuleNotFoundError: No module named 'portage.util.netlink'
>>> Regenerating /etc/ld.so.cache...
>>> Original instance of package unmerged safely.
>>> sys-apps/portage-2.3.99-r1 merged.
No module named 'portage.util.netlink':
   /bin/bash -c /var/tmp/portage/._portage_reinstall_.w6hi1uuu/bin/ebuild.sh clean
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/portage/process.py", line 384, in spawn
  File "/usr/lib/python3.7/site-packages/portage/process.py", line 716, in _exec
  File "/usr/lib/python3.7/site-packages/portage/process.py", line 508, in _configure_loopback_interface
ModuleNotFoundError: No module named 'portage.util.netlink'

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.



${PORTAGE_TMPDIR}/portage/sys-apps/portage-* remains.

Problem probably introduced in commit 70ec13029e5cc8a1decfab7134d3addea8612bd7:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=70ec13029e5cc8a1decfab7134d3addea8612bd7

commit 70ec13029e5cc8a1decfab7134d3addea8612bd7
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-08-30 18:24:47 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-08-31 03:10:03 +0000

    Use RTNETLINK to configure the loopback interface
    
    This eliminates the dependency on iproute2 on Linux.
    
    Bug: https://bugs.gentoo.org/690758
Comment 1 Arfrever Frehtes Taifersar Arahesis 2020-04-20 08:40:02 UTC
> ${PORTAGE_TMPDIR}/portage/sys-apps/portage-* remains.

Also ${PORTAGE_TMPDIR}/._unmerge_/sys-apps/portage-* remains.
Comment 2 Zac Medico gentoo-dev 2020-04-20 08:51:39 UTC
The portage.util.netlink import needs to be done in global scope (could be use lazyimport), for the same reason the that portage.proxy.lazyimport._preload_portage_submodules() function exists.
Comment 3 Zac Medico gentoo-dev 2020-04-20 08:55:02 UTC
We better not use lazyimport for this because if it fails then portage.proxy.lazyimport._preload_portage_submodules() will fail.
Comment 4 Mike Gilbert gentoo-dev 2020-04-20 19:59:51 UTC
I think importing the netlink module on non-Linux systems will fail. I'm guessing that AF_NETLINK is not defined on other systems.

Is there a nicer way to deal with this?
Comment 5 Zac Medico gentoo-dev 2020-04-20 20:24:30 UTC
We can do something like this in global scope and later test if RtNetlink is None as needed:

try:
    from portage.util.netlink import RtNetlink
except Exception:
    if platform.system() == "Linux":
        raise
    RtNetlink = None
Comment 6 Larry the Git Cow gentoo-dev 2020-04-20 21:16:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=9738a404e876270cbdef2514f66915bce35d7435

commit 9738a404e876270cbdef2514f66915bce35d7435
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2020-04-20 20:47:00 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-04-20 21:14:25 +0000

    Import portage.util.netlink.RtNetlink in global scope
    
    Bug: https://bugs.gentoo.org/718578
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    Reviewed-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/process.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Comment 7 Larry the Git Cow gentoo-dev 2020-04-21 04:35:38 UTC
The bug has been closed via the following commit(s):

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

commit 8dca612ca4c7e32e51bda62943a224b717decf33
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-04-21 03:45:58 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-04-21 04:33:42 +0000

    sys-apps/portage: revbump to 2.3.99-r2 for bug 718578
    
     #718578 ModuleNotFoundError for portage.util.netlink
    
    Bug: https://bugs.gentoo.org/711148
    Closes: https://bugs.gentoo.org/718578
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 .../portage/{portage-2.3.99-r1.ebuild => portage-2.3.99-r2.ebuild} | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Additionally, it has been referenced in the following commit(s):

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

commit a81ec04a86a9b593d9dbafe30e96cd8453831798
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-04-21 03:08:09 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-04-21 03:11:17 +0000

    sys-apps/portage: stable revbump to 2.3.89-r3 for bug 718578
    
     #718578 ModuleNotFoundError for portage.util.netlink
    
    Bug: https://bugs.gentoo.org/706142
    Bug: https://bugs.gentoo.org/718578
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest                                          | 1 +
 .../portage/{portage-2.3.89-r2.ebuild => portage-2.3.89-r3.ebuild} | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)