diff mbox series

gobject-introspection: split tools and giscanner into a separate package

Message ID 20240624203215.2470081-1-gudni.m.g@gmail.com
State New
Headers show
Series gobject-introspection: split tools and giscanner into a separate package | expand

Commit Message

Guðni Már Gilbert June 24, 2024, 8:32 p.m. UTC
The tools and giscanner require python3-setuptools at runtime. This increases
the image size quite a bit (on my end ~1.7MB compressed). Most users don't need
these tools in the final image so make them optional.

This commit introduces a new packcage gobject-introspection-tools

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
---
 .../gobject-introspection_1.80.1.bb           | 21 +++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Comments

Guðni Már Gilbert June 24, 2024, 8:38 p.m. UTC | #1
Idea for this patch came from this thread: https://lists.openembedded.org/g/openembedded-core/topic/patch_python3_setuptools/106764629

( https://lists.openembedded.org/g/openembedded-core/topic/patch_python3_setuptools/106764629 ) I haven't done any runtime tests yet. But this is the idea I have so far and it builds without issues. My compressed image shrinks by ~1.7MB which is nice if this indeed works.

Any thoughts/feedback on this approach? Am I missing something? I felt that giscanner python module should be included in tools since it requires distutils.
Alexander Kanavin June 25, 2024, 9:02 a.m. UTC | #2
On Mon, 24 Jun 2024 at 22:32, Guðni Már Gilbert via
lists.openembedded.org <gudni.m.g=gmail.com@lists.openembedded.org>
wrote:
> +FILES:${PN}-tools = "\
> +        ${bindir}/g-ir-annotation-tool \
> +        ${bindir}/g-ir-compiler \
> +        ${bindir}/g-ir-generate \
> +        ${bindir}/g-ir-generate \
> +        ${bindir}/g-ir-inspect \
> +        ${bindir}/g-ir-scanner \

Simply ${bindir} is enough, no need to list the tools separately (also
that is prone to becoming mismatched on version updates when upstream
changes the set).

> +RDEPENDS:${PN} = "python3-pickle python3-xml glib-2.0"

I guess pickle and xml modules, and glib are needed only by the tools
as well, so they should be moving to RDEPENDS:${PN}-tools too?

Alex
Guðni Már Gilbert June 25, 2024, 10:38 a.m. UTC | #3
Thank you for the review Alex, I'll prepare a v2 patch.
Alexandre Belloni June 25, 2024, 1:24 p.m. UTC | #4
This fails with:

ERROR: gobject-introspection-1.80.1-r0 do_package_qa: QA Issue: /usr/lib/gobject-introspection/giscanner/_giscanner.cpython-312-x86_64-linux-gnux32.so contained in package gobject-introspection-tools requires libglib-2.0.so.0, but no providers found in RDEPENDS:gobject-introspection-tools? [file-rdeps]
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: QA Issue: /usr/lib/gobject-introspection/giscanner/_giscanner.cpython-312-x86_64-linux-gnux32.so contained in package gobject-introspection-tools requires libgobject-2.0.so.0, but no providers found in RDEPENDS:gobject-introspection-tools? [file-rdeps]
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: QA Issue: /usr/lib/gobject-introspection/giscanner/_giscanner.cpython-312-x86_64-linux-gnux32.so contained in package gobject-introspection-tools requires libgio-2.0.so.0, but no providers found in RDEPENDS:gobject-introspection-tools? [file-rdeps]
NOTE: recipe xinput-1.6.4-r0: task do_create_runtime_spdx: Succeeded
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: Fatal QA errors were found, failing task.

https://autobuilder.yoctoproject.org/typhoon/#/builders/57/builds/8998/steps/11/logs/stdio

On 24/06/2024 20:32:15+0000, Gu�ni M�r Gilbert wrote:
> The tools and giscanner require python3-setuptools at runtime. This increases
> the image size quite a bit (on my end ~1.7MB compressed). Most users don't need
> these tools in the final image so make them optional.
> 
> This commit introduces a new packcage gobject-introspection-tools
> 
> Signed-off-by: Gu�ni M�r Gilbert <gudni.m.g@gmail.com>
> ---
>  .../gobject-introspection_1.80.1.bb           | 21 +++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb
> index 582ac248fd..9c1945d639 100644
> --- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb
> +++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb
> @@ -26,7 +26,8 @@ GTKDOC_MESON_OPTION = "gtk_doc"
>  
>  MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner"
>  
> -DEPENDS += " libffi zlib python3 flex-native bison-native"
> +# setuptools are required to provide distutils to build the tools
> +DEPENDS += " libffi zlib python3 python3-setuptools flex-native bison-native"
>  DEPENDS:append:class-native = " glib-2.0"
>  DEPENDS:append:class-target = " glib-2.0-initial"
>  
> @@ -169,6 +170,20 @@ gi_package_preprocess() {
>  
>  SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir postinst-ldsoconf-${PN}"
>  
> +PACKAGES =+ "\
> +        ${PN}-tools \
> +"
> +
> +FILES:${PN}-tools = "\
> +        ${bindir}/g-ir-annotation-tool \
> +        ${bindir}/g-ir-compiler \
> +        ${bindir}/g-ir-generate \
> +        ${bindir}/g-ir-generate \
> +        ${bindir}/g-ir-inspect \
> +        ${bindir}/g-ir-scanner \
> +        ${libdir}/gobject-introspection/giscanner \
> +"
> +
>  # .typelib files are needed at runtime and so they go to the main package
>  FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib"
>  
> @@ -190,7 +205,9 @@ FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
>  FILES:${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
>  FILES:${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
>  
> +RDEPENDS:${PN} = "python3-pickle python3-xml glib-2.0"
> +
>  # setuptools can be removed when upstream removes all uses of distutils
> -RDEPENDS:${PN} = "python3-pickle python3-xml python3-setuptools glib-2.0"
> +RDEPENDS:${PN}-tools = "${PN} python3-setuptools"
>  
>  BBCLASSEXTEND = "native"
> -- 
> 2.34.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#201113): https://lists.openembedded.org/g/openembedded-core/message/201113
> Mute This Topic: https://lists.openembedded.org/mt/106857943/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Guðni Már Gilbert June 25, 2024, 6:29 p.m. UTC | #5
Hi Alexandre, I have managed to reproduce the issue on the master branch and found a solution. It was a simple mistake on my part. glib-2.0 needs to be added to RDEPENDS:${PN}-tools

I erroniously assumed that given:
RDEPENDS:${PN} = "python3-pickle python3-xml glib-2.0"
RDEPENDS:${PN}-tools = "${PN} python3-setuptools"

Would result in

RDEPENDS:gobject-introspection-tools = "python3-pickle python3-xml glib-2.0 python3-setuptools"

But nope, it's RDEPENDS:gobject-introspection-tools = "gobject-introspection python3-setuptools" which is obvious now that I realised it :)

I will add a fix for this in my v2 patch.
Guðni Már Gilbert June 25, 2024, 6:41 p.m. UTC | #6
On Tue, Jun 25, 2024 at 09:02 AM, Alexander Kanavin wrote:

> 
> 
>> +RDEPENDS:${PN} = "python3-pickle python3-xml glib-2.0"
> 
> I guess pickle and xml modules, and glib are needed only by the tools
> as well, so they should be moving to RDEPENDS:${PN}-tools too?

Hi Alex, after fixing the issue mentioned by Alexandre above, it looks like we must keep glib-2.0 in RDEPENDS:${PN}.

Otherwise I get this error:
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: QA Issue: /usr/lib/libgirepository-1.0.so.1.0.0 contained in package gobject-introspection requires libglib-2.0.so.0()(64bit), but no providers found in RDEPENDS:gobject-introspection? [file-rdeps]
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: QA Issue: /usr/lib/libgirepository-1.0.so.1.0.0 contained in package gobject-introspection requires libgobject-2.0.so.0()(64bit), but no providers found in RDEPENDS:gobject-introspection? [file-rdeps]
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: QA Issue: /usr/lib/libgirepository-1.0.so.1.0.0 contained in package gobject-introspection requires libgmodule-2.0.so.0()(64bit), but no providers found in RDEPENDS:gobject-introspection? [file-rdeps]
ERROR: gobject-introspection-1.80.1-r0 do_package_qa: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in: /home/builder/yocto/build/tmp-glibc/work/core2-64-oe-linux/gobject-introspection/1.80.1/temp/log.do_package_qa.1375416
ERROR: Task (/home/builder/yocto/layers/openembedded-core/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb:do_package_qa) failed with exit code '1'

----

Moving python3-pickle and python3-xml to RDEPENDS:${PN}-tools seems to be OK.
diff mbox series

Patch

diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb
index 582ac248fd..9c1945d639 100644
--- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.80.1.bb
@@ -26,7 +26,8 @@  GTKDOC_MESON_OPTION = "gtk_doc"
 
 MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner"
 
-DEPENDS += " libffi zlib python3 flex-native bison-native"
+# setuptools are required to provide distutils to build the tools
+DEPENDS += " libffi zlib python3 python3-setuptools flex-native bison-native"
 DEPENDS:append:class-native = " glib-2.0"
 DEPENDS:append:class-target = " glib-2.0-initial"
 
@@ -169,6 +170,20 @@  gi_package_preprocess() {
 
 SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir postinst-ldsoconf-${PN}"
 
+PACKAGES =+ "\
+        ${PN}-tools \
+"
+
+FILES:${PN}-tools = "\
+        ${bindir}/g-ir-annotation-tool \
+        ${bindir}/g-ir-compiler \
+        ${bindir}/g-ir-generate \
+        ${bindir}/g-ir-generate \
+        ${bindir}/g-ir-inspect \
+        ${bindir}/g-ir-scanner \
+        ${libdir}/gobject-introspection/giscanner \
+"
+
 # .typelib files are needed at runtime and so they go to the main package
 FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib"
 
@@ -190,7 +205,9 @@  FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
 FILES:${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
 FILES:${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
 
+RDEPENDS:${PN} = "python3-pickle python3-xml glib-2.0"
+
 # setuptools can be removed when upstream removes all uses of distutils
-RDEPENDS:${PN} = "python3-pickle python3-xml python3-setuptools glib-2.0"
+RDEPENDS:${PN}-tools = "${PN} python3-setuptools"
 
 BBCLASSEXTEND = "native"