public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Gilles Dartiguelongue" <eva@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/
Date: Tue, 24 Nov 2015 18:50:08 +0000 (UTC)	[thread overview]
Message-ID: <1448390984.141792aaa5ad65cc5dc72d248e7be4d37ce028bc.eva@gentoo> (raw)

commit:     141792aaa5ad65cc5dc72d248e7be4d37ce028bc
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 24 18:45:59 2015 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Tue Nov 24 18:49:44 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=141792aa

xdg.eclass: make XDG_ECLASS_* bash arrays and deal with spaces in path

 eclass/xdg.eclass | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 1914687..e804d18 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"


             reply	other threads:[~2015-11-24 18:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 18:50 Gilles Dartiguelongue [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-11-24 19:08 [gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/ Gilles Dartiguelongue
2015-11-24 18:50 Gilles Dartiguelongue
2015-11-24 18:50 Gilles Dartiguelongue
2015-11-24 18:50 Gilles Dartiguelongue
2015-11-24 18:50 Gilles Dartiguelongue
2015-11-24 18:50 Gilles Dartiguelongue
2015-11-23 14:38 Gilles Dartiguelongue
2015-11-23 14:38 Gilles Dartiguelongue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448390984.141792aaa5ad65cc5dc72d248e7be4d37ce028bc.eva@gentoo \
    --to=eva@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox