- Add 8583.patch: Fix build againts pygobject 3.52.

OBS-URL: https://build.opensuse.org/package/show/Base:System/fwupd?expand=0&rev=210
This commit is contained in:
2025-03-13 15:44:35 +00:00
committed by Git OBS Bridge
parent efbad168cc
commit 7e515dade9
4 changed files with 114 additions and 33 deletions

112
8583.patch Normal file
View File

@@ -0,0 +1,112 @@
From aba189800de13188c5a4f9b89803e696cf18de81 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Thu, 13 Mar 2025 16:38:52 +0100
Subject: [PATCH] Fix build against pygobject 3.52
With the introduction of pygobject 3.52, accessing GIRepository 2.0 is
no longer permitted.
Instead of complicating the test code with conditionalizing between
GIRepository 2.0 and GIRepository 3.0 in override_gi_search_path,
we can drop override_gi_search_path entirely and rely on GIRepository's
own envvar GI_TYPELIB_PATH to help it find our freshly built typelib
Fixes #8569
---
contrib/test-venv.sh | 3 ++-
data/tests/fwupd_test.py | 16 ----------------
data/tests/meson.build | 1 -
plugins/meson.build | 3 ++-
plugins/pci-psp/pci_psp_test.py | 3 +--
5 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/contrib/test-venv.sh b/contrib/test-venv.sh
index 1a061d3d7cf0..5e622b95b491 100755
--- a/contrib/test-venv.sh
+++ b/contrib/test-venv.sh
@@ -5,7 +5,8 @@ BUILD=${VENV}/build
INSTALLED_TESTS=${VENV}/dist/share/installed-tests/fwupd
export G_TEST_BUILDDIR=${INSTALLED_TESTS}
export G_TEST_SRCDIR=${INSTALLED_TESTS}
-export LIBFWUPD_BUILD_DIR=${BUILD}/libfwupd
+export GI_TYPELIB_PATH=${BUILD}/libfwupd
+export LD_LIBRARY_PATH=${BUILD}/libfwupd
export DAEMON_BUILDDIR=${BUILD}/src
export PATH=${VENV}/bin:$PATH
diff --git a/data/tests/fwupd_test.py b/data/tests/fwupd_test.py
index 4840fc52eeb5..376e5c863a1b 100755
--- a/data/tests/fwupd_test.py
+++ b/data/tests/fwupd_test.py
@@ -21,20 +21,6 @@
gi.require_version("UMockdev", "1.0")
from gi.repository import UMockdev
-
-def override_gi_search_path():
- if "LIBFWUPD_BUILD_DIR" in os.environ:
- gi.require_version("GIRepository", "2.0")
- from gi.repository import GIRepository
-
- GIRepository.Repository.prepend_search_path(
- os.path.join(os.environ["LIBFWUPD_BUILD_DIR"])
- )
- GIRepository.Repository.prepend_library_path(
- os.path.join(os.environ["LIBFWUPD_BUILD_DIR"])
- )
-
-
class FwupdTest(dbusmock.DBusTestCase):
DBUS_NAME = "org.freedesktop.fwupd"
DBUS_PATH = "/"
@@ -60,8 +46,6 @@ def setUpClass(cls):
cls.start_system_bus()
cls.dbus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
- override_gi_search_path()
-
def setUp(self):
self.testbed = UMockdev.Testbed.new()
self.polkitd, self.obj_polkit = self.spawn_server_template(
diff --git a/data/tests/meson.build b/data/tests/meson.build
index 517ce034b3cc..0d2eb1e98319 100644
--- a/data/tests/meson.build
+++ b/data/tests/meson.build
@@ -141,7 +141,6 @@ if umockdev_integration_tests.allowed()
test(ut, python3, args: [fwupd_mockdev_tests, ut], is_parallel: false,
env: {
'DAEMON_BUILDDIR': join_paths(meson.project_build_root(), 'src'),
- 'LIBFWUPD_BUILD_DIR': join_paths(meson.project_build_root(), 'libfwupd'),
'STATE_DIRECTORY': join_paths(meson.project_build_root(), 'state'),
'CACHE_DIRECTORY': join_paths(meson.project_build_root(), 'cache'),
},
diff --git a/plugins/meson.build b/plugins/meson.build
index 22397c65b4f6..8ccdbac00382 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -154,7 +154,8 @@ endforeach
if umockdev_integration_tests.allowed()
envs = environment()
envs.set('DAEMON_BUILDDIR', join_paths(meson.project_build_root(), 'src'))
- envs.set('LIBFWUPD_BUILD_DIR', join_paths(meson.project_build_root(), 'libfwupd'))
+ envs.set('LD_LIBRARY_PATH', join_paths(meson.project_build_root(), 'libfwupd'))
+ envs.set('GI_TYPELIB_PATH', join_paths(meson.project_build_root(), 'libfwupd'))
envs.set('PYTHONPATH', join_paths(meson.project_source_root(), 'data', 'tests'))
envs.set('FWUPD_DATADIR_QUIRKS', join_paths(meson.project_build_root()))
envs.set('STATE_DIRECTORY', join_paths(meson.project_build_root(), 'state'))
diff --git a/plugins/pci-psp/pci_psp_test.py b/plugins/pci-psp/pci_psp_test.py
index b3f4f3d924c8..059bf272c1ce 100755
--- a/plugins/pci-psp/pci_psp_test.py
+++ b/plugins/pci-psp/pci_psp_test.py
@@ -8,10 +8,9 @@
import os
import sys
import unittest
-from fwupd_test import FwupdTest, override_gi_search_path
+from fwupd_test import FwupdTest
try:
- override_gi_search_path()
gi.require_version("Fwupd", "2.0")
from gi.repository import Fwupd # pylint: disable=wrong-import-position
except ValueError:

View File

@@ -1,30 +0,0 @@
diff --git a/data/tests/fwupd_test.py b/data/tests/fwupd_test.py
index 4840fc52..e517c732 100755
--- a/data/tests/fwupd_test.py
+++ b/data/tests/fwupd_test.py
@@ -24,13 +24,21 @@ from gi.repository import UMockdev
def override_gi_search_path():
if "LIBFWUPD_BUILD_DIR" in os.environ:
- gi.require_version("GIRepository", "2.0")
- from gi.repository import GIRepository
+ try:
+ gi.require_version("GIRepository", "3.0")
+ from gi.repository import GIRepository
+ repo = GIRepository.Repository()
+ except ValueError:
+ gi.require_version("GIRepository", "2.0")
+ from gi.repository import GIRepository
- GIRepository.Repository.prepend_search_path(
+ repo = GIRepository.Repository
+
+ repo.prepend_search_path(
os.path.join(os.environ["LIBFWUPD_BUILD_DIR"])
)
- GIRepository.Repository.prepend_library_path(
+
+ repo.prepend_library_path(
os.path.join(os.environ["LIBFWUPD_BUILD_DIR"])
)

View File

@@ -3,8 +3,7 @@ Tue Mar 11 14:41:20 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>
- Add explicit pkgconfig(pango) BuildRequires: used to be pulled in
by python-gobject, but that's no longer the case with 3.52.
- Add fwupd-girepository-3.0.patch: WIP patch, attempting to fix
build againt pygobject 3.52.
- Add 8583.patch: Fix build againts pygobject 3.52.
-------------------------------------------------------------------
Fri Feb 14 13:22:21 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@@ -49,7 +49,7 @@ URL: https://fwupd.org/
Source: %{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM
Patch0: fwupd-girepository-3.0.patch
Patch0: https://patch-diff.githubusercontent.com/raw/fwupd/fwupd/pull/8583.patch
# PATCH-FIX-OPENSUSE fwupd-bsc1130056-shim-path.patch bsc#1130056
Patch1: fwupd-bsc1130056-change-shim-path.patch