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 4BC9E138334 for ; Wed, 20 Jun 2018 09:04:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 488D8E0A65; Wed, 20 Jun 2018 09:04:35 +0000 (UTC) Received: from mx-out2.startmail.com (mx-out2.startmail.com [145.131.90.155]) (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 6B6E8E0A00 for ; Wed, 20 Jun 2018 09:04:34 +0000 (UTC) Date: Wed, 20 Jun 2018 04:03:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=startmail.com; s=2017-11; t=1529485472; bh=DD3oynIxa31X5lUEA+8TaNGjYf8TaoyG/QdksrHhdUk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=UxAFvfdwXEQYRdvkysyuJqkp33vfrXZ2F8OoL579YShDnN03DXjlzhxhEmTsdZuBX ZjJcmXw+FKLuP3WWgJfDLoLzVyW9x2LsBMMQzncUItBZEY2r01nLUjGeSJbXTctrgn RvQZaI7UE7/HI3fPec8IOe47+W34hDPj8y4nz14bfII0PwhajulnKfi03kojV/uB+F 9WhliuPC47q3LsBMgRsXrCxZTuRI/5sJB+Lodvy+kIr+W/H8TARjVYFYhwk3w7uOpI vnLz3OrHgGkem3c4/FgsMVEqMSHiz3dkqISuEFmrr2z2qzDqP/aS7yF8kKBJbhHazg ljXZ754fJBIUA== From: "Marty E. Plummer" To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH 3/4] gnome2-utils: move icon functions into xdg-utils Message-ID: <20180620090332.kghnuxdygvz72nhm@proprietary-killer> References: <20180620071053.11589-1-hanetzer@startmail.com> <20180620071053.11589-3-hanetzer@startmail.com> <1529479621.2506.3.camel@gentoo.org> 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 Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1529479621.2506.3.camel@gentoo.org> X-Archives-Salt: f27e59a1-a9e5-4598-afc1-fd4315cfd84a X-Archives-Hash: 1461a7dde89a1a3fdc942de0edec21f3 On Wed, Jun 20, 2018 at 09:27:01AM +0200, Michał Górny wrote: > W dniu śro, 20.06.2018 o godzinie 02∶10 -0500, użytkownik Marty E. > Plummer napisał: > > 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 > > 1. Why not make those two fatal in EAPI 7? > Sounds ok. There can currently be no EAPI 7 ebuilds for this, so any ebuild which updates their eapi can do the migration then. > 2. I don't think suddenly having a lot of ebuilds eqawarn about this > in existing EAPIs is going to be productive. > Reasonable. I wasn't thinking in terms of that, since I wasn't making it fatal in EAPI 7. Is there a non-ugly way to do multiline die statements? > > 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. > > -- > Best regards, > Michał Górny