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