xdg*.eclass: add support for EAPI 0, 1 and 2
authorGilles Dartiguelongue <eva@gentoo.org>
Tue, 24 Nov 2015 17:53:06 +0000 (18:53 +0100)
committerGilles Dartiguelongue <eva@gentoo.org>
Tue, 24 Nov 2015 21:57:27 +0000 (22:57 +0100)
Until bug #566728 is fixed.

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

eclass/xdg-utils.eclass
eclass/xdg.eclass

index ff22b39ce11096c5fff6115cb8dc40d3fcd74cc6..61d5e9d8066dae60f804e40519238688a48732e3 100644 (file)
@@ -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
 
index 26c41c3510715d84d4d5420ef08ddeb0a78be8e7..19146878a6a7718c2a5bd642536bdc9db887590d 100644 (file)
@@ -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