[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: e7649a8af18c210b6141558dfb4840da04e90715
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 18:45:59 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 19:07:01 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7649a8a

xdg.eclass: drop unneeded old EAPI support

Should not have been there to start with since it is a new eclass.

 eclass/xdg.eclass | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index e804d18..2ad0ada 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -15,7 +15,7 @@
 inherit xdg-utils
 
 case "${EAPI:-0}" in
-   0|1|2|3|4|5|6)
+   4|5|6)
EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
;;
*) die "EAPI=${EAPI} is not supported" ;;
@@ -41,22 +41,19 @@ xdg_src_prepare() {
 # Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
 # respectively.
 xdg_pkg_preinst() {
-   has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
-   pushd "${ED}" > /dev/null || die
-
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)
+   done < <(cd "${D}" && 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)
+   done < <(cd "${D}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
 
export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
-   popd > /dev/null || die
 }
 
 # @FUNCTION: xdg_pkg_postinst



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: fa737de16d4e2a3f7d4723bf3a8e34c6068ef791
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 17:44:17 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 18:49:38 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa737de1

xdg.eclass: use default in EAPI=6 instead of just eapply_user

As suggested by Michał Górny.

 eclass/xdg.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 1813858..26c41c3 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -32,7 +32,7 @@ DEPEND="
 xdg_src_prepare() {
xdg_environment_reset
 
-   has ${EAPI:-0} 6 && eapply_user
+   has ${EAPI:-0} 6 && default
 }
 
 # @FUNCTION: xdg_pkg_preinst



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: 141792aaa5ad65cc5dc72d248e7be4d37ce028bc
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 18:45:59 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 18:49:44 2015 +
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"



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: 0913bfc8d9650ad4eb542ec9a1a30736013224f2
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 17:42:27 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 18:49:37 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0913bfc8

xdg*.eclass: move phase related logic to xdg.eclass

 eclass/xdg-utils.eclass | 32 
 eclass/xdg.eclass   | 34 +++---
 2 files changed, 27 insertions(+), 39 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index d140283..3dc9e8e 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -62,17 +62,6 @@ xdg_environment_reset() {
unset DBUS_SESSION_BUS_ADDRESS
 }
 
-# @FUNCTION: xdg_desktopfiles_savelist
-# @DESCRIPTION:
-# Find the .desktop files about to be installed and save their location
-# in the XDG_ECLASS_DESKTOPFILES environment variable.
-# This function should be called from pkg_preinst.
-xdg_desktopfiles_savelist() {
-   pushd "${D}" > /dev/null || die
-   export XDG_ECLASS_DESKTOPFILES=$(find 'usr/share/applications' -type f 
2> /dev/null)
-   popd > /dev/null || die
-}
-
 # @FUNCTION: fdo-xdg_desktop_database_update
 # @DESCRIPTION:
 # Updates the .desktop files database.
@@ -85,27 +74,11 @@ xdg_desktop_database_update() {
return
fi
 
-   if [[ -z "${XDG_ECLASS_DESKTOPFILES}" ]]; then
-   debug-print "No .desktop files to add to database"
-   return
-   fi
-
ebegin "Updating .desktop files database ..."
"${updater}" -q "${EROOT}${DESKTOP_DATABASE_DIR}"
eend $?
 }
 
-# @FUNCTION: xdg_mimeinfo_savelist
-# @DESCRIPTION:
-# Find the mime information files about to be installed and save their location
-# in the XDG_ECLASS_MIMEINFOFILES environment variable.
-# This function should be called from pkg_preinst.
-xdg_mimeinfo_savelist() {
-   pushd "${D}" > /dev/null || die
-   export XDG_ECLASS_MIMEINFOFILES=$(find 'usr/share/mime' -type f 2> 
/dev/null)
-   popd > /dev/null || die
-}
-
 # @FUNCTION: xdg_mimeinfo_database_update
 # @DESCRIPTION:
 # Update the mime database.
@@ -118,11 +91,6 @@ xdg_mimeinfo_database_update() {
return
fi
 
-   if [[ -z "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
-   debug-print "No mime info files to add to database"
-   return
-   fi
-
ebegin "Updating shared mime info database ..."
"${updater}" "${EROOT}${MIMEINFO_DATABASE_DIR}"
eend $?

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 799d6a2..1813858 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -37,25 +37,45 @@ xdg_src_prepare() {
 
 # @FUNCTION: xdg_pkg_preinst
 # @DESCRIPTION:
-# Finds .desktop and mime info files for later handling in pkg_postinst
+# Finds .desktop and mime info files for later handling in pkg_postinst.
+# Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
+# respectively.
 xdg_pkg_preinst() {
-   xdg_desktopfiles_savelist
-   xdg_mimeinfo_savelist
+   export XDG_ECLASS_DESKTOPFILES=( $(cd "${D}" && find 
'usr/share/applications' -type f -print0 2> /dev/null) )
+   export XDG_ECLASS_MIMEINFOFILES=( $(cd "${D}" && find 'usr/share/mime' 
-type f -print0 2> /dev/null) )
 }
 
 # @FUNCTION: xdg_pkg_postinst
 # @DESCRIPTION:
 # Handle desktop and mime info database updates.
 xdg_pkg_postinst() {
-   xdg_desktop_database_update
-   xdg_mimeinfo_database_update
+   if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
+   xdg_desktop_database_update
+   else
+   debug-print "No .desktop files to add to database"
+   fi
+
+   if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
+   xdg_mimeinfo_database_update
+   else
+   debug-print "No mime info files to add to database"
+   fi
 }
 
 # @FUNCTION: xdg_pkg_postrm
 # @DESCRIPTION:
 # Handle desktop and mime info database updates.
 xdg_pkg_postrm() {
-   xdg_desktop_database_update
-   xdg_mimeinfo_database_update
+   if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
+   xdg_desktop_database_update
+   else
+   debug-print "No .desktop files to add to database"
+   fi
+
+   if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
+   xdg_mimeinfo_database_update
+   else
+   debug-print "No mime info files to add to database"
+   fi
 }
 



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: 95dc41708048bcec2680a28eecb874a12ca49fa6
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 18:22:39 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 18:49:42 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95dc4170

xdg-utils.eclass: drop redundant ...

 eclass/xdg-utils.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 9a16ea3..61d5e9d 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -78,7 +78,7 @@ xdg_desktop_database_update() {
return
fi
 
-   ebegin "Updating .desktop files database ..."
+   ebegin "Updating .desktop files database"
"${updater}" -q "${EROOT}${DESKTOP_DATABASE_DIR}"
eend $?
 }
@@ -99,7 +99,7 @@ xdg_mimeinfo_database_update() {
return
fi
 
-   ebegin "Updating shared mime info database ..."
+   ebegin "Updating shared mime info database"
"${updater}" "${EROOT}${MIMEINFO_DATABASE_DIR}"
eend $?
 }



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: cf86d01bcf9a9d768c62b09812ce3c5f3a2af416
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 17:53:06 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 18:49:41 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf86d01b

xdg*.eclass: add support for EAPI 0, 1 and 2

Until bug #566728 is fixed.

https://bugs.gentoo.org/show_bug.cgi?id=566728

 eclass/xdg-utils.eclass | 2 +-
 eclass/xdg.eclass   | 9 ++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 10c8c42..9a16ea3 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -16,7 +16,7 @@
 #  * XDG mime information database management
 
 case "${EAPI:-0}" in
-   4|5|6) ;;
+   0|1|2|3|4|5|6) ;;
*) die "EAPI=${EAPI} is not supported" ;;
 esac
 

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 26c41c3..1914687 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -15,7 +15,7 @@
 inherit xdg-utils
 
 case "${EAPI:-0}" in
-   4|5|6)
+   0|1|2|3|4|5|6)
EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
;;
*) die "EAPI=${EAPI} is not supported" ;;
@@ -41,8 +41,11 @@ xdg_src_prepare() {
 # Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
 # respectively.
 xdg_pkg_preinst() {
-   export XDG_ECLASS_DESKTOPFILES=( $(cd "${D}" && find 
'usr/share/applications' -type f -print0 2> /dev/null) )
-   export XDG_ECLASS_MIMEINFOFILES=( $(cd "${D}" && find 'usr/share/mime' 
-type f -print0 2> /dev/null) )
+   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) )
+   popd > /dev/null || die
 }
 
 # @FUNCTION: xdg_pkg_postinst



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-24 Thread Gilles Dartiguelongue
commit: 0799fdf5c54ed473a45973eda6d3a63fd33fd7c9
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Tue Nov 24 17:52:06 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Tue Nov 24 18:49:39 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0799fdf5

xdg-utils.eclass: add phase check

 eclass/xdg-utils.eclass | 8 
 1 file changed, 8 insertions(+)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 3dc9e8e..10c8c42 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -69,6 +69,10 @@ xdg_environment_reset() {
 xdg_desktop_database_update() {
local updater="${EROOT}${DESKTOP_DATABASE_UPDATE_BIN}"
 
+   if [[ ${EBUILD_PHASE} != post* ]] ; then
+   die "xdg_desktop_database_update must be used in pkg_post* 
phases."
+   fi
+
if [[ ! -x "${updater}" ]] ; then
debug-print "${updater} is not executable"
return
@@ -86,6 +90,10 @@ xdg_desktop_database_update() {
 xdg_mimeinfo_database_update() {
local updater="${EROOT}${MIMEINFO_DATABASE_UPDATE_BIN}"
 
+   if [[ ${EBUILD_PHASE} != post* ]] ; then
+   die "xdg_mimeinfo_database_update must be used in pkg_post* 
phases."
+   fi
+
if [[ ! -x "${updater}" ]] ; then
debug-print "${updater} is not executable"
return



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-23 Thread Gilles Dartiguelongue
commit: eb01e473ab6b9448dcb1ff670cc7ae7a5706d777
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Mon Nov 23 14:31:54 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Mon Nov 23 14:31:54 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb01e473

xdg-utils.eclass: use $HOME instead of $T

As in original eclass proposition by Mike, mimic default behavior by
using portage HOME which is set to a temporary directory.

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

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index d62b27d..d140283 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -49,9 +49,9 @@ esac
 # Clean up environment for clean builds.
 xdg_environment_reset() {
# Prepare XDG base directories
-   export XDG_DATA_HOME="${T}/.local/share"
-   export XDG_CONFIG_HOME="${T}/.config"
-   export XDG_CACHE_HOME="${T}/.cache"
+   export XDG_DATA_HOME="${HOME}/.local/share"
+   export XDG_CONFIG_HOME="${HOME}/.config"
+   export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_RUNTIME_DIR="${T}/run"
mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" \
"${XDG_RUNTIME_DIR}" || die



[gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/

2015-11-23 Thread Gilles Dartiguelongue
commit: de0589383f6b9b67d7d533c8f5bd228ebc0c69d9
Author: Gilles Dartiguelongue  gentoo  org>
AuthorDate: Mon Nov 23 14:23:34 2015 +
Commit: Gilles Dartiguelongue  gentoo  org>
CommitDate: Mon Nov 23 14:23:34 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de058938

xdg-utils.eclass: add missing die

 eclass/xdg-utils.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 0e182c8..d62b27d 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -54,10 +54,10 @@ xdg_environment_reset() {
export XDG_CACHE_HOME="${T}/.cache"
export XDG_RUNTIME_DIR="${T}/run"
mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" \
-   "${XDG_RUNTIME_DIR}"
+   "${XDG_RUNTIME_DIR}" || die
# This directory needs to be owned by the user, and chmod 0700
# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
-   chmod 0700 "${XDG_RUNTIME_DIR}"
+   chmod 0700 "${XDG_RUNTIME_DIR}" || die
 
unset DBUS_SESSION_BUS_ADDRESS
 }