From d2c6cc454d246eb3b2f86fbb08fc7df48e7ae1fb Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Thu, 6 Feb 2025 08:10:30 +0800 Subject: [PATCH] check typelib provides against installed typelib libs --- gi-find-deps.sh | 5 ++-- gobject-introspection-typelib.template | 18 +++++++++++++++ gobject-introspection.spec | 32 +++++++++++--------------- 3 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 gobject-introspection-typelib.template diff --git a/gi-find-deps.sh b/gi-find-deps.sh index b61b58e..4ac5031 100755 --- a/gi-find-deps.sh +++ b/gi-find-deps.sh @@ -70,17 +70,18 @@ function python_requires { for module in $(grep -h -P "^\s*from gi\.repository import (\w+)" $1 | sed -e 's:#.*::' -e 's:raise ImportError.*::' -e 's:.*"from gi.repository import .*".*::' | sed -e 's,from gi.repository import,,' -r -e 's:\s+$::g' -e 's:\s+as\s+\w+::g' -e 's:,: :g'); do split_name_version $module print_req_prov - # Temporarly disabled... this is not true if the python code is written for python3... And there seems no real 'way' to identify this. - # echo "python-gobject >= 2.21.4" + echo "python3dist(pygobject) >= 2.21.4" done for module in $(grep -h -P -o ".*(gi\.require_version\(['\"][^'\"]+['\"],\s*['\"][^'\"]+['\"]\))" $1 | sed -e 's:#.*::' -e 's:.*gi.require_version::' -e "s:[()\"' ]::g" -e 's:,:-:'); do split_name_version $module print_req_prov + echo "python3dist(pygobject) >= 2.21.4" done # python glue layers (/gi/overrides) import their typelibs slightly different for module in $(grep -h -P -o "=\s+(get_introspection_module\(['\"][^'\"]+['\"]\))" $1 | sed -e 's:#.*::' -e 's:=.*get_introspection_module::' -e "s:[()\"' ]::g"); do split_name_version $module print_req_prov + echo "python3dist(pygobject) >= 2.21.4" done } diff --git a/gobject-introspection-typelib.template b/gobject-introspection-typelib.template new file mode 100644 index 0000000..9f8a87e --- /dev/null +++ b/gobject-introspection-typelib.template @@ -0,0 +1,18 @@ +typelib(DBus) = 1.0 +typelib(DBusGLib) = 1.0 +typelib(GIRepository) = 2.0 +typelib(GL) = 1.0 +typelib(GLib) = 2.0 +typelib(GModule) = 2.0 +typelib(GObject) = 2.0 +typelib(Gio) = 2.0 +typelib(Vulkan) = 1.0 +typelib(cairo) = 1.0 +typelib(fontconfig) = 2.0 +typelib(freetype2) = 2.0 +typelib(libxml2) = 2.0 +typelib(win32) = 1.0 +typelib(xfixes) = 4.0 +typelib(xft) = 2.0 +typelib(xlib) = 2.0 +typelib(xrandr) = 1.3 diff --git a/gobject-introspection.spec b/gobject-introspection.spec index f33f522..82dd72d 100644 --- a/gobject-introspection.spec +++ b/gobject-introspection.spec @@ -2,7 +2,7 @@ Name: gobject-introspection Version: 1.76.1 -Release: 2 +Release: 3 Summary: Introspection system for GObject-based libraries License: GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause URL: https://gi.readthedocs.io/ @@ -11,6 +11,7 @@ Source0: https://download.gnome.org/sources/gobject-introspection/1.76/%{ # Script creates typelib()-style Provides/Requires. Source1: gi-find-deps.sh Source2: gobjectintrospection.attr +Source3: gobject-introspection-typelib.template BuildRequires: gcc BuildRequires: meson >= 0.60.0 @@ -29,24 +30,9 @@ BuildRequires: gtk-doc BuildRequires: /usr/bin/bison BuildRequires: /usr/bin/flex Requires: glib2%{?_isa} >= %{glib2_version} -Provides: typelib(DBus) = 1.0 -Provides: typelib(DBusGLib) = 1.0 -Provides: typelib(GIRepository) = 2.0 -Provides: typelib(GL) = 1.0 -Provides: typelib(GLib) = 2.0 -Provides: typelib(GModule) = 2.0 -Provides: typelib(GObject) = 2.0 -Provides: typelib(Gio) = 2.0 -Provides: typelib(Vulkan) = 1.0 -Provides: typelib(cairo) = 1.0 -Provides: typelib(fontconfig) = 2.0 -Provides: typelib(freetype2) = 2.0 -Provides: typelib(libxml2) = 2.0 -Provides: typelib(win32) = 1.0 -Provides: typelib(xfixes) = 4.0 -Provides: typelib(xft) = 2.0 -Provides: typelib(xlib) = 2.0 -Provides: typelib(xrandr) = 1.3 +# Provide typelib() symbols based on gobject-introspection-typelib.template +# The template is checked during install if it matches the installed *.typelib files. +%(cat %{S:3} | awk '{ print "Provides: " $0}') %description GObject Introspection can scan C header and source files in order to @@ -87,6 +73,10 @@ install -D %{S:2} -m 0644 %{buildroot}%{_fileattrsdir}/gobjectintrospection.attr %check %meson_test +# comparing, if we provide all the symbols expected. +ls %{buildroot}%{_libdir}/girepository-1.0/*.typelib | bash %{S:1} -P > gobject-introspection-typelib.installed +diff -s %{S:3} gobject-introspection-typelib.installed + %files %license COPYING COPYING.GPL COPYING.LGPL %{_libdir}/lib*.so.* @@ -113,6 +103,10 @@ install -D %{S:2} -m 0644 %{buildroot}%{_fileattrsdir}/gobjectintrospection.attr %{_mandir}/man1/*.1* %changelog +* Mon Oct 14 2024 Funda Wang - 1.76.1-3 +- check typelib provides against installed typelib libs +- promote python-gobject for downstream packages + * Mon Sep 23 2024 Funda Wang - 1.76.1-2 - Add gi-find-deps script from openSUSE to ease dependency solving -- Gitee