public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update
@ 2013-08-31 11:07 Gilles Dartiguelongue
  2013-08-31 11:40 ` Michał Górny
  0 siblings, 1 reply; 26+ messages in thread
From: Gilles Dartiguelongue @ 2013-08-31 11:07 UTC (permalink / raw
  To: gentoo-dev

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

As described here:

https://bugs.gentoo.org/show_bug.cgi?id=483128

This is a very lightweight patch to support the few packages that
provide gdk pixbuf loaders. The ones I know of are: gdk-pixbuf itself,
librsvg and libopenraw and emul-gtklibs but more could be missing simply
because they do not run the command.

Since this patch is quite trivial, I'd like to have it commited by
Sunday. Thanks.

I am attaching the patch here as well for convience.

-- 
Gilles Dartiguelongue <eva@gentoo.org>
Gentoo

[-- Attachment #2: gdk-pixbuf-cache.patch --]
[-- Type: text/x-patch, Size: 3080 bytes --]

Index: gnome2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v
retrieving revision 1.122
diff -u -B -r1.122 gnome2.eclass
--- gnome2.eclass	26 May 2013 14:08:21 -0000	1.122
+++ gnome2.eclass	31 Aug 2013 10:56:58 -0000
@@ -258,6 +258,7 @@
 	gnome2_icon_savelist
 	gnome2_schemas_savelist
 	gnome2_scrollkeeper_savelist
+	gnome2_gdk_pixbuf_savelist
 }
 
 # @FUNCTION: gnome2_pkg_postinst
@@ -271,6 +272,7 @@
 	gnome2_icon_cache_update
 	gnome2_schemas_update
 	gnome2_scrollkeeper_update
+	gnome2_gdk_pixbuf_update
 }
 
 # # FIXME Handle GConf schemas removal
Index: gnome2-utils.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v
retrieving revision 1.31
diff -u -B -r1.31 gnome2-utils.eclass
--- gnome2-utils.eclass	27 Oct 2012 22:24:10 -0000	1.31
+++ gnome2-utils.eclass	31 Aug 2013 10:56:58 -0000
@@ -50,6 +50,12 @@
 # Path to glib-compile-schemas
 : ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
 
+# @ECLASS-VARIABLE: GDK_PIXBUF_UPDATE_BIN
+# @INTERNAL
+# @DESCRIPTION:
+# Path to gdk-pixbuf-query-loaders
+: ${GDK_PIXBUF_UPDATE_BIN:="/usr/bin/gdk-pixbuf-query-loaders"}
+
 # @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
 # @INTERNAL
 # @DEFAULT_UNSET
@@ -74,6 +80,12 @@
 # @DESCRIPTION:
 # List of GSettings schemas provided by the package
 
+# @ECLASS-VARIABLE: GNOME2_ECLASS_GDK_PIXBUF_LOADERS
+# @INTERNAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of gdk-pixbuf loaders provided by the package
+
 DEPEND=">=sys-apps/sed-4"
 
 
@@ -387,6 +399,45 @@
 	eend $?
 }
 
+# @FUNCTION: gnome2_gdk_pixbuf_savelist
+# @DESCRIPTION:
+# Find if there is any gdk-pixbuf loader to install and save the list in
+# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
+# This function should be called from pkg_preinst.
+gnome2_gdk_pixbuf_savelist() {
+	has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+	pushd "${ED}" &>/dev/null
+	export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find "usr/$(get_libdir)/gdk-pixbuf-2.0" -type f 2>/dev/null)
+	popd &>/dev/null
+}
+
+# @FUNCTION: gnome2_gdk_pixbuf_update
+# @USAGE: gnome2_gdk_pixbuf_update
+# @DESCRIPTION:
+# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
+# This function should be called from pkg_postinst and pkg_postrm.
+gnome2_gdk_pixbuf_update() {
+	has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
+	local updater="${EROOT}${GDK_PIXBUF_UPDATE_BIN}"
+
+	if [[ ! -x ${updater} ]]; then
+		debug-print "${updater} is not executable"
+		return
+	fi
+
+	if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
+		debug-print "gdk-pixbuf loader cache does not need an update"
+		return
+	fi
+
+	ebegin "Updating gdk-pixbuf loader cache"
+	local tmp_file=$(mktemp -t tmp.XXXXXXXXXX_gdkpixbuf)
+	${updater} 1> "${tmp_file}" 2>/dev/null &&
+	cat "${tmp_file}" > "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+	eend $?
+}
+
+
 # @FUNCTION: gnome2_query_immodules_gtk2
 # @USAGE: gnome2_query_immodules_gtk2
 # @DESCRIPTION:

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

end of thread, other threads:[~2013-09-11  8:23 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-31 11:07 [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update Gilles Dartiguelongue
2013-08-31 11:40 ` Michał Górny
2013-08-31 13:00   ` Gilles Dartiguelongue
2013-08-31 13:30     ` Alex Xu
2013-08-31 14:49     ` Michał Górny
2013-08-31 16:44       ` Gilles Dartiguelongue
2013-09-01 11:29         ` Gilles Dartiguelongue
2013-09-01 12:11           ` Michał Górny
2013-09-01 15:10             ` Gilles Dartiguelongue
2013-09-04 18:57               ` Gilles Dartiguelongue
2013-09-04 19:23                 ` Ian Stakenvicius
2013-09-04 19:44                   ` Gilles Dartiguelongue
2013-09-04 19:48                     ` Ian Stakenvicius
2013-09-04 19:49                       ` Ian Stakenvicius
2013-09-04 20:19                       ` Gilles Dartiguelongue
2013-09-04 20:21                         ` Ian Stakenvicius
2013-09-04 20:51                         ` Michał Górny
2013-09-10  0:29                         ` Gilles Dartiguelongue
2013-09-09 23:18                           ` hasufell
2013-09-09 23:31                           ` Alex Xu
2013-09-10 10:22                             ` Ian Stakenvicius
2013-09-10 15:10                               ` Fabian Groffen
2013-09-11  8:51                                 ` Gilles Dartiguelongue
2013-09-11  8:23                                   ` Fabian Groffen
2013-09-04 20:07                     ` Zac Medico
2013-09-04 19:56                 ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox