diff options
Diffstat (limited to 'dev-libs/glib')
-rw-r--r-- | dev-libs/glib/Manifest | 6 | ||||
-rw-r--r-- | dev-libs/glib/files/2.58.3-CVE-2019-12450.patch | 53 | ||||
-rw-r--r-- | dev-libs/glib/files/2.58.3-gdbusmessage-limit-fix.patch | 120 | ||||
-rw-r--r-- | dev-libs/glib/glib-2.58.3-r1.ebuild (renamed from dev-libs/glib/glib-2.58.3.ebuild) | 5 | ||||
-rw-r--r-- | dev-libs/glib/glib-2.60.6.ebuild | 276 |
5 files changed, 459 insertions, 1 deletions
diff --git a/dev-libs/glib/Manifest b/dev-libs/glib/Manifest index 47795c9403b1..b2f4a9e64b2c 100644 --- a/dev-libs/glib/Manifest +++ b/dev-libs/glib/Manifest @@ -1,5 +1,9 @@ +AUX 2.58.3-CVE-2019-12450.patch 2807 BLAKE2B 68835ace4cd450bebc79d03059a03af313044a3f0d27bc4c33124c98dcbb3e20db525b2cbf7ec31627ce79754c3dfb86de7e97a7cbaab4709608a7ddb2015fc1 SHA512 ee6a1ee0ba89817be4e77cbfbfe8f25ad056d2a89f16aaf721b88e616e46374ac1e8488f1c4fc1fb689c260a3d0f9a54c7eddd826a77816830dc656d5698cd28 +AUX 2.58.3-gdbusmessage-limit-fix.patch 4343 BLAKE2B 07841524575efd1124d2f0956f27b27b016987786f388b9b76d6afc8e9f4eea2814b2d7d08ffb5721ae2d957a533066c407339baeb6f55d37d1f6d730e6ebf25 SHA512 c76a9b5ebbac0b596090fa4f5032ce62b3f985e9a5bd383a759f9014da8c33e27e0ea1a75d7796748a0f0ee751545a12c346d555e3ddafa82822cd9d5ab49e1b AUX glib-2.58.2-external-gdbus-codegen.patch 5452 BLAKE2B caf66af10958c1e6672a615965ec45f76d4fe9f58599f3d09ecee543e1b5e47a49014f7ef7a6f4e0030370935c4f82ab11b3a81ca42fc09153f02e355400dd55 SHA512 d36ac5d4fa810524795d099c218604b0db22dbc7fe9ba57821fdad292725d9c159b24cc224d1bd68824dc24ddb1f1e7c6878dbc36a3b0a8188f9e01a4b6c5ea0 DIST glib-2.58.3.tar.xz 4863648 BLAKE2B 4269bd6e80869f39d567917438f750561debb1b45d40ecea487d2e76e2468e07dc8d80a23678699f7b8f7778c2ed9d29e866ae5e33770f51ed00709dd5fe97eb SHA512 1e1cb5b607367dcbadb95563d463e81702cf396b28f1173f6d933707f4f3d5595a70225423e918807a05994a24f16fa3ac87d2ec67e4b670244ea99836634cce +DIST glib-2.60.6.tar.xz 4589516 BLAKE2B 33546aea288dee4aa8c04bda610a65ce75705c0e2b98284e787d42576c61eccbd33788084b092e030fe26c50ff08e398782227d1f2ac39ef9754b91af1ab1aa1 SHA512 2e079d2268e0cd4dd234501c03e7784a69258ea2303e62baa4869ff7a442d121c2ffdc742467e3b0b46ad953b831962e1dd847463d66b2b28745ba0f0bfd28d9 DIST pkg-config-0.28.tar.gz 1931203 BLAKE2B bafdd4e838623965c6bd454421ddd9051fc43fc29948e1615b49fef463c3c3a18807aabe6416f96cfdf58d6b1c9e114d77f97bd985facee7c14284a8a64a768b SHA512 6eafa5ca77c5d44cd15f48457a5e96fcea2555b66d8e35ada5ab59864a0aa03d441e15f54ab9c6343693867b3b490f392c75b7d9312f024c9b7ec6a0194d8320 -EBUILD glib-2.58.3.ebuild 10681 BLAKE2B ea7385a9f381d9b102e7dae86d4de4d9fca14de5165ca4db712d38da71fb589de6fed92541e754374f1630d303229d64e8047e6e97147b35431d4ed4da961a11 SHA512 39a83019b721c1386e40dc08836125a880faf741f4066d7b77246a30f358f71277fe45bc0f71bdd9b8aa802c2f738e93697c16d17a1304ce2700374134f214a9 +EBUILD glib-2.58.3-r1.ebuild 10907 BLAKE2B c600133aa1db3ec6d7171d83c59fdb6da341d2c074847770b88828c34e0616819882ff3604d79291e621b18724b8ae2e57fd5cf1fd9250ac31622d2de2157887 SHA512 011fdbe52c49f32682f5735ba4332e25e87b5ed8efe3da9c5fd543c282ea7932deb11d05cb93b6ab92460f0d545e0c7cb3798c4c3f736b58e9b5ca3ee388e1eb +EBUILD glib-2.60.6.ebuild 10141 BLAKE2B abe763f0a4fa391af9471f3d7c2063014c7a4fa10479892fd6c3aae5a4b7f5ce82b67e86bd239ed059cd9c971e7820abb31eda89eb6772cc2431c7363a10bd0f SHA512 4e7fa4071683e1fe082ba100e84aaed82d18730e463ce74d65e05d38ff8b5495239ec479a5af1ba5372f6c9138a53de195be875fb9b2378743ce8be880dd1d29 MISC metadata.xml 978 BLAKE2B 75f0c12ff1628b7c345b1e85c6baa041973f11555aa520348ca6f347d2241ee0fc9bc26891b25bd34ae512dbaf761b5382d93f094dc0c4ff9a76c3ec852c9583 SHA512 8087f80cbbffb14930b50178559cc4dbde999d4e123475beb04e2d0a25e64b24ee5ab8523f1df1839e82f74272b40cd9a57b78acf34fd64f8b4723bed26573c8 diff --git a/dev-libs/glib/files/2.58.3-CVE-2019-12450.patch b/dev-libs/glib/files/2.58.3-CVE-2019-12450.patch new file mode 100644 index 000000000000..949ac56431f1 --- /dev/null +++ b/dev-libs/glib/files/2.58.3-CVE-2019-12450.patch @@ -0,0 +1,53 @@ +From e6b769819d63d2b24b251dbc9f902fe6fd614da3 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy <oholy@redhat.com> +Date: Thu, 23 May 2019 10:41:53 +0200 +Subject: [PATCH] gfile: Limit access to files when copying + +file_copy_fallback creates new files with default permissions and +set the correct permissions after the operation is finished. This +might cause that the files can be accessible by more users during +the operation than expected. Use G_FILE_CREATE_PRIVATE for the new +files to limit access to those files. +--- + gio/gfile.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/gio/gfile.c b/gio/gfile.c +index 1cc69166a..13b435480 100644 +--- a/gio/gfile.c ++++ b/gio/gfile.c +@@ -3284,12 +3284,12 @@ file_copy_fallback (GFile *source, + out = (GOutputStream*)_g_local_file_output_stream_replace (_g_local_file_get_filename (G_LOCAL_FILE (destination)), + FALSE, NULL, + flags & G_FILE_COPY_BACKUP, +- G_FILE_CREATE_REPLACE_DESTINATION, +- info, ++ G_FILE_CREATE_REPLACE_DESTINATION | ++ G_FILE_CREATE_PRIVATE, info, + cancellable, error); + else + out = (GOutputStream*)_g_local_file_output_stream_create (_g_local_file_get_filename (G_LOCAL_FILE (destination)), +- FALSE, 0, info, ++ FALSE, G_FILE_CREATE_PRIVATE, info, + cancellable, error); + } + else if (flags & G_FILE_COPY_OVERWRITE) +@@ -3297,12 +3297,13 @@ file_copy_fallback (GFile *source, + out = (GOutputStream *)g_file_replace (destination, + NULL, + flags & G_FILE_COPY_BACKUP, +- G_FILE_CREATE_REPLACE_DESTINATION, ++ G_FILE_CREATE_REPLACE_DESTINATION | ++ G_FILE_CREATE_PRIVATE, + cancellable, error); + } + else + { +- out = (GOutputStream *)g_file_create (destination, 0, cancellable, error); ++ out = (GOutputStream *)g_file_create (destination, G_FILE_CREATE_PRIVATE, cancellable, error); + } + + if (!out) +-- +2.20.1 + diff --git a/dev-libs/glib/files/2.58.3-gdbusmessage-limit-fix.patch b/dev-libs/glib/files/2.58.3-gdbusmessage-limit-fix.patch new file mode 100644 index 000000000000..0828132003d3 --- /dev/null +++ b/dev-libs/glib/files/2.58.3-gdbusmessage-limit-fix.patch @@ -0,0 +1,120 @@ +From 2d655ef8954695cabf9e99cc61411de2bb4cb847 Mon Sep 17 00:00:00 2001 +From: Philip Withnall <withnall@endlessm.com> +Date: Mon, 28 Jan 2019 14:36:42 +0000 +Subject: [PATCH] gdbusmessage: Fix check on upper limit of message size + +There was a typo in the figure checked against. Add a unit test. + +Signed-off-by: Philip Withnall <withnall@endlessm.com> + +https://gitlab.gnome.org/GNOME/glib/issues/1642 +--- + gio/gdbusmessage.c | 2 +- + gio/tests/gdbus-message.c | 72 ++++++++++++++++++++++++++++++++++++++- + 2 files changed, 72 insertions(+), 2 deletions(-) + +diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c +index 169e6fd15..2ad51f888 100644 +--- a/gio/gdbusmessage.c ++++ b/gio/gdbusmessage.c +@@ -1984,7 +1984,7 @@ g_dbus_message_bytes_needed (guchar *blob, + "Unable to determine message blob length - given blob is malformed"); + } + +- if (ret > (2<<27)) ++ if (ret > (1<<27)) + { + g_set_error (error, + G_IO_ERROR, +diff --git a/gio/tests/gdbus-message.c b/gio/tests/gdbus-message.c +index 88a9c5d86..74e0f712e 100644 +--- a/gio/tests/gdbus-message.c ++++ b/gio/tests/gdbus-message.c +@@ -141,6 +141,74 @@ message_copy (void) + + /* ---------------------------------------------------------------------------------------------------- */ + ++/* Test g_dbus_message_bytes_needed() returns correct results for a variety of ++ * arbitrary binary inputs.*/ ++static void ++message_bytes_needed (void) ++{ ++ const struct ++ { ++ const guint8 blob[16]; ++ gssize expected_bytes_needed; ++ } ++ vectors[] = ++ { ++ /* Little endian with header rounding */ ++ { { 'l', 0, 0, 1, /* endianness, message type, flags, protocol version */ ++ 50, 0, 0, 0, /* body length */ ++ 1, 0, 0, 0, /* message serial */ ++ 7, 0, 0, 0 /* header length */}, 74 }, ++ /* Little endian without header rounding */ ++ { { 'l', 0, 0, 1, /* endianness, message type, flags, protocol version */ ++ 50, 0, 0, 0, /* body length */ ++ 1, 0, 0, 0, /* message serial */ ++ 8, 0, 0, 0 /* header length */}, 74 }, ++ /* Big endian with header rounding */ ++ { { 'B', 0, 0, 1, /* endianness, message type, flags, protocol version */ ++ 0, 0, 0, 50, /* body length */ ++ 0, 0, 0, 1, /* message serial */ ++ 0, 0, 0, 7 /* header length */}, 74 }, ++ /* Big endian without header rounding */ ++ { { 'B', 0, 0, 1, /* endianness, message type, flags, protocol version */ ++ 0, 0, 0, 50, /* body length */ ++ 0, 0, 0, 1, /* message serial */ ++ 0, 0, 0, 8 /* header length */}, 74 }, ++ /* Invalid endianness */ ++ { { '!', 0, 0, 1, /* endianness, message type, flags, protocol version */ ++ 0, 0, 0, 50, /* body length */ ++ 0, 0, 0, 1, /* message serial */ ++ 0, 0, 0, 8 /* header length */}, -1 }, ++ /* Oversized */ ++ { { 'l', 0, 0, 1, /* endianness, message type, flags, protocol version */ ++ 0, 0, 0, 0x08, /* body length (128MiB) */ ++ 1, 0, 0, 0, /* message serial */ ++ 7, 0, 0, 0 /* header length */}, -1 }, ++ }; ++ gsize i; ++ ++ for (i = 0; i < G_N_ELEMENTS (vectors); i++) ++ { ++ gssize bytes_needed; ++ GError *local_error = NULL; ++ ++ g_test_message ("Vector: %" G_GSIZE_FORMAT, i); ++ ++ bytes_needed = g_dbus_message_bytes_needed ((guchar *) vectors[i].blob, ++ G_N_ELEMENTS (vectors[i].blob), ++ &local_error); ++ ++ if (vectors[i].expected_bytes_needed < 0) ++ g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT); ++ else ++ g_assert_no_error (local_error); ++ g_assert_cmpint (bytes_needed, ==, vectors[i].expected_bytes_needed); ++ ++ g_clear_error (&local_error); ++ } ++} ++ ++/* ---------------------------------------------------------------------------------------------------- */ ++ + int + main (int argc, + char *argv[]) +@@ -151,6 +219,8 @@ main (int argc, + + g_test_add_func ("/gdbus/message/lock", message_lock); + g_test_add_func ("/gdbus/message/copy", message_copy); +- return g_test_run(); ++ g_test_add_func ("/gdbus/message/bytes-needed", message_bytes_needed); ++ ++ return g_test_run (); + } + +-- +2.20.1 + diff --git a/dev-libs/glib/glib-2.58.3.ebuild b/dev-libs/glib/glib-2.58.3-r1.ebuild index c06063efcc31..1008e0119875 100644 --- a/dev-libs/glib/glib-2.58.3.ebuild +++ b/dev-libs/glib/glib-2.58.3-r1.ebuild @@ -124,6 +124,11 @@ src_prepare() { # gdbus-codegen is a separate package eapply "${FILESDIR}"/${PN}-2.58.2-external-gdbus-codegen.patch + # gdbus message upper limit check fix from glib-2-58 + eapply "${FILESDIR}"/${PV}-gdbusmessage-limit-fix.patch + # gfile copy fallback security fix (wrong permissions at start) + eapply "${FILESDIR}"/${PV}-CVE-2019-12450.patch + # Tarball doesn't come with gtk-doc.make and we can't unconditionally depend on dev-util/gtk-doc due # to circular deps during bootstramp. If actually not building gtk-doc, an almost empty file will do # fine as well - this is also what upstream autogen.sh does if gtkdocize is not found. If gtk-doc is diff --git a/dev-libs/glib/glib-2.60.6.ebuild b/dev-libs/glib/glib-2.60.6.ebuild new file mode 100644 index 000000000000..9baebc14a8f0 --- /dev/null +++ b/dev-libs/glib/glib-2.60.6.ebuild @@ -0,0 +1,276 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python{3_5,3_6,3_7} ) + +inherit flag-o-matic gnome.org gnome2-utils linux-info meson multilib multilib-minimal python-any-r1 toolchain-funcs xdg + +DESCRIPTION="The GLib library of C routines" +HOMEPAGE="https://www.gtk.org/" + +LICENSE="LGPL-2.1+" +SLOT="2" +IUSE="dbus debug elibc_glibc fam gtk-doc kernel_linux +mime selinux static-libs systemtap test utils xattr" + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" + +# * libelf isn't strictly necessary, but makes gresource tool more useful, and +# the check is automagic in gio/meson.build. gresource is not a multilib tool +# right now, thus it doesn't matter if non-native ABI libelf exists or not +# (non-native binary is overwritten, it doesn't matter if libelf was linked to). +# * Technically static-libs is needed on zlib, util-linux and perhaps more, but +# these are used by GIO, which glib[static-libs] consumers don't really seem +# to need at all, thus not imposing the deps for now and once some consumers +# are actually found to static link libgio-2.0.a, we can revisit and either add +# them or just put the (build) deps in that rare consumer instead of recursive +# RDEPEND here (due to lack of recursive DEPEND). +RDEPEND=" + !<dev-util/gdbus-codegen-${PV} + >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] + >=dev-libs/libpcre-8.31:3[${MULTILIB_USEDEP},static-libs?] + >=virtual/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}] + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] + >=virtual/libintl-0-r2[${MULTILIB_USEDEP}] + kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] ) + selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] ) + xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) ) + virtual/libelf:0= + fam? ( >=virtual/fam-0-r1[${MULTILIB_USEDEP}] ) +" +DEPEND="${RDEPEND}" +# libxml2 used for optional tests that get automatically skipped +BDEPEND=" + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + >=sys-devel/gettext-0.19.8 + gtk-doc? ( >=dev-util/gtk-doc-1.20 + app-text/docbook-xml-dtd:4.2 + app-text/docbook-xml-dtd:4.5 ) + systemtap? ( >=dev-util/systemtap-1.3 ) + ${PYTHON_DEPS} + test? ( >=sys-apps/dbus-1.2.14 ) + virtual/pkgconfig[${MULTILIB_USEDEP}] +" +# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen + +PDEPEND=" + dbus? ( gnome-base/dconf ) + mime? ( x11-misc/shared-mime-info ) +" +# shared-mime-info needed for gio/xdgmime, bug #409481 +# dconf is needed to be able to save settings, bug #498436 + +MULTILIB_CHOST_TOOLS=( + /usr/bin/gio-querymodules$(get_exeext) +) + +pkg_setup() { + if use kernel_linux ; then + CONFIG_CHECK="~INOTIFY_USER" + if use test ; then + CONFIG_CHECK="~IPV6" + WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them." + fi + linux-info_pkg_setup + fi + python-any-r1_pkg_setup +} + +src_prepare() { + if use test; then + # TODO: Review the test exclusions, especially now with meson + # Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163 + if ! has_version dev-util/desktop-file-utils ; then + ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system," + ewarn "think on installing it to get these tests run." + sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die + sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die + fi + + # gdesktopappinfo requires existing terminal (gnome-terminal or any + # other), falling back to xterm if one doesn't exist + #if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then + # ewarn "Some tests will be skipped due to missing terminal program" + # These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson + # Also try https://gitlab.gnome.org/GNOME/glib/issues/1601 once ready for backport (or in a bump) and file new issue if still fails + sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die + # desktop-app-info/launch* might fail similarly + sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die + #fi + + # https://bugzilla.gnome.org/show_bug.cgi?id=722604 + sed -i -e "/timer\/stop/d" glib/tests/timer.c || die + sed -i -e "/timer\/basic/d" glib/tests/timer.c || die + + ewarn "Tests for search-utils have been skipped" + sed -i -e "/search-utils/d" glib/tests/meson.build || die + + # Play nice with network-sandbox, but this approach would defeat the purpose of the test + #sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die + else + # Don't build tests, also prevents extra deps, bug #512022 + sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die + fi + + # Don't build fuzzing binaries - not used + sed -i -e '/subdir.*fuzzing/d' meson.build || die + + # gdbus-codegen is a separate package + sed -i -e 's/install.*true/install : false/g' gio/gdbus-2.0/codegen/meson.build || die + # Older than meson-0.50 doesn't know about install kwarg for configure_file; for that we need to remove the install_dir kwarg. + # Upstream will remove the install kwarg in a future version to require only meson-0.49.2 or newer, at which point the + # install_dir removal only should be kept. + sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die + + # Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon + sed -i -e '/install_dir/d' gio/tests/meson.build || die + + cat > "${T}/glib-test-ld-wrapper" <<-EOF + #!/usr/bin/env sh + exec \${LD:-ld} "\$@" + EOF + chmod a+x "${T}/glib-test-ld-wrapper" || die + sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die + + xdg_src_prepare + gnome2_environment_reset + # TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only +} + +multilib_src_configure() { + if use debug; then + append-cflags -DG_ENABLE_DEBUG + else + append-cflags -DG_DISABLE_CAST_CHECKS # https://gitlab.gnome.org/GNOME/glib/issues/1833 + fi + + # TODO: figure a way to pass appropriate values for all cross properties that glib uses (search for get_cross_property) + #if tc-is-cross-compiler ; then + # https://bugzilla.gnome.org/show_bug.cgi?id=756473 + # TODO-meson: This should be in meson cross file as 'growing_stack' property; and more, look at get_cross_property + #case ${CHOST} in + #hppa*|metag*) export glib_cv_stack_grows=yes ;; + #*) export glib_cv_stack_grows=no ;; + #esac + #fi + + local emesonargs=( + -Ddefault_library=$(usex static-libs both shared) + $(meson_feature selinux) + $(meson_use xattr) + -Dlibmount=true # only used if host_system == 'linux' + -Dinternal_pcre=false + -Dman=true + $(meson_use systemtap dtrace) + $(meson_use systemtap) + -Dgtk_doc=$(multilib_native_usex gtk-doc true false) + $(meson_use fam) + -Dinstalled_tests=false + -Dnls=enabled + ) + meson_src_configure +} + +multilib_src_compile() { + meson_src_compile +} + +multilib_src_test() { + export XDG_CONFIG_DIRS=/etc/xdg + export XDG_DATA_DIRS=/usr/local/share:/usr/share + export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp" + export LC_TIME=C # bug #411967 + unset GSETTINGS_BACKEND # bug #596380 + python_setup + + # Related test is a bit nitpicking + mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" + chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" + + meson_src_test --timeout-multiplier 2 --no-suite flaky +} + +multilib_src_install() { + meson_src_install + keepdir /usr/$(get_libdir)/gio/modules +} + +multilib_src_install_all() { + einstalldocs + + # These are installed by dev-util/glib-utils + # TODO: With patching we might be able to get rid of the python-any deps and removals, and test depend on glib-utils instead; revisit now with meson + rm "${ED}/usr/bin/glib-genmarshal" || die + rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die + rm "${ED}/usr/bin/glib-mkenums" || die + rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die + rm "${ED}/usr/bin/gtester-report" || die + rm "${ED}/usr/share/man/man1/gtester-report.1" || die + # gdbus-codegen manpage installed by dev-util/gdbus-codegen + rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die +} + +pkg_preinst() { + xdg_pkg_preinst + + # Make gschemas.compiled belong to glib alone + local cache="/usr/share/glib-2.0/schemas/gschemas.compiled" + + if [[ -e ${EROOT}${cache} ]]; then + cp "${EROOT}"${cache} "${ED}"/${cache} || die + else + touch "${ED}"${cache} || die + fi + + multilib_pkg_preinst() { + # Make giomodule.cache belong to glib alone + local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache" + + if [[ -e ${EROOT}${cache} ]]; then + cp "${EROOT}"${cache} "${ED}"${cache} || die + else + touch "${ED}"${cache} || die + fi + } + + # Don't run the cache ownership when cross-compiling, as it would end up with an empty cache + # file due to inability to create it and GIO might not look at any of the modules there + if ! tc-is-cross-compiler ; then + multilib_foreach_abi multilib_pkg_preinst + fi +} + +pkg_postinst() { + xdg_pkg_postinst + # glib installs no schemas itself, but we force update for fresh install in case + # something has dropped in a schemas file without direct glib dep; and for upgrades + # in case the compiled schema format could have changed + gnome2_schemas_update + + multilib_pkg_postinst() { + gnome2_giomodule_cache_update \ + || die "Update GIO modules cache failed (for ${ABI})" + } + if ! tc-is-cross-compiler ; then + multilib_foreach_abi multilib_pkg_postinst + else + ewarn "Updating of GIO modules cache skipped due to cross-compilation." + ewarn "You might want to run gio-querymodules manually on the target for" + ewarn "your final image for performance reasons and re-run it when packages" + ewarn "installing GIO modules get upgraded or added to the image." + fi +} + +pkg_postrm() { + xdg_pkg_postrm + gnome2_schemas_update + + if [[ -z ${REPLACED_BY_VERSION} ]]; then + multilib_pkg_postrm() { + rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache + } + multilib_foreach_abi multilib_pkg_postrm + rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled + fi +} |