| 1 | # Copyright 1999-2005 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.235 2006/05/24 16:01:59 wolf31o2 Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.236 2006/06/04 13:25:04 vapier Exp $ |
| 4 | # |
|
|
| 5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
|
|
| 6 | # |
4 | # |
| 7 | # This eclass is for general purpose functions that most ebuilds |
5 | # This eclass is for general purpose functions that most ebuilds |
| 8 | # have to implement themselves. |
6 | # have to implement themselves. |
| 9 | # |
7 | # |
| 10 | # NB: If you add anything, please comment it! |
8 | # NB: If you add anything, please comment it! |
| … | |
… | |
| 1441 | # directories and uses the union of the lists. |
1439 | # directories and uses the union of the lists. |
| 1442 | strip-linguas() { |
1440 | strip-linguas() { |
| 1443 | local ls newls |
1441 | local ls newls |
| 1444 | if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then |
1442 | if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then |
| 1445 | local op=$1; shift |
1443 | local op=$1; shift |
| 1446 | ls=" $(find "$1" -name '*.po' -exec basename {} \;) "; shift |
1444 | ls=$(find "$1" -name '*.po' -exec basename {} .po \;); shift |
| 1447 | local d f |
1445 | local d f |
| 1448 | for d in "$@" ; do |
1446 | for d in "$@" ; do |
| 1449 | if [[ ${op} == "-u" ]] ; then |
1447 | if [[ ${op} == "-u" ]] ; then |
| 1450 | newls=${ls} |
1448 | newls=${ls} |
| 1451 | else |
1449 | else |
| 1452 | newls="" |
1450 | newls="" |
| 1453 | fi |
1451 | fi |
| 1454 | for f in $(find "$d" -name '*.po' -exec basename {} \;) ; do |
1452 | for f in $(find "$d" -name '*.po' -exec basename {} .po \;) ; do |
| 1455 | if [[ ${op} == "-i" ]] ; then |
1453 | if [[ ${op} == "-i" ]] ; then |
| 1456 | [[ ${ls/ ${f} /} != ${ls} ]] && newls="${newls} ${f}" |
1454 | hasq ${f} ${ls} && newls="${newls} ${f}" |
| 1457 | else |
1455 | else |
| 1458 | [[ ${ls/ ${f} /} == ${ls} ]] && newls="${newls} ${f}" |
1456 | hasq ${f} ${ls} || newls="${newls} ${f}" |
| 1459 | fi |
1457 | fi |
| 1460 | done |
1458 | done |
| 1461 | ls=${newls} |
1459 | ls=${newls} |
| 1462 | done |
1460 | done |
| 1463 | ls=${ls//.po} |
|
|
| 1464 | else |
1461 | else |
| 1465 | ls=$@ |
1462 | ls="$@" |
| 1466 | fi |
1463 | fi |
| 1467 | |
1464 | |
| 1468 | ls=" ${ls} " |
|
|
| 1469 | newls="" |
1465 | newls="" |
| 1470 | for f in ${LINGUAS} ; do |
1466 | for f in ${LINGUAS} ; do |
| 1471 | if [[ ${ls/ ${f} /} != ${ls} ]] ; then |
1467 | if hasq ${f} ${ls} ; then |
| 1472 | newls="${newls} ${f}" |
1468 | newls="${newls} ${f}" |
| 1473 | else |
1469 | else |
| 1474 | ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" |
1470 | ewarn "Sorry, but ${PN} does not support the ${f} LINGUA" |
| 1475 | fi |
1471 | fi |
| 1476 | done |
1472 | done |