commit:     a506c07df071f68613099e8b7e2b1f81c9ef97a1
Author:     Marty E. Plummer <hanetzer <AT> startmail <DOT> com>
AuthorDate: Tue Jan  1 22:19:06 2019 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Mon Feb 11 17:13:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a506c07d

gnome2-utils: move icon functions into xdg-utils

Kept some dummy stub functions in place in order to maintain
functionality of existing ebuilds.

Package-Manager: Portage-2.3.51, Repoman 2.3.11
Signed-off-by: Marty E. Plummer <hanetzer <AT> startmail.com>
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 eclass/gnome2-utils.eclass | 57 +++-------------------------------------------
 eclass/xdg-utils.eclass    | 50 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 55 deletions(-)

diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
index b2f536a45e9..41b3edbcd9b 100644
--- a/eclass/gnome2-utils.eclass
+++ b/eclass/gnome2-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: gnome2-utils.eclass
@@ -10,7 +10,6 @@
 # This eclass provides a set of auxiliary functions needed by most Gnome
 # packages. It may be used by non-Gnome packages as needed for handling various
 # Gnome stack related functions such as:
-#  * Gtk+ icon cache management
 #  * GSettings schemas management
 #  * GConf schemas management
 #  * scrollkeeper (old Gnome help system) management
@@ -41,12 +40,6 @@ esac
 # Path to scrollkeeper-update
 : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
 
-# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
-# @INTERNAL
-# @DESCRIPTION:
-# Path to gtk-update-icon-cache
-: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
-
 # @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
 # @INTERNAL
 # @DESCRIPTION:
@@ -222,53 +215,9 @@ gnome2_icon_savelist() {
 # @FUNCTION: gnome2_icon_cache_update
 # @DESCRIPTION:
 # Updates Gtk+ icon cache files under /usr/share/icons.
-# This function should be called from pkg_postinst and pkg_postrm.
+# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
 gnome2_icon_cache_update() {
-       has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
-       local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
-
-       if [[ ! -x "${updater}" ]] ; then
-               debug-print "${updater} is not executable"
-               return
-       fi
-
-       ebegin "Updating icons cache"
-
-       local retval=0
-       local fails=( )
-
-       for dir in "${EROOT%/}"/usr/share/icons/*
-       do
-               if [[ -f "${dir}/index.theme" ]] ; then
-                       local rv=0
-
-                       "${updater}" -qf "${dir}"
-                       rv=$?
-
-                       if [[ ! $rv -eq 0 ]] ; then
-                               debug-print "Updating cache failed on ${dir}"
-
-                               # Add to the list of failures
-                               fails+=( "${dir}" )
-
-                               retval=2
-                       fi
-               elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
-                       # Clear stale cache files after theme uninstallation
-                       rm "${dir}/icon-theme.cache"
-               fi
-
-               if [[ -z $(ls "${dir}") ]]; then
-                       # Clear empty theme directories after theme 
uninstallation
-                       rmdir "${dir}"
-               fi
-       done
-
-       eend ${retval}
-
-       for f in "${fails[@]}" ; do
-               eerror "Failed to update cache with icon $f"
-       done
+       xdg_icon_cache_update
 }
 
 # @FUNCTION: gnome2_omf_fix

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index fe1eef213ea..3c3a3e8227c 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xdg-utils.eclass
@@ -12,6 +12,7 @@
 # This eclass provides a set of auxiliary functions needed by most XDG
 # compliant packages.
 # It provides XDG stack related functions such as:
+#  * Gtk+ icon cache management
 #  * XDG .desktop files cache management
 #  * XDG mime information database management
 
@@ -32,6 +33,12 @@ esac
 # Directory where .desktop files database is stored
 : ${DESKTOP_DATABASE_DIR="/usr/share/applications"}
 
+# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
+# @INTERNAL
+# @DESCRIPTION:
+# Path to gtk-update-icon-cache
+: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
+
 # @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN
 # @INTERNAL
 # @DESCRIPTION:
@@ -83,6 +90,47 @@ xdg_desktop_database_update() {
        eend $?
 }
 
+# @FUNCTION: xdg_icon_cache_update
+# @DESCRIPTION:
+# Updates Gtk+ icon cache files under /usr/share/icons.
+# This function should be called from pkg_postinst and pkg_postrm.
+xdg_icon_cache_update() {
+       has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
+       local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}"
+       if [[ ! -x "${updater}" ]]; then
+               debug-print "${updater} is not executable"
+               return
+       fi
+       ebegin "Updating icons cache"
+       local retval=0
+       local fails=( )
+       for dir in "${EROOT%/}"/usr/share/icons/*
+       do
+               if [[ -f "${dir}/index.theme" ]] ; then
+                       local rv=0
+                       "${updater}" -qf "${dir}"
+                       rv=$?
+                       if [[ ! $rv -eq 0 ]] ; then
+                               debug-print "Updating cache failed on ${dir}"
+                               # Add to the list of failures
+                               fails+=( "${dir}" )
+                               retval=2
+                       fi
+               elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
+                       # Clear stale cache files after theme uninstallation
+                       rm "${dir}/icon-theme.cache"
+               fi
+               if [[ -z $(ls "${dir}") ]]; then
+                       # Clear empty theme directories after theme 
uninstallation
+                       rmdir "${dir}"
+               fi
+       done
+       eend ${retval}
+       for f in "${fails[@]}" ; do
+               eerror "Failed to update cache with icon $f"
+       done
+}
+
 # @FUNCTION: xdg_mimeinfo_database_update
 # @DESCRIPTION:
 # Update the mime database.

Reply via email to