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 03CA6138334 for ; Wed, 20 Jun 2018 07:13:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3A658E0990; Wed, 20 Jun 2018 07:12:01 +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 5FB4CE083B for ; Wed, 20 Jun 2018 07:11:59 +0000 (UTC) From: "Marty E. Plummer" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=startmail.com; s=2017-11; t=1529478717; bh=F/YjiTCqESkpo5IxL/Vn99qC81qcRUjCfXI3FJyQsXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Agi2rBpnytR/0xsYvWWKyBfVwR4cYnMPtMKOtN37BPYgaBmnzAg9WHWZTTsfMCsqH Lv70YHIr02IaqBJ68GRSt/DwO4YQFD6kHeqoxpQpf7Vml91znKgbxmzKHB13JqV366 o9SO28xm6D8eCOtQ9EBhb4957yw2UQ9CQzLQgOH5MOhlL0qe1v5yeNW9Maa4yos/2u Pr10TUKpj5ks9wgpFiE/BDLJ12sKbzYuY+OIDAAvNJHmgyPoiY+eDBx8UCFUuXmmV7 75Kn/RqRtYtzsZDEafnxcCjUeVKogvPjpiPO2zlkPGdtNAzjPzFaJveThzo3iFUhg6 iL4gh6G3BRbQg== To: gentoo-dev@lists.gentoo.org Cc: "Marty E. Plummer" Subject: [gentoo-dev] [PATCH 3/4] gnome2-utils: move icon functions into xdg-utils Date: Wed, 20 Jun 2018 02:10:52 -0500 Message-Id: <20180620071053.11589-3-hanetzer@startmail.com> In-Reply-To: <20180620071053.11589-1-hanetzer@startmail.com> References: <20180620071053.11589-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: d2b04498-ccb4-40b4-90fe-db940f344d8f X-Archives-Hash: 03864863cc9acac3d1bf5993859a3077 Kept some dummy stub functions in place in order to maintain functionality of existing ebuilds, along with a QA warning to migrate from one eclass to the other. --- eclass/gnome2-utils.eclass | 73 ++++++---------------------------- eclass/xdg-utils.eclass | 80 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 62 deletions(-) diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index 14fb9e7420c..a355f0f4f13 100644 --- a/eclass/gnome2-utils.eclass +++ b/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: @@ -203,68 +197,23 @@ gnome2_gconf_uninstall() { # @FUNCTION: gnome2_icon_savelist # @DESCRIPTION: -# Find the icons that are about to be installed and save their location -# in the GNOME2_ECLASS_ICONS environment variable. This is only -# necessary for eclass implementations that call -# gnome2_icon_cache_update conditionally. -# This function should be called from pkg_preinst. +# Deprecated. Use xdg_icon_savelist from xdg-utils.eclass instead. gnome2_icon_savelist() { - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" - pushd "${ED}" > /dev/null || die - export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) - popd > /dev/null || die + eqawarn "QA warning: gnome2_icon_savelist has been moved to xdg-utils.eclass" + eqawarn "and is now called xdg_icon_savelist. Please migrate your ebuild and" + eqawarn "eclasses to use it" + xdg_icon_savelist + GNOME2_ECLASS_ICONS="${XDG_ECLASS_ICONS}" } # @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. Use xdg_icon_cache_update from xdg-utils.eclass instead. 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 + eqawarn "QA warning: gnome2_icon_cache_update has been moved to xdg-utils.eclass" + eqawarn "and is now called xdg_icon_cache_update. Please migrate your ebuild and" + eqawarn "eclasses to use it" + xdg_icon_cache_update } # @FUNCTION: gnome2_omf_fix diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass index 8dba5ed6861..37e1893a701 100644 --- a/eclass/xdg-utils.eclass +++ b/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: @@ -43,6 +49,12 @@ esac # Directory where .desktop files database is stored : ${MIMEINFO_DATABASE_DIR:="/usr/share/mime"} +# @ECLASS-VARIABLE: XDG_ECLASS_ICONS +# @INTERNAL +# @DEFAULT_UNSET +# @DESCRIPTION: +# List of icons provided by the package + # @FUNCTION: xdg_environment_reset # @DESCRIPTION: # Clean up environment for clean builds. @@ -82,6 +94,74 @@ xdg_desktop_database_update() { eend $? } +# @FUNCTION: xdg_icon_savelist +# @DESCRIPTION: +# Find the icons that are about to be installed and save their location +# in the XDG_ECLASS_ICONS environment variable. This is only +# necessary for eclass implementations that call +# xdg_icon_cache_update conditionally. +# This function should be called from pkg_preinst. +xdg_icon_savelist() { + XDG_ECLASS_ICONS=() + while IFS= read -r -d '' f; do + XDG_ECLASS_ICONS+=( ${f} ) + done < <(cd "${D}" && find 'usr/share/icons' -type f -print0 2>/dev/null) + + export XDG_ECLASS_ICONS +} + +# @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