All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gobject-introspection: relocate typelib repository for native builds
@ 2018-06-08 16:18 Sascha Silbe
  2018-06-08 17:13 ` Alexander Kanavin
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Silbe @ 2018-06-08 16:18 UTC (permalink / raw)
  To: openembedded-core

gobject-introspection hard-codes the install path in the search path
for the typelib repository, pretty much the same way glib behaves for
the gio modules directory. Like for glib, this causes problems when
gobject-introspection-native is restored from sstate with a different
build directory.

Based on the glib fix by Ross Burton <ross.burton@intel.com>.

Signed-off-by: Sascha Silbe <x-yo17@se-silbe.de>
---
 ...he-repository-directory-for-native-builds.patch | 64 ++++++++++++++++++++++
 .../gobject-introspection_1.56.1.bb                |  2 +
 2 files changed, 66 insertions(+)

Tested using poky and cherry-picked into oe-core without further
testing.


diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch
new file mode 100644
index 0000000000..644cab929d
--- /dev/null
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch
@@ -0,0 +1,64 @@
+From 31ef4cce83c1770ea1e816d91b7e258fbf170035 Mon Sep 17 00:00:00 2001
+From: Sascha Silbe <x-yo17@se-silbe.de>
+Date: Fri, 8 Jun 2018 13:55:10 +0200
+Subject: [PATCH] Relocate the repository directory for native builds
+
+Instead of hard-coding GOBJECT_INTROSPECTION_LIBDIR when
+gobject-introspection is built, use dladdr() to determine where
+GOBJECT_INTROSPECTION_LIBDIR is and use that path to calculate the
+repository directory.
+
+This fixes gobject-introspection-native accessing paths across build
+directories (e.g. if the build directories use the same shared state
+cache or sstate mirror).
+
+Upstream-Status: Inappropriate
+Signed-off-by: Sascha Silbe <x-yo17@se-silbe.de>
+---
+ girepository/girepository.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/girepository/girepository.c b/girepository/girepository.c
+index 10282c72..60c45104 100644
+--- a/girepository/girepository.c
++++ b/girepository/girepository.c
+@@ -21,6 +21,8 @@
+  * Boston, MA 02111-1307, USA.
+  */
+ 
++#define _GNU_SOURCE
++
+ #include "config.h"
+ 
+ #include <stdio.h>
+@@ -34,6 +36,8 @@
+ #include "gitypelib-internal.h"
+ #include "girepository-private.h"
+ 
++#include <dlfcn.h>
++
+ /**
+  * SECTION:girepository
+  * @short_description: GObject Introspection repository manager
+@@ -191,9 +195,16 @@ init_globals (void)
+           g_free (custom_dirs);
+         }
+ 
+-      libdir = GOBJECT_INTROSPECTION_LIBDIR;
++      Dl_info gi_lib_info;
+ 
+-      typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
++      if (dladdr (g_irepository_get_default, &gi_lib_info)) {
++        char *libdir = g_path_get_dirname (gi_lib_info.dli_fname);
++        typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
++        g_free (libdir);
++      } else {
++        libdir = GOBJECT_INTROSPECTION_LIBDIR;
++        typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
++      }
+ 
+       search_path = g_slist_prepend (search_path, typelib_dir);
+ 
+-- 
+2.11.0
+
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb
index 8d05566949..ddec11067b 100644
--- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.56.1.bb
@@ -20,6 +20,8 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-$
 SRC_URI[md5sum] = "62e5f5685b8d9752fdeaf17c057d53d1"
 SRC_URI[sha256sum] = "5b2875ccff99ff7baab63a34b67f8c920def240e178ff50add809e267d9ea24b"
 
+SRC_URI_append_class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch "
+
 inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even
 BBCLASSEXTEND = "native"
 
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-08 16:18 [PATCH] gobject-introspection: relocate typelib repository for native builds Sascha Silbe
@ 2018-06-08 17:13 ` Alexander Kanavin
  2018-06-08 18:17   ` Sascha Silbe
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2018-06-08 17:13 UTC (permalink / raw)
  To: Sascha Silbe; +Cc: OE-core

2018-06-08 19:18 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
> gobject-introspection hard-codes the install path in the search path
> for the typelib repository, pretty much the same way glib behaves for
> the gio modules directory. Like for glib, this causes problems when
> gobject-introspection-native is restored from sstate with a different
> build directory.

Can you provide an example of how the problems can be reproduced
please? I think we disable building introspection data for -native,
and so where typelib dir is shouldn't matter?

Alex


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-08 17:13 ` Alexander Kanavin
@ 2018-06-08 18:17   ` Sascha Silbe
  2018-06-08 18:45     ` Alexander Kanavin
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Silbe @ 2018-06-08 18:17 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core


[-- Attachment #1.1: Type: text/plain, Size: 1634 bytes --]

Alexander Kanavin <alex.kanavin@gmail.com> writes:

> 2018-06-08 19:18 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
>> gobject-introspection hard-codes the install path in the search path
>> for the typelib repository, pretty much the same way glib behaves for
>> the gio modules directory. Like for glib, this causes problems when
>> gobject-introspection-native is restored from sstate with a different
>> build directory.
>
> Can you provide an example of how the problems can be reproduced
> please? I think we disable building introspection data for -native,
> and so where typelib dir is shouldn't matter?

I originally encountered this issue in a poky-based project of one of my
customers and used the recipe below to reproduce the issue in current
poky master.

To reproduce you can run:

mkdir -p poky-downloads
( source poky/oe-init-build-env poky-move-test-1 && ln -s ../poky-downloads downloads && bitbake python3-pygobject-test && bitbake -c cleansstate python3-pygobject-test ) && rm -rf poky-move-test-1/tmp && ( source poky/oe-init-build-env poky-move-test-2 && ln -s ../poky-downloads downloads && ln -s ../poky-move-test-1/sstate-cache . && bitbake python3-pygobject-test )

Sascha

SUMMARY = "Python GObject bindings test"
SECTION = "devel/python"
LICENSE = "CLOSED"

DEPENDS = "glib-2.0-native python3-native python3-pygobject-native"

inherit python3native

do_compile() {
    python3 -c 'from gi.repository import GLib'
}

BBCLASSEXTEND = "native"

-- 
Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
https://se-silbe.de/
USt-IdNr.: DE281696641

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-08 18:17   ` Sascha Silbe
@ 2018-06-08 18:45     ` Alexander Kanavin
  2018-06-08 19:27       ` Sascha Silbe
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2018-06-08 18:45 UTC (permalink / raw)
  To: Sascha Silbe; +Cc: OE-core

2018-06-08 21:17 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
>     python3 -c 'from gi.repository import GLib'

May I ask, what is the use case for running this in the native
context? Note that we explicitly disable generating introspection data
on the native side (though the g-i class), and so you'll get the
typelibs for the base glib that is bundled with g-i tarball, but not
anything else.

Alex


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-08 18:45     ` Alexander Kanavin
@ 2018-06-08 19:27       ` Sascha Silbe
  2018-06-09 10:11         ` Alexander Kanavin
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Silbe @ 2018-06-08 19:27 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

Alexander Kanavin <alex.kanavin@gmail.com> writes:

> 2018-06-08 21:17 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
>>     python3 -c 'from gi.repository import GLib'
>
> May I ask, what is the use case for running this in the native
> context? Note that we explicitly disable generating introspection data
> on the native side (though the g-i class), and so you'll get the
> typelibs for the base glib that is bundled with g-i tarball, but not
> anything else.

We have some Python modules that we are extracting some information from
and generating documentation for at build time; both times the modules
get imported. We don't need GLib to actually work; it only needs to be
importable. Fortunately no other typelib is used by the code.

Sascha
-- 
Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
https://se-silbe.de/
USt-IdNr.: DE281696641

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-08 19:27       ` Sascha Silbe
@ 2018-06-09 10:11         ` Alexander Kanavin
  2018-06-14 16:13           ` Sascha Silbe
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2018-06-09 10:11 UTC (permalink / raw)
  To: Sascha Silbe; +Cc: OE-core

2018-06-08 22:27 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
> We have some Python modules that we are extracting some information from
> and generating documentation for at build time; both times the modules
> get imported. We don't need GLib to actually work; it only needs to be
> importable. Fortunately no other typelib is used by the code.

Thanks for explanation. The patch is fine then and can be added to
oe-core - so that if later g-i needs to be fully supported on the
native side, this part would be already sorted. For now though it's
not 'officially' working.

Alex


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-09 10:11         ` Alexander Kanavin
@ 2018-06-14 16:13           ` Sascha Silbe
  2018-06-14 18:58             ` Alexander Kanavin
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Silbe @ 2018-06-14 16:13 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

Alexander Kanavin <alex.kanavin@gmail.com> writes:

> 2018-06-08 22:27 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
>> We have some Python modules that we are extracting some information from
>> and generating documentation for at build time; both times the modules
>> get imported. We don't need GLib to actually work; it only needs to be
>> importable. Fortunately no other typelib is used by the code.
>
> Thanks for explanation. The patch is fine then and can be added to
> oe-core - so that if later g-i needs to be fully supported on the
> native side, this part would be already sorted. For now though it's
> not 'officially' working.

Fair enough. Thanks for the review! Is there anything else I should do
for the patch to go in?

Sascha
-- 
Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
https://se-silbe.de/
USt-IdNr.: DE281696641

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-14 16:13           ` Sascha Silbe
@ 2018-06-14 18:58             ` Alexander Kanavin
  2018-06-14 19:51               ` Sascha Silbe
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2018-06-14 18:58 UTC (permalink / raw)
  To: Sascha Silbe; +Cc: OE-core

No, I don't think so. You just need to be patient; patch testing and
merging are done by one overloaded person. If after 2-3 weeks it's not
in, resend.

Alex

2018-06-14 19:13 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
> Alexander Kanavin <alex.kanavin@gmail.com> writes:
>
>> 2018-06-08 22:27 GMT+03:00 Sascha Silbe <x-yo17@se-silbe.de>:
>>> We have some Python modules that we are extracting some information from
>>> and generating documentation for at build time; both times the modules
>>> get imported. We don't need GLib to actually work; it only needs to be
>>> importable. Fortunately no other typelib is used by the code.
>>
>> Thanks for explanation. The patch is fine then and can be added to
>> oe-core - so that if later g-i needs to be fully supported on the
>> native side, this part would be already sorted. For now though it's
>> not 'officially' working.
>
> Fair enough. Thanks for the review! Is there anything else I should do
> for the patch to go in?
>
> Sascha
> --
> Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
> https://se-silbe.de/
> USt-IdNr.: DE281696641


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gobject-introspection: relocate typelib repository for native builds
  2018-06-14 18:58             ` Alexander Kanavin
@ 2018-06-14 19:51               ` Sascha Silbe
  0 siblings, 0 replies; 9+ messages in thread
From: Sascha Silbe @ 2018-06-14 19:51 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

Alexander Kanavin <alex.kanavin@gmail.com> writes:

> No, I don't think so. You just need to be patient; patch testing and
> merging are done by one overloaded person. If after 2-3 weeks it's not
> in, resend.

OK, no problem.

Sascha
-- 
Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
https://se-silbe.de/
USt-IdNr.: DE281696641

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-06-14 19:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 16:18 [PATCH] gobject-introspection: relocate typelib repository for native builds Sascha Silbe
2018-06-08 17:13 ` Alexander Kanavin
2018-06-08 18:17   ` Sascha Silbe
2018-06-08 18:45     ` Alexander Kanavin
2018-06-08 19:27       ` Sascha Silbe
2018-06-09 10:11         ` Alexander Kanavin
2018-06-14 16:13           ` Sascha Silbe
2018-06-14 18:58             ` Alexander Kanavin
2018-06-14 19:51               ` Sascha Silbe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.