| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2006 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.275 2007/02/17 00:17:39 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.277 2007/04/06 11:43:30 carlo Exp $ |
| 4 | # |
4 | # |
| 5 | # This eclass is for general purpose functions that most ebuilds |
5 | # This eclass is for general purpose functions that most ebuilds |
| 6 | # have to implement themselves. |
6 | # have to implement themselves. |
| 7 | # |
7 | # |
| 8 | # NB: If you add anything, please comment it! |
8 | # NB: If you add anything, please comment it! |
| … | |
… | |
| 916 | # doesn't corrupt the env of the caller |
916 | # doesn't corrupt the env of the caller |
| 917 | insinto /usr/share/applications |
917 | insinto /usr/share/applications |
| 918 | doins "${desktop}" |
918 | doins "${desktop}" |
| 919 | ) |
919 | ) |
| 920 | } |
920 | } |
|
|
921 | |
|
|
922 | |
|
|
923 | # Validatedesktop entries using desktop-file-utils |
|
|
924 | # Carsten Lohrke <carlo@gentoo.org> |
|
|
925 | # |
|
|
926 | # Usage: validate_desktop_entries [directory ...] |
|
|
927 | |
|
|
928 | validate_desktop_entries() { |
|
|
929 | if [[ -x /usr/bin/desktop-file-validate ]] ; then |
|
|
930 | einfo "Checking desktop entry validity" |
|
|
931 | local directories="" |
|
|
932 | for d in $@ ; do |
|
|
933 | directories="${directories} ${D}${d}" |
|
|
934 | done |
|
|
935 | for FILE in $(find ${D}/usr/share/applications ${directories} -name "*\.desktop" \ |
|
|
936 | -not -path '*.hidden*' 2>/dev/null) |
|
|
937 | do |
|
|
938 | local temp=$(desktop-file-validate ${FILE} | grep -v "warning:") |
|
|
939 | [[ -n $temp ]] && elog ${temp//${D}/} |
|
|
940 | done |
|
|
941 | echo "" |
|
|
942 | else |
|
|
943 | einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo." |
|
|
944 | fi |
|
|
945 | } |
|
|
946 | |
| 921 | |
947 | |
| 922 | # Make a GDM/KDM Session file |
948 | # Make a GDM/KDM Session file |
| 923 | # |
949 | # |
| 924 | # make_session_desktop(<title>, <command>) |
950 | # make_session_desktop(<title>, <command>) |
| 925 | # title: File to execute to start the Window Manager |
951 | # title: File to execute to start the Window Manager |
| … | |
… | |
| 1581 | # } |
1607 | # } |
| 1582 | |
1608 | |
| 1583 | preserve_old_lib() { |
1609 | preserve_old_lib() { |
| 1584 | if [[ ${EBUILD_PHASE} != "preinst" ]] ; then |
1610 | if [[ ${EBUILD_PHASE} != "preinst" ]] ; then |
| 1585 | eerror "preserve_old_lib() must be called from pkg_preinst() only" |
1611 | eerror "preserve_old_lib() must be called from pkg_preinst() only" |
| 1586 | # die "Invalid preserve_old_lib() usage" |
1612 | die "Invalid preserve_old_lib() usage" |
| 1587 | fi |
1613 | fi |
| 1588 | [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]" |
1614 | [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]" |
| 1589 | |
1615 | |
| 1590 | local lib dir |
1616 | local lib dir |
| 1591 | for lib in "$@" ; do |
1617 | for lib in "$@" ; do |
| … | |
… | |
| 1598 | } |
1624 | } |
| 1599 | |
1625 | |
| 1600 | preserve_old_lib_notify() { |
1626 | preserve_old_lib_notify() { |
| 1601 | if [[ ${EBUILD_PHASE} != "postinst" ]] ; then |
1627 | if [[ ${EBUILD_PHASE} != "postinst" ]] ; then |
| 1602 | eerror "preserve_old_lib_notify() must be called from pkg_postinst() only" |
1628 | eerror "preserve_old_lib_notify() must be called from pkg_postinst() only" |
| 1603 | # die "Invalid preserve_old_lib_notify() usage" |
1629 | die "Invalid preserve_old_lib_notify() usage" |
| 1604 | fi |
1630 | fi |
| 1605 | |
1631 | |
| 1606 | local lib notice=0 |
1632 | local lib notice=0 |
| 1607 | for lib in "$@" ; do |
1633 | for lib in "$@" ; do |
| 1608 | [[ -e ${ROOT}/${lib} ]] || continue |
1634 | [[ -e ${ROOT}/${lib} ]] || continue |