Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 796143 - sys-apps/fwupd-1.6.1 fails to detect correct Python version
Summary: sys-apps/fwupd-1.6.1 fails to detect correct Python version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL: https://github.com/fwupd/fwupd/pull/3...
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2021-06-15 06:38 UTC by nvaert1986
Modified: 2021-06-16 09:27 UTC (History)
3 users (show)

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


Attachments
meson-log.txt (meson-log.txt,87.93 KB, text/plain)
2021-06-15 06:39 UTC, nvaert1986
Details
emerge --info output (emerge-info,6.78 KB, text/plain)
2021-06-15 07:01 UTC, nvaert1986
Details
build.log (build.log,11.21 KB, text/plain)
2021-06-15 10:03 UTC, nvaert1986
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nvaert1986 2021-06-15 06:38:01 UTC
The package sys-apps/fwupd-1.6.1 fails to compile due to missing dependencies that are not included in the ebuild check. 

Reproducible: Always

Steps to Reproduce:
1.Emerge sys-apps/fwupd-1.6.1
Actual Results:  
An unexpected error: meson.build:402:6: ERROR: Problem encountered: Error: missing dependency python gobject introspection (python3-gi)

Expected Results:  
a compiled package

Please see the attached build log.
Comment 1 nvaert1986 2021-06-15 06:39:03 UTC
Created attachment 716166 [details]
meson-log.txt
Comment 2 nvaert1986 2021-06-15 07:01:00 UTC
Created attachment 716181 [details]
emerge --info output
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-15 09:43:47 UTC
Looks like you attached meson-log.txt and not build.log.
Comment 4 nvaert1986 2021-06-15 10:03:37 UTC
Created attachment 716256 [details]
build.log
Comment 5 nvaert1986 2021-06-15 10:03:48 UTC
Sorry, just attached the correct build.log
Comment 6 Kobboi 2021-06-15 11:25:41 UTC
"Program python3.8 found: YES (/usr/bin/python3.8)"
(...)
Running command: /usr/bin/python3.8 po/test-deps
--- stdout ---
Error: missing dependency python gobject introspection (python3-gi)

--- stderr ---
Traceback (most recent call last):
  File "po/test-deps", line 17, in <module>
    gi.require_version("Pango", "1.0")
NameError: name 'gi' is not defined


I do indeed have python3.8 installed, but compiling fwupd and gobject-introspection with PYTHON_SINGLE_TARGET="python3.9"
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-15 11:51:27 UTC
I assume that dev-python/pygobject is also using python3_9, right?

At the moment I don't understand how meson can switch to Python3.8.
Comment 8 Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-15 12:02:45 UTC
OK, I am now able to reproduce. Caused by https://github.com/fwupd/fwupd/commit/1b396215d9396680b1b6b5c14c6f57f2226ff0a9.
Comment 9 nvaert1986 2021-06-15 12:20:43 UTC
Yes, pygobject is using python 3.9

Calculating dependencies... done!
[ebuild   R    ] dev-python/pygobject-3.40.1:3::gentoo  USE="cairo -examples -test" PYTHON_TARGETS="python3_9 (-python3_10) -python3_8" 0 KiB

I have the following set in my make.conf and no overrides.

PYTHON_TARGETS="python3_9"
PYTHON_SINGLE_TARGET="python3_9"
Comment 10 Larry the Git Cow gentoo-dev 2021-06-15 12:21:31 UTC
The bug has been referenced in the following commit(s):

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

commit fa0b9e87f41366e6cdaf517e7ebcc6df76300f7c
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2021-06-15 12:20:33 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2021-06-15 12:21:18 +0000

    sys-apps/fwupd: fix Python detection
    
    Bug: https://bugs.gentoo.org/796143
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 ...-revert-Change-python-version-check-order.patch | 25 ++++++++++++++++++++++
 sys-apps/fwupd/fwupd-1.6.1.ebuild                  |  3 ++-
 2 files changed, 27 insertions(+), 1 deletion(-)
Comment 11 Kobboi 2021-06-15 16:13:15 UTC
Is reverting the check correct? Is the python version that python3 points to (I guess set with 'eselect python') guaranteed to be equal to the PYTHON_SINGLE_TARGET value of the package?
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-06-15 16:23:23 UTC
(In reply to Kobboi from comment #11)
> Is reverting the check correct? Is the python version that python3 points to
> (I guess set with 'eselect python') guaranteed to be equal to the
> PYTHON_SINGLE_TARGET value of the package?

We discussed it in #gentoo-python and I think a different check may be needed.
Comment 13 Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-15 16:44:49 UTC
It's correct for Gentoo because Python eclass will take care of "python3".

Upstream has also reverted patch and came up with https://github.com/fwupd/fwupd/commit/f4ef486da80a3b5916f8a58f10a70f30cf05f756.
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-06-15 17:12:31 UTC
(In reply to Thomas Deutschmann from comment #13)
> It's correct for Gentoo because Python eclass will take care of "python3".
> 

What about -native-symlinks?

> Upstream has also reverted patch and came up with
> https://github.com/fwupd/fwupd/commit/
> f4ef486da80a3b5916f8a58f10a70f30cf05f756.

This isn't a proper fix upstream though for non-Gentoo (and I don't think -native-symlinks).

----

For context for others in the bug:
[12:40:50]  <+Whissi> How is it possible that user switches to python3.8 when ebuild started with python3.9? -> https://796143.bugs.gentoo.org/attachment.cgi?id=716256
[12:41:12]  <+Whissi> "user".. meson.
[12:56:28]  <@mgorny> Whissi: i'm going to guess something in meson hardcodes 3.8
[12:59:00]  <+Whissi> Oh, "./meson.build:python3 = find_program('python3.8', 'python3', 'python3.9')"
[12:59:15]  <+Whissi> So if you have python3.8 around, it will be picked up first :/
[12:59:50]  <+Whissi> \o/ - Just installing python3.8 will allow me to reproduce
[13:01:23]  <+Whissi> https://github.com/fwupd/fwupd/commit/1b396215d9396680b1b6b5c14c6f57f2226ff0a9 ... but why
[13:03:37]  <telans> Whissi: https://github.com/fwupd/fwupd/pull/3274#discussion_r642548028
[13:04:15]  <telans> from one of the last superm1 reviews
[13:05:15]  <+Whissi> Thanks.
[13:11:01]  <+Whissi> Has anyone seen this *BSD problem already and can suggest a fix?
[13:25:16]  <@mgorny> Whissi: i'm 90% sure there's some -D to override this find
[13:40:37]  <+Whissi> Found meson.override_find_program but dunno how to use it via -D 
[14:12:33] Mode is +nt
[14:25:54]  AndrewAmmerlaan (~Thunderbi@gentoo/developer/andrewammerlaan) left IRC (Quit: AndrewAmmerlaan)
[14:36:17]  <@mgorny> hmm, wtf do they use find_program() and not that python finding shit...
[14:36:27]  <@mgorny> anyway, i'm not a meson expert
[14:36:32]  <@mgorny> Soap: ^
[14:37:21]  <@Soap> yup
[14:37:23]  <@Soap> wrong
[14:37:37]  <@Soap> you need to find the python interpreter
[14:37:51]  <@Soap> i.e., you need to use meson's "python" module and invoke the interpreter from there
[14:39:14]  <@Soap> https://mesonbuild.com/Python-module.html
Comment 15 Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-15 21:10:49 UTC
I am sorry? Package worked and still works with the reverted/new upstream fix perfectly fine with dev-lang/python-exec[-native-symlinks].
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-06-15 21:29:04 UTC
(In reply to Thomas Deutschmann from comment #15)
> I am sorry? Package worked and still works with the reverted/new upstream
> fix perfectly fine with dev-lang/python-exec[-native-symlinks].

It wasn't an accusation or something, I'm just saying it doesn't seem like it should work. I'm wondering if it just works by chance right now based on Meson's current logic for find_program?

i.e. How should it actually know which Python version to use?

Maybe I'm missing something though. https://mesonbuild.com/Reference-manual.html#find_program doesn't make it clear to me how it's working right now and choosing the right one.
Comment 17 Larry the Git Cow gentoo-dev 2021-06-15 23:04:55 UTC
The bug has been referenced in the following commit(s):

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

commit 663a25c8d581d31ef58930aea642af90bbf1bdc8
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2021-06-15 22:45:53 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2021-06-15 22:53:46 +0000

    sys-apps/fwupd: switch to upstream patch
    
    Bug: https://bugs.gentoo.org/796143
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 .../files/fwupd-1.6.1-fix-python-detection.patch   | 51 ++++++++++++++++++++++
 ...-revert-Change-python-version-check-order.patch | 25 -----------
 sys-apps/fwupd/fwupd-1.6.1-r1.ebuild               |  2 +-
 3 files changed, 52 insertions(+), 26 deletions(-)
Comment 18 Thomas Deutschmann (RETIRED) gentoo-dev 2021-06-15 23:06:20 UTC
Let's move the discussion to IRC.

Issue has been resolved, closing.
Comment 19 Kobboi 2021-06-16 07:10:10 UTC
Note that (maybe because of the the temporary masking), a file collision has popped up in fwupd-efi:

[7/7] /var/tmp/portage/sys-apps/fwupd-efi-1.0/work/fwupd-efi-1.0/efi/generate_binary.py efi/fwup.so efi/fwupdx64.efi --arch x86_64 --objcopy x86_64-pc-linux-gnu-objcopy
ninja -v -j32 -l0 -C /var/tmp/portage/sys-apps/fwupd-efi-1.0/work/fwupd-efi-1.0-build install
ninja: Entering directory `/var/tmp/portage/sys-apps/fwupd-efi-1.0/work/fwupd-efi-1.0-build'
[0/1] /usr/lib/python-exec/python3.9/meson install --no-rebuild
Installing efi/fwupdx64.efi to /var/tmp/portage/sys-apps/fwupd-efi-1.0/image/usr/libexec/fwupd/efi
Installing /var/tmp/portage/sys-apps/fwupd-efi-1.0/work/fwupd-efi-1.0-build/meson-private/fwupd-efi.pc to /var/tmp/portage/sys-apps/fwupd-efi-1.0/image/usr/lib64/pkgconfig
 * Final size of build directory: 1420 KiB (1.3 MiB)
 * Final size of installed tree:    76 KiB
 * This package will overwrite one or more files that may belong to other
 * packages (see list below).
 * 
 * Detected file collision(s):
 * 
 * 	/usr/libexec/fwupd/efi/fwupdx64.efi
 * 
 * Searching all installed packages for file collisions...
 * 
 * Press Ctrl-C to Stop
 * 
 * sys-apps/fwupd-1.5.9-r1:0::gentoo
 * 	/usr/libexec/fwupd/efi/fwupdx64.efi
 * 
 * Package 'sys-apps/fwupd-efi-1.0' NOT merged due to file collisions. If
 * necessary, refer to your elog messages for the whole content of the
 * above message.
Comment 20 Larry the Git Cow gentoo-dev 2021-06-16 09:27:42 UTC
The bug has been referenced in the following commit(s):

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

commit 306db48797ce6d97f663a05555af7aa7f790e9da
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2021-06-16 09:27:19 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2021-06-16 09:27:38 +0000

    sys-apps/fwupd-efi: set blocker on previous <sys-apps/fwupd-1.6.0 to aid upgrading
    
    Bug: https://bugs.gentoo.org/796143
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 sys-apps/fwupd-efi/fwupd-efi-1.0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)