commit:     e09622cc4d6d804df011c678391e2950de048668
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 24 17:53:06 2015 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Tue Nov 24 21:57:27 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e09622cc

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 ff22b39..61d5e9d 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

Reply via email to