Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 3/4] gnome2-utils: move icon functions into xdg-utils
Date: Wed, 20 Jun 2018 09:18:59
Message-Id: 1529486326.2506.29.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH 3/4] gnome2-utils: move icon functions into xdg-utils by "Marty E. Plummer"
1 W dniu śro, 20.06.2018 o godzinie 04∶03 -0500, użytkownik Marty E.
2 Plummer napisał:
3 > On Wed, Jun 20, 2018 at 09:27:01AM +0200, Michał Górny wrote:
4 > > W dniu śro, 20.06.2018 o godzinie 02∶10 -0500, użytkownik Marty E.
5 > > Plummer napisał:
6 > > > Kept some dummy stub functions in place in order to maintain
7 > > > functionality of existing ebuilds, along with a QA warning to migrate
8 > > > from one eclass to the other.
9 > > > ---
10 > > > eclass/gnome2-utils.eclass | 73 ++++++----------------------------
11 > > > eclass/xdg-utils.eclass | 80 ++++++++++++++++++++++++++++++++++++++
12 > > > 2 files changed, 91 insertions(+), 62 deletions(-)
13 > > >
14 > > > diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
15 > > > index 14fb9e7420c..a355f0f4f13 100644
16 > > > --- a/eclass/gnome2-utils.eclass
17 > > > +++ b/eclass/gnome2-utils.eclass
18 > > > @@ -40,12 +40,6 @@ esac
19 > > > # Path to scrollkeeper-update
20 > > > : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
21 > > >
22 > > > -# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
23 > > > -# @INTERNAL
24 > > > -# @DESCRIPTION:
25 > > > -# Path to gtk-update-icon-cache
26 > > > -: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
27 > > > -
28 > > > # @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
29 > > > # @INTERNAL
30 > > > # @DESCRIPTION:
31 > > > @@ -203,68 +197,23 @@ gnome2_gconf_uninstall() {
32 > > >
33 > > > # @FUNCTION: gnome2_icon_savelist
34 > > > # @DESCRIPTION:
35 > > > -# Find the icons that are about to be installed and save their location
36 > > > -# in the GNOME2_ECLASS_ICONS environment variable. This is only
37 > > > -# necessary for eclass implementations that call
38 > > > -# gnome2_icon_cache_update conditionally.
39 > > > -# This function should be called from pkg_preinst.
40 > > > +# Deprecated. Use xdg_icon_savelist from xdg-utils.eclass instead.
41 > > > gnome2_icon_savelist() {
42 > > > - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
43 > > > - pushd "${ED}" > /dev/null || die
44 > > > - export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
45 > > > - popd > /dev/null || die
46 > > > + eqawarn "QA warning: gnome2_icon_savelist has been moved to xdg-utils.eclass"
47 > > > + eqawarn "and is now called xdg_icon_savelist. Please migrate your ebuild and"
48 > > > + eqawarn "eclasses to use it"
49 > > > + xdg_icon_savelist
50 > > > + GNOME2_ECLASS_ICONS="${XDG_ECLASS_ICONS}"
51 > > > }
52 > > >
53 > > > # @FUNCTION: gnome2_icon_cache_update
54 > > > # @DESCRIPTION:
55 > > > -# Updates Gtk+ icon cache files under /usr/share/icons.
56 > > > -# This function should be called from pkg_postinst and pkg_postrm.
57 > > > +# Deprecated. Use xdg_icon_cache_update from xdg-utils.eclass instead.
58 > > > gnome2_icon_cache_update() {
59 > > > - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
60 > > > - local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}"
61 > > > -
62 > > > - if [[ ! -x "${updater}" ]] ; then
63 > > > - debug-print "${updater} is not executable"
64 > > > - return
65 > > > - fi
66 > > > -
67 > > > - ebegin "Updating icons cache"
68 > > > -
69 > > > - local retval=0
70 > > > - local fails=( )
71 > > > -
72 > > > - for dir in "${EROOT%/}"/usr/share/icons/*
73 > > > - do
74 > > > - if [[ -f "${dir}/index.theme" ]] ; then
75 > > > - local rv=0
76 > > > -
77 > > > - "${updater}" -qf "${dir}"
78 > > > - rv=$?
79 > > > -
80 > > > - if [[ ! $rv -eq 0 ]] ; then
81 > > > - debug-print "Updating cache failed on ${dir}"
82 > > > -
83 > > > - # Add to the list of failures
84 > > > - fails+=( "${dir}" )
85 > > > -
86 > > > - retval=2
87 > > > - fi
88 > > > - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
89 > > > - # Clear stale cache files after theme uninstallation
90 > > > - rm "${dir}/icon-theme.cache"
91 > > > - fi
92 > > > -
93 > > > - if [[ -z $(ls "${dir}") ]]; then
94 > > > - # Clear empty theme directories after theme uninstallation
95 > > > - rmdir "${dir}"
96 > > > - fi
97 > > > - done
98 > > > -
99 > > > - eend ${retval}
100 > > > -
101 > > > - for f in "${fails[@]}" ; do
102 > > > - eerror "Failed to update cache with icon $f"
103 > > > - done
104 > > > + eqawarn "QA warning: gnome2_icon_cache_update has been moved to xdg-utils.eclass"
105 > > > + eqawarn "and is now called xdg_icon_cache_update. Please migrate your ebuild and"
106 > > > + eqawarn "eclasses to use it"
107 > > > + xdg_icon_cache_update
108 > > > }
109 > > >
110 > > > # @FUNCTION: gnome2_omf_fix
111 > >
112 > > 1. Why not make those two fatal in EAPI 7?
113 > >
114 >
115 > Sounds ok. There can currently be no EAPI 7 ebuilds for this, so any
116 > ebuild which updates their eapi can do the migration then.
117 > > 2. I don't think suddenly having a lot of ebuilds eqawarn about this
118 > > in existing EAPIs is going to be productive.
119 > >
120 >
121 > Reasonable. I wasn't thinking in terms of that, since I wasn't making it
122 > fatal in EAPI 7. Is there a non-ugly way to do multiline die statements?
123 > > >
124
125 You just do multi-line eerror, followed by short die.
126
127 --
128 Best regards,
129 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature