1 |
commit: b023adcba2abc9d28d9a72fcd78f6811dcad92e2 |
2 |
Author: Marty E. Plummer <hanetzer <AT> startmail <DOT> com> |
3 |
AuthorDate: Tue Jan 1 22:19:20 2019 +0000 |
4 |
Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 11 17:13:58 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b023adcb |
7 |
|
8 |
xdg-utils: use path based lookup instead of hardcoded paths |
9 |
|
10 |
Package-Manager: Portage-2.3.51, Repoman 2.3.11 |
11 |
Signed-off-by: Marty E. Plummer <hanetzer <AT> startmail.com> |
12 |
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org> |
13 |
|
14 |
eclass/xdg-utils.eclass | 47 ++++++++++++++--------------------------------- |
15 |
1 file changed, 14 insertions(+), 33 deletions(-) |
16 |
|
17 |
diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass |
18 |
index 3c3a3e8227c..c65c91c0cd2 100644 |
19 |
--- a/eclass/xdg-utils.eclass |
20 |
+++ b/eclass/xdg-utils.eclass |
21 |
@@ -21,30 +21,12 @@ case "${EAPI:-0}" in |
22 |
*) die "EAPI=${EAPI} is not supported" ;; |
23 |
esac |
24 |
|
25 |
-# @ECLASS-VARIABLE: DESKTOP_DATABASE_UPDATE_BIN |
26 |
-# @INTERNAL |
27 |
-# @DESCRIPTION: |
28 |
-# Path to update-desktop-database |
29 |
-: ${DESKTOP_DATABASE_UPDATE_BIN:="/usr/bin/update-desktop-database"} |
30 |
- |
31 |
# @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR |
32 |
# @INTERNAL |
33 |
# @DESCRIPTION: |
34 |
# Directory where .desktop files database is stored |
35 |
: ${DESKTOP_DATABASE_DIR="/usr/share/applications"} |
36 |
|
37 |
-# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE |
38 |
-# @INTERNAL |
39 |
-# @DESCRIPTION: |
40 |
-# Path to gtk-update-icon-cache |
41 |
-: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
42 |
- |
43 |
-# @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN |
44 |
-# @INTERNAL |
45 |
-# @DESCRIPTION: |
46 |
-# Path to update-mime-database |
47 |
-: ${MIMEINFO_DATABASE_UPDATE_BIN:="/usr/bin/update-mime-database"} |
48 |
- |
49 |
# @ECLASS-VARIABLE: MIMEINFO_DATABASE_DIR |
50 |
# @INTERNAL |
51 |
# @DESCRIPTION: |
52 |
@@ -74,19 +56,17 @@ xdg_environment_reset() { |
53 |
# Updates the .desktop files database. |
54 |
# Generates a list of mimetypes linked to applications that can handle them |
55 |
xdg_desktop_database_update() { |
56 |
- local updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}" |
57 |
- |
58 |
if [[ ${EBUILD_PHASE} != post* ]] ; then |
59 |
die "xdg_desktop_database_update must be used in pkg_post* phases." |
60 |
fi |
61 |
|
62 |
- if [[ ! -x "${updater}" ]] ; then |
63 |
- debug-print "${updater} is not executable" |
64 |
+ if ! type update-desktop-database &>/dev/null; then |
65 |
+ debug-print "update-desktop-database is not found" |
66 |
return |
67 |
fi |
68 |
|
69 |
ebegin "Updating .desktop files database" |
70 |
- "${updater}" -q "${EROOT%/}${DESKTOP_DATABASE_DIR}" |
71 |
+ update-desktop-database -q "${EROOT%/}${DESKTOP_DATABASE_DIR}" |
72 |
eend $? |
73 |
} |
74 |
|
75 |
@@ -95,12 +75,15 @@ xdg_desktop_database_update() { |
76 |
# Updates Gtk+ icon cache files under /usr/share/icons. |
77 |
# This function should be called from pkg_postinst and pkg_postrm. |
78 |
xdg_icon_cache_update() { |
79 |
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
80 |
- local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}" |
81 |
- if [[ ! -x "${updater}" ]]; then |
82 |
- debug-print "${updater} is not executable" |
83 |
+ if [[ ${EBUILD_PHASE} != post* ]] ; then |
84 |
+ die "xdg_icon_cache_update must be used in pkg_post* phases." |
85 |
+ fi |
86 |
+ |
87 |
+ if ! type gtk-update-icon-cache &>/dev/null; then |
88 |
+ debug-print "gtk-update-icon-cache is not found" |
89 |
return |
90 |
fi |
91 |
+ |
92 |
ebegin "Updating icons cache" |
93 |
local retval=0 |
94 |
local fails=( ) |
95 |
@@ -108,7 +91,7 @@ xdg_icon_cache_update() { |
96 |
do |
97 |
if [[ -f "${dir}/index.theme" ]] ; then |
98 |
local rv=0 |
99 |
- "${updater}" -qf "${dir}" |
100 |
+ gtk-update-icon-cache -qf "${dir}" |
101 |
rv=$? |
102 |
if [[ ! $rv -eq 0 ]] ; then |
103 |
debug-print "Updating cache failed on ${dir}" |
104 |
@@ -136,18 +119,16 @@ xdg_icon_cache_update() { |
105 |
# Update the mime database. |
106 |
# Creates a general list of mime types from several sources |
107 |
xdg_mimeinfo_database_update() { |
108 |
- local updater="${EROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}" |
109 |
- |
110 |
if [[ ${EBUILD_PHASE} != post* ]] ; then |
111 |
die "xdg_mimeinfo_database_update must be used in pkg_post* phases." |
112 |
fi |
113 |
|
114 |
- if [[ ! -x "${updater}" ]] ; then |
115 |
- debug-print "${updater} is not executable" |
116 |
+ if ! type update-mime-database &>/dev/null; then |
117 |
+ debug-print "update-mime-database is not found" |
118 |
return |
119 |
fi |
120 |
|
121 |
ebegin "Updating shared mime info database" |
122 |
- "${updater}" "${EROOT%/}${MIMEINFO_DATABASE_DIR}" |
123 |
+ update-mime-database "${EROOT%/}${MIMEINFO_DATABASE_DIR}" |
124 |
eend $? |
125 |
} |