public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-dev] [PATCH 3/4] gnome2-utils: move icon functions into xdg-utils
  @ 2018-06-20  7:27 99%   ` Michał Górny
  0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2018-06-20  7:27 UTC (permalink / raw
  To: gentoo-dev; +Cc: Marty E. Plummer

[-- Attachment #1: Type: text/plain, Size: 7099 bytes --]

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?

2. I don't think suddenly having a lot of ebuilds eqawarn about this
in existing EAPIs is going to be productive.

> 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-06-20  7:10     [gentoo-dev] [PATCH 1/4] xdg-utils.eclass: make EAPI 7 ready Marty E. Plummer
2018-06-20  7:10     ` [gentoo-dev] [PATCH 3/4] gnome2-utils: move icon functions into xdg-utils Marty E. Plummer
2018-06-20  7:27 99%   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox