Gentoo Archives: gentoo-commits

From: Gilles Dartiguelongue <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 24 Nov 2015 21:59:02
Message-Id: 1448402248.625c69179d118de2780e14f43666fc56c5af6e1f.eva@gentoo
1 commit: 625c69179d118de2780e14f43666fc56c5af6e1f
2 Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 24 18:45:59 2015 +0000
4 Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 24 21:57:28 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=625c6917
7
8 xdg.eclass: make XDG_ECLASS_* bash arrays and deal with spaces in path
9
10 eclass/xdg.eclass | 23 +++++++++++++++++------
11 1 file changed, 17 insertions(+), 6 deletions(-)
12
13 diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
14 index 1914687..e804d18 100644
15 --- a/eclass/xdg.eclass
16 +++ b/eclass/xdg.eclass
17 @@ -43,8 +43,19 @@ xdg_src_prepare() {
18 xdg_pkg_preinst() {
19 has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
20 pushd "${ED}" > /dev/null || die
21 - export XDG_ECLASS_DESKTOPFILES=( $(find 'usr/share/applications' -type f -print0 2> /dev/null) )
22 - export XDG_ECLASS_MIMEINFOFILES=( $(find 'usr/share/mime' -type f -print0 2> /dev/null) )
23 +
24 + local f
25 + XDG_ECLASS_DESKTOPFILES=()
26 + while IFS= read -r -d '' f; do
27 + XDG_ECLASS_DESKTOPFILES+=( ${f} )
28 + done < <(find 'usr/share/applications' -type f -print0 2>/dev/null)
29 +
30 + XDG_ECLASS_MIMEINFOFILES=()
31 + while IFS= read -r -d '' f; do
32 + XDG_ECLASS_MIMEINFOFILES+=( ${f} )
33 + done < <(find 'usr/share/mime' -type f -print0 2>/dev/null)
34 +
35 + export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
36 popd > /dev/null || die
37 }
38
39 @@ -52,13 +63,13 @@ xdg_pkg_preinst() {
40 # @DESCRIPTION:
41 # Handle desktop and mime info database updates.
42 xdg_pkg_postinst() {
43 - if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
44 + if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
45 xdg_desktop_database_update
46 else
47 debug-print "No .desktop files to add to database"
48 fi
49
50 - if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
51 + if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
52 xdg_mimeinfo_database_update
53 else
54 debug-print "No mime info files to add to database"
55 @@ -69,13 +80,13 @@ xdg_pkg_postinst() {
56 # @DESCRIPTION:
57 # Handle desktop and mime info database updates.
58 xdg_pkg_postrm() {
59 - if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
60 + if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
61 xdg_desktop_database_update
62 else
63 debug-print "No .desktop files to add to database"
64 fi
65
66 - if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
67 + if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
68 xdg_mimeinfo_database_update
69 else
70 debug-print "No mime info files to add to database"