From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6E12F138334 for ; Wed, 27 Jun 2018 01:29:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7D7B0E0969; Wed, 27 Jun 2018 01:28:44 +0000 (UTC) Received: from mx-out1.startmail.com (mx-out1.startmail.com [145.131.90.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E8207E0909 for ; Wed, 27 Jun 2018 01:28:43 +0000 (UTC) From: "Marty E. Plummer" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=startmail.com; s=2017-11; t=1530062922; bh=wiMK2ooLFx/rtoAMkpeC3GCIx8QF6SPSzQdKnMzNOyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=veNGzZvTkb5kvKHN1Z0vrz/EFDLU5dLpwWeNJoDG+N6L62qmFk5rgLa4ZGoXVOIPP 8TsZQKKUBSDQcP8F8gqNvEs6W4b3Mo9kZot6JzvmfdJLOOdPjSt6mQWT6Ow0FK3MXr OSwOrCGWAFHOzVaaxLHtJsY46wnPhO3gRi/WVBj/jbC/upy95smv7hF5VgMrZGt03w H4547UoH2WDIIctHOhCffMxESaxKkzAYlRKm+PrVU4JF1AAPxlBQFblln2C17+I4N5 Lb3bFIO4IEw9KO0BmhtZHhOrq9RiyzpSQZBUWV1bsuF6Pt5/hnaQSSiHqnnqeRK1V2 cvNejaVClarAg== To: gentoo-dev@lists.gentoo.org Cc: "Marty E. Plummer" Subject: [gentoo-dev] [PATCH 01/10] gnome2-utils: move icon functions into xdg-utils Date: Tue, 26 Jun 2018 20:27:25 -0500 Message-Id: <20180627012734.1319-2-hanetzer@startmail.com> In-Reply-To: <20180627012734.1319-1-hanetzer@startmail.com> References: <20180627012734.1319-1-hanetzer@startmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 46854e45-ea59-4e9b-9cff-fe0509b6bb93 X-Archives-Hash: 8088f9a2bef39ca182c0f102470f7fcf Kept some dummy stub functions in place in order to maintain functionality of existing ebuilds. Package-Manager: Portage-2.3.40, Repoman-2.3.9 --- eclass/gnome2-utils.eclass | 56 ++--------------------------------- eclass/xdg-utils.eclass | 60 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 54 deletions(-) diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index 65076ae2d61..1597ac4ad08 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @ECLASS: gnome2-utils.eclass @@ -40,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: @@ -221,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 ac075185d8e..f9088d9c348 100644 --- a/eclass/xdg-utils.eclass +++ b/eclass/xdg-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @ECLASS: xdg-utils.eclass @@ -31,6 +31,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: @@ -82,6 +88,58 @@ 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. -- 2.17.1