summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2015-11-24 19:45:59 +0100
committerGilles Dartiguelongue <eva@gentoo.org>2015-11-24 22:57:28 +0100
commit625c69179d118de2780e14f43666fc56c5af6e1f (patch)
tree922063704a1ac83f36cb7f65df2d02330af5288d /eclass/xdg.eclass
parentxdg*.eclass: add support for EAPI 0, 1 and 2 (diff)
downloadgentoo-625c69179d118de2780e14f43666fc56c5af6e1f.tar.gz
gentoo-625c69179d118de2780e14f43666fc56c5af6e1f.tar.bz2
gentoo-625c69179d118de2780e14f43666fc56c5af6e1f.zip
xdg.eclass: make XDG_ECLASS_* bash arrays and deal with spaces in path
Diffstat (limited to 'eclass/xdg.eclass')
-rw-r--r--eclass/xdg.eclass23
1 files changed, 17 insertions, 6 deletions
diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 19146878a6a7..e804d18ace23 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -43,8 +43,19 @@ xdg_src_prepare() {
xdg_pkg_preinst() {
has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
pushd "${ED}" > /dev/null || die
- export XDG_ECLASS_DESKTOPFILES=( $(find 'usr/share/applications' -type f -print0 2> /dev/null) )
- export XDG_ECLASS_MIMEINFOFILES=( $(find 'usr/share/mime' -type f -print0 2> /dev/null) )
+
+ local f
+ XDG_ECLASS_DESKTOPFILES=()
+ while IFS= read -r -d '' f; do
+ XDG_ECLASS_DESKTOPFILES+=( ${f} )
+ done < <(find 'usr/share/applications' -type f -print0 2>/dev/null)
+
+ XDG_ECLASS_MIMEINFOFILES=()
+ while IFS= read -r -d '' f; do
+ XDG_ECLASS_MIMEINFOFILES+=( ${f} )
+ done < <(find 'usr/share/mime' -type f -print0 2>/dev/null)
+
+ export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
popd > /dev/null || die
}
@@ -52,13 +63,13 @@ xdg_pkg_preinst() {
# @DESCRIPTION:
# Handle desktop and mime info database updates.
xdg_pkg_postinst() {
- if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
+ if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
xdg_desktop_database_update
else
debug-print "No .desktop files to add to database"
fi
- if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
+ if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
xdg_mimeinfo_database_update
else
debug-print "No mime info files to add to database"
@@ -69,13 +80,13 @@ xdg_pkg_postinst() {
# @DESCRIPTION:
# Handle desktop and mime info database updates.
xdg_pkg_postrm() {
- if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
+ if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
xdg_desktop_database_update
else
debug-print "No .desktop files to add to database"
fi
- if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
+ if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
xdg_mimeinfo_database_update
else
debug-print "No mime info files to add to database"