commit:     ca7bdcb2d766e34e77adf3e2bc0923314bdca7bd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May 11 23:50:27 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 11 23:55:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca7bdcb2

dev-libs/glib: workaround Portage bug with binpkgs

With binpkgs, we seem to sometimes get a new dev-libs/gobject-introspection-1.82
installed which needs >=dev-libs/glib-2.82, but without the new glib. We
then try to build glib, we see that we have a gobject-introspection installed
that is new enough via `has_version` (=> we don't try to bootstrap it), then
when trying to use it via `pkg-config`, it falls off because we don't have
the glib that it needs.

This is obviously a Portage bug in not ensuring that gobject-introspection's
dependencies are satisifed before merging its binpkg, but let's workaround
it here: check thoroughly if the available gobject-introspection is usable. If
it ain't, just bootstrap as if it weren't installed.

(Just closing the bug given we don't have a testcase, not much point
in keeping it open and potentially confusing people. It only happens
sometimes and requires some bad luck, unfortunately. If it were always
the case w/ binpkgs, it'd be far easier to debug.)

Closes: https://bugs.gentoo.org/951487
Thanks-to: Artemis Everfree <artemis <AT> artemis.sh>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/glib/glib-2.80.5-r1.ebuild | 12 ++++++++++++
 dev-libs/glib/glib-2.82.5.ebuild    | 12 ++++++++++++
 dev-libs/glib/glib-2.84.0.ebuild    | 12 ++++++++++++
 dev-libs/glib/glib-2.84.1.ebuild    | 12 ++++++++++++
 4 files changed, 48 insertions(+)

diff --git a/dev-libs/glib/glib-2.80.5-r1.ebuild 
b/dev-libs/glib/glib-2.80.5-r1.ebuild
index 29b3166bf27a..a9a914f46ba8 100644
--- a/dev-libs/glib/glib-2.80.5-r1.ebuild
+++ b/dev-libs/glib/glib-2.80.5-r1.ebuild
@@ -242,6 +242,18 @@ multilib_src_configure() {
                        return 0
                fi
 
+               # Do we somehow have a dev-libs/gobject-introspection installed
+               # with an unsatisfied dependency? (bug #951487)
+               if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> 
/dev/null ; then
+                       return 0
+               fi
+
+               # Make sure has_version didn't lie to us while at it as well,
+               # given bug #951487.
+               if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION__PV} 
gobject-introspection-1.0 &> /dev/null ; then
+                       return 0
+               fi
+
                return 1
        }
 

diff --git a/dev-libs/glib/glib-2.82.5.ebuild b/dev-libs/glib/glib-2.82.5.ebuild
index 25e56d954a0a..e27052e7d170 100644
--- a/dev-libs/glib/glib-2.82.5.ebuild
+++ b/dev-libs/glib/glib-2.82.5.ebuild
@@ -230,6 +230,18 @@ multilib_src_configure() {
                        return 0
                fi
 
+               # Do we somehow have a dev-libs/gobject-introspection installed
+               # with an unsatisfied dependency? (bug #951487)
+               if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> 
/dev/null ; then
+                       return 0
+               fi
+
+               # Make sure has_version didn't lie to us while at it as well,
+               # given bug #951487.
+               if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION__PV} 
gobject-introspection-1.0 &> /dev/null ; then
+                       return 0
+               fi
+
                return 1
        }
 

diff --git a/dev-libs/glib/glib-2.84.0.ebuild b/dev-libs/glib/glib-2.84.0.ebuild
index 0324bbf012be..940fdfbdeabe 100644
--- a/dev-libs/glib/glib-2.84.0.ebuild
+++ b/dev-libs/glib/glib-2.84.0.ebuild
@@ -234,6 +234,18 @@ multilib_src_configure() {
                        return 0
                fi
 
+               # Do we somehow have a dev-libs/gobject-introspection installed
+               # with an unsatisfied dependency? (bug #951487)
+               if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> 
/dev/null ; then
+                       return 0
+               fi
+
+               # Make sure has_version didn't lie to us while at it as well,
+               # given bug #951487.
+               if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION__PV} 
gobject-introspection-1.0 &> /dev/null ; then
+                       return 0
+               fi
+
                return 1
        }
 

diff --git a/dev-libs/glib/glib-2.84.1.ebuild b/dev-libs/glib/glib-2.84.1.ebuild
index 5584e992e941..dd8cd776ccfb 100644
--- a/dev-libs/glib/glib-2.84.1.ebuild
+++ b/dev-libs/glib/glib-2.84.1.ebuild
@@ -235,6 +235,18 @@ multilib_src_configure() {
                        return 0
                fi
 
+               # Do we somehow have a dev-libs/gobject-introspection installed
+               # with an unsatisfied dependency? (bug #951487)
+               if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> 
/dev/null ; then
+                       return 0
+               fi
+
+               # Make sure has_version didn't lie to us while at it as well,
+               # given bug #951487.
+               if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION__PV} 
gobject-introspection-1.0 &> /dev/null ; then
+                       return 0
+               fi
+
                return 1
        }
 

Reply via email to