1 |
Kept some dummy stub functions in place in order to maintain |
2 |
functionality of existing ebuilds, along with a QA warning to migrate |
3 |
from one eclass to the other. |
4 |
--- |
5 |
eclass/gnome2-utils.eclass | 73 ++++++---------------------------- |
6 |
eclass/xdg-utils.eclass | 80 ++++++++++++++++++++++++++++++++++++++ |
7 |
2 files changed, 91 insertions(+), 62 deletions(-) |
8 |
|
9 |
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass |
10 |
index 14fb9e7420c..a355f0f4f13 100644 |
11 |
--- a/eclass/gnome2-utils.eclass |
12 |
+++ b/eclass/gnome2-utils.eclass |
13 |
@@ -40,12 +40,6 @@ esac |
14 |
# Path to scrollkeeper-update |
15 |
: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"} |
16 |
|
17 |
-# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE |
18 |
-# @INTERNAL |
19 |
-# @DESCRIPTION: |
20 |
-# Path to gtk-update-icon-cache |
21 |
-: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
22 |
- |
23 |
# @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS |
24 |
# @INTERNAL |
25 |
# @DESCRIPTION: |
26 |
@@ -203,68 +197,23 @@ gnome2_gconf_uninstall() { |
27 |
|
28 |
# @FUNCTION: gnome2_icon_savelist |
29 |
# @DESCRIPTION: |
30 |
-# Find the icons that are about to be installed and save their location |
31 |
-# in the GNOME2_ECLASS_ICONS environment variable. This is only |
32 |
-# necessary for eclass implementations that call |
33 |
-# gnome2_icon_cache_update conditionally. |
34 |
-# This function should be called from pkg_preinst. |
35 |
+# Deprecated. Use xdg_icon_savelist from xdg-utils.eclass instead. |
36 |
gnome2_icon_savelist() { |
37 |
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
38 |
- pushd "${ED}" > /dev/null || die |
39 |
- export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) |
40 |
- popd > /dev/null || die |
41 |
+ eqawarn "QA warning: gnome2_icon_savelist has been moved to xdg-utils.eclass" |
42 |
+ eqawarn "and is now called xdg_icon_savelist. Please migrate your ebuild and" |
43 |
+ eqawarn "eclasses to use it" |
44 |
+ xdg_icon_savelist |
45 |
+ GNOME2_ECLASS_ICONS="${XDG_ECLASS_ICONS}" |
46 |
} |
47 |
|
48 |
# @FUNCTION: gnome2_icon_cache_update |
49 |
# @DESCRIPTION: |
50 |
-# Updates Gtk+ icon cache files under /usr/share/icons. |
51 |
-# This function should be called from pkg_postinst and pkg_postrm. |
52 |
+# Deprecated. Use xdg_icon_cache_update from xdg-utils.eclass instead. |
53 |
gnome2_icon_cache_update() { |
54 |
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
55 |
- local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}" |
56 |
- |
57 |
- if [[ ! -x "${updater}" ]] ; then |
58 |
- debug-print "${updater} is not executable" |
59 |
- return |
60 |
- fi |
61 |
- |
62 |
- ebegin "Updating icons cache" |
63 |
- |
64 |
- local retval=0 |
65 |
- local fails=( ) |
66 |
- |
67 |
- for dir in "${EROOT%/}"/usr/share/icons/* |
68 |
- do |
69 |
- if [[ -f "${dir}/index.theme" ]] ; then |
70 |
- local rv=0 |
71 |
- |
72 |
- "${updater}" -qf "${dir}" |
73 |
- rv=$? |
74 |
- |
75 |
- if [[ ! $rv -eq 0 ]] ; then |
76 |
- debug-print "Updating cache failed on ${dir}" |
77 |
- |
78 |
- # Add to the list of failures |
79 |
- fails+=( "${dir}" ) |
80 |
- |
81 |
- retval=2 |
82 |
- fi |
83 |
- elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then |
84 |
- # Clear stale cache files after theme uninstallation |
85 |
- rm "${dir}/icon-theme.cache" |
86 |
- fi |
87 |
- |
88 |
- if [[ -z $(ls "${dir}") ]]; then |
89 |
- # Clear empty theme directories after theme uninstallation |
90 |
- rmdir "${dir}" |
91 |
- fi |
92 |
- done |
93 |
- |
94 |
- eend ${retval} |
95 |
- |
96 |
- for f in "${fails[@]}" ; do |
97 |
- eerror "Failed to update cache with icon $f" |
98 |
- done |
99 |
+ eqawarn "QA warning: gnome2_icon_cache_update has been moved to xdg-utils.eclass" |
100 |
+ eqawarn "and is now called xdg_icon_cache_update. Please migrate your ebuild and" |
101 |
+ eqawarn "eclasses to use it" |
102 |
+ xdg_icon_cache_update |
103 |
} |
104 |
|
105 |
# @FUNCTION: gnome2_omf_fix |
106 |
diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass |
107 |
index 8dba5ed6861..37e1893a701 100644 |
108 |
--- a/eclass/xdg-utils.eclass |
109 |
+++ b/eclass/xdg-utils.eclass |
110 |
@@ -31,6 +31,12 @@ esac |
111 |
# Directory where .desktop files database is stored |
112 |
: ${DESKTOP_DATABASE_DIR="/usr/share/applications"} |
113 |
|
114 |
+# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE |
115 |
+# @INTERNAL |
116 |
+# @DESCRIPTION: |
117 |
+# Path to gtk-update-icon-cache |
118 |
+: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
119 |
+ |
120 |
# @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN |
121 |
# @INTERNAL |
122 |
# @DESCRIPTION: |
123 |
@@ -43,6 +49,12 @@ esac |
124 |
# Directory where .desktop files database is stored |
125 |
: ${MIMEINFO_DATABASE_DIR:="/usr/share/mime"} |
126 |
|
127 |
+# @ECLASS-VARIABLE: XDG_ECLASS_ICONS |
128 |
+# @INTERNAL |
129 |
+# @DEFAULT_UNSET |
130 |
+# @DESCRIPTION: |
131 |
+# List of icons provided by the package |
132 |
+ |
133 |
# @FUNCTION: xdg_environment_reset |
134 |
# @DESCRIPTION: |
135 |
# Clean up environment for clean builds. |
136 |
@@ -82,6 +94,74 @@ xdg_desktop_database_update() { |
137 |
eend $? |
138 |
} |
139 |
|
140 |
+# @FUNCTION: xdg_icon_savelist |
141 |
+# @DESCRIPTION: |
142 |
+# Find the icons that are about to be installed and save their location |
143 |
+# in the XDG_ECLASS_ICONS environment variable. This is only |
144 |
+# necessary for eclass implementations that call |
145 |
+# xdg_icon_cache_update conditionally. |
146 |
+# This function should be called from pkg_preinst. |
147 |
+xdg_icon_savelist() { |
148 |
+ XDG_ECLASS_ICONS=() |
149 |
+ while IFS= read -r -d '' f; do |
150 |
+ XDG_ECLASS_ICONS+=( ${f} ) |
151 |
+ done < <(cd "${D}" && find 'usr/share/icons' -type f -print0 2>/dev/null) |
152 |
+ |
153 |
+ export XDG_ECLASS_ICONS |
154 |
+} |
155 |
+ |
156 |
+# @FUNCTION: xdg_icon_cache_update |
157 |
+# @DESCRIPTION: |
158 |
+# Updates Gtk+ icon cache files under /usr/share/icons. |
159 |
+# This function should be called from pkg_postinst and pkg_postrm. |
160 |
+xdg_icon_cache_update() { |
161 |
+ has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
162 |
+ local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}" |
163 |
+ |
164 |
+ if [[ ! -x "${updater}" ]] ; then |
165 |
+ debug-print "${updater} is not executable" |
166 |
+ return |
167 |
+ fi |
168 |
+ |
169 |
+ ebegin "Updating icons cache" |
170 |
+ |
171 |
+ local retval=0 |
172 |
+ local fails=( ) |
173 |
+ |
174 |
+ for dir in "${EROOT%/}"/usr/share/icons/* |
175 |
+ do |
176 |
+ if [[ -f "${dir}/index.theme" ]] ; then |
177 |
+ local rv=0 |
178 |
+ |
179 |
+ "${updater}" -qf "${dir}" |
180 |
+ rv=$? |
181 |
+ |
182 |
+ if [[ ! $rv -eq 0 ]] ; then |
183 |
+ debug-print "Updating cache failed on ${dir}" |
184 |
+ |
185 |
+ # Add to the list of failures |
186 |
+ fails+=( "${dir}" ) |
187 |
+ |
188 |
+ retval=2 |
189 |
+ fi |
190 |
+ elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then |
191 |
+ # Clear stale cache files after theme uninstallation |
192 |
+ rm "${dir}/icon-theme.cache" |
193 |
+ fi |
194 |
+ |
195 |
+ if [[ -z $(ls "${dir}") ]]; then |
196 |
+ # Clear empty theme directories after theme uninstallation |
197 |
+ rmdir "${dir}" |
198 |
+ fi |
199 |
+ done |
200 |
+ |
201 |
+ eend ${retval} |
202 |
+ |
203 |
+ for f in "${fails[@]}" ; do |
204 |
+ eerror "Failed to update cache with icon $f" |
205 |
+ done |
206 |
+} |
207 |
+ |
208 |
# @FUNCTION: xdg_mimeinfo_database_update |
209 |
# @DESCRIPTION: |
210 |
# Update the mime database. |
211 |
-- |
212 |
2.17.1 |