/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.152 Revision 1.157
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2005 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.152 2005/02/18 18:04:42 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.157 2005/03/07 17:45:07 carlo Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
459# Thanks to nall <nall@gentoo.org> for this. 459# Thanks to nall <nall@gentoo.org> for this.
460# 460#
461get_number_of_jobs() { 461get_number_of_jobs() {
462 local jobs=0 462 local jobs=0
463 463
464 return 0
465
466 if [ ! -r /proc/cpuinfo ] 464 if [ ! -r /proc/cpuinfo ]
467 then 465 then
468 return 1 466 return 1
469 fi 467 fi
470 468
911# name: the name that will show up in the menu 909# name: the name that will show up in the menu
912# icon: give your little like a pretty little icon ... 910# icon: give your little like a pretty little icon ...
913# this can be relative (to /usr/share/pixmaps) or 911# this can be relative (to /usr/share/pixmaps) or
914# a full path to an icon 912# a full path to an icon
915# type: what kind of application is this ? for categories: 913# type: what kind of application is this ? for categories:
916# http://www.freedesktop.org/standards/menu-spec/ 914# http://www.freedesktop.org/wiki/Standards_2fmenu_2dspec
917# path: if your app needs to startup in a specific dir 915# path: if your app needs to startup in a specific dir
918make_desktop_entry() { 916make_desktop_entry() {
919 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1 917 [ -z "$1" ] && eerror "make_desktop_entry: You must specify the executable" && return 1
920 918
921 local exec="${1}" 919 local exec="${1}"
943 type= 941 type=
944 subdir= 942 subdir=
945 ;; 943 ;;
946 esac 944 esac
947 fi 945 fi
948 local desktop="${T}/${exec}.desktop" 946 local desktop="${T}/${exec%% *}-${P}.desktop"
949 947
950echo "[Desktop Entry] 948echo "[Desktop Entry]
951Encoding=UTF-8 949Encoding=UTF-8
952Version=0.9.2 950Version=0.9.2
953Name=${name} 951Name=${name}
1481# directories and uses the intersection of the lists. 1479# directories and uses the intersection of the lists.
1482# The -u builds a list of po files found in all the 1480# The -u builds a list of po files found in all the
1483# directories and uses the union of the lists. 1481# directories and uses the union of the lists.
1484strip-linguas() { 1482strip-linguas() {
1485 local ls newls 1483 local ls newls
1486 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1484 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
1487 local op="$1"; shift 1485 local op=$1; shift
1488 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift 1486 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1489 local d f 1487 local d f
1490 for d in "$@" ; do 1488 for d in "$@" ; do
1491 if [ "${op}" == "-u" ] ; then 1489 if [[ ${op} == "-u" ]] ; then
1492 newls="${ls}" 1490 newls=${ls}
1493 else 1491 else
1494 newls="" 1492 newls=""
1495 fi 1493 fi
1496 for f in $(find "$d" -name '*.po' -printf '%f ') ; do 1494 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1497 if [ "${op}" == "-i" ] ; then 1495 if [[ ${op} == "-i" ]] ; then
1498 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}" 1496 [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}"
1499 else 1497 else
1500 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}" 1498 [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}"
1501 fi 1499 fi
1502 done 1500 done
1503 ls="${newls}" 1501 ls=${newls}
1504 done 1502 done
1505 ls="${ls//.po}" 1503 ls=${ls//.po}
1506 else 1504 else
1507 ls="$@" 1505 ls=$@
1508 fi 1506 fi
1509 1507
1510 ls=" ${ls} " 1508 ls=" ${ls} "
1511 newls="" 1509 newls=""
1512 for f in ${LINGUAS} ; do 1510 for f in ${LINGUAS} ; do
1513 if [ "${ls/ ${f} /}" != "${ls}" ] ; then 1511 if [[ ${ls/ ${f} /} != ${ls} ]] ; then
1514 newls="${newls} ${f}" 1512 newls="${newls} ${f}"
1515 else 1513 else
1516 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" 1514 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1517 fi 1515 fi
1518 done 1516 done
1519 if [ -z "${newls}" ] ; then 1517 if [[ -z ${newls} ]] ; then
1520 unset LINGUAS 1518 unset LINGUAS
1521 else 1519 else
1522 export LINGUAS="${newls}" 1520 export LINGUAS=${newls:1}
1523 fi 1521 fi
1524} 1522}
1525 1523
1526# moved from kernel.eclass since they are generally useful outside of 1524# moved from kernel.eclass since they are generally useful outside of
1527# kernel.eclass -iggy (20041002) 1525# kernel.eclass -iggy (20041002)

Legend:
Removed from v.1.152  
changed lines
  Added in v.1.157

  ViewVC Help
Powered by ViewVC 1.1.20