summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2013-09-03 21:54:38 +0000
committerGilles Dartiguelongue <eva@gentoo.org>2013-09-03 21:54:38 +0000
commitc9230bc634f0996b161cd4999812a6962160fa5f (patch)
tree5ca3bd4a045a0866fc7d722ace34146c8c72c377 /eclass
parentversion bump (diff)
downloadhistorical-c9230bc634f0996b161cd4999812a6962160fa5f.tar.gz
historical-c9230bc634f0996b161cd4999812a6962160fa5f.tar.bz2
historical-c9230bc634f0996b161cd4999812a6962160fa5f.zip
Add gdk-pixbuf cache handling functions.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/gnome2-utils.eclass58
-rw-r--r--eclass/gnome2.eclass4
3 files changed, 64 insertions, 4 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 90a19ff2df6e..83771f6d811c 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.942 2013/08/31 12:29:26 tommy Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.943 2013/09/03 21:54:38 eva Exp $
+
+ 03 Sep 2013; Gilles Dartiguelongue <eva@gentoo.org> gnome2-utils.eclass,
+ gnome2.eclass:
+ Add gdk-pixbuf cache handling functions.
31 Aug 2013; Thomas Sachau (Tommy[D]) <tommy@gentoo.org>
enlightenment.eclass:
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
index 2da752864226..9db9be50eef0 100644
--- a/eclass/gnome2-utils.eclass
+++ b/eclass/gnome2-utils.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.31 2012/10/27 22:24:10 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.32 2013/09/03 21:54:38 eva Exp $
# @ECLASS: gnome2-utils.eclass
# @MAINTAINER:
@@ -15,6 +15,8 @@
# * GConf schemas management
# * scrollkeeper (old Gnome help system) management
+inherit multilib
+
case "${EAPI:-0}" in
0|1|2|3|4|5) ;;
*) die "EAPI=${EAPI} is not supported" ;;
@@ -50,6 +52,12 @@ esac
# 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 +82,12 @@ esac
# @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 +401,46 @@ gnome2_schemas_update() {
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}" 1>/dev/null
+ export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find "usr/$(get_libdir)/gdk-pixbuf-2.0" -type f 2>/dev/null)
+ popd 1>/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}" &&
+ chmod 0644 "${tmp_file}" &&
+ mv -f "${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:
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
index bfbe3780f18c..27d68a52f97d 100644
--- a/eclass/gnome2.eclass
+++ b/eclass/gnome2.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.122 2013/05/26 14:08:21 pacho Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.123 2013/09/03 21:54:38 eva Exp $
# @ECLASS: gnome2.eclass
# @MAINTAINER:
@@ -258,6 +258,7 @@ gnome2_pkg_preinst() {
gnome2_icon_savelist
gnome2_schemas_savelist
gnome2_scrollkeeper_savelist
+ gnome2_gdk_pixbuf_savelist
}
# @FUNCTION: gnome2_pkg_postinst
@@ -271,6 +272,7 @@ gnome2_pkg_postinst() {
gnome2_icon_cache_update
gnome2_schemas_update
gnome2_scrollkeeper_update
+ gnome2_gdk_pixbuf_update
}
# # FIXME Handle GConf schemas removal