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

Diff of /eclass/eutils.eclass

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

Revision 1.83 Revision 1.97
1# Copyright 1999-2004 Gentoo Technologies, Inc. 1# Copyright 1999-2004 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.83 2004/02/27 20:39:19 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.97 2004/08/31 09:05:24 lv 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.
13INHERITED="$INHERITED $ECLASS" 13INHERITED="$INHERITED $ECLASS"
14 14
15DEPEND="!bootstrap? ( sys-devel/patch )" 15DEPEND="!bootstrap? ( sys-devel/patch )"
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass" 17DESCRIPTION="Based on the ${ECLASS} eclass"
18
19# This function simply returns the desired lib directory. With portage
20# 2.0.51, we now have support for installing libraries to lib32/lib64
21# to accomidate the needs of multilib systems. It's no longer a good idea
22# to assume all libraries will end up in lib. Replace any (sane) instances
23# where lib is named directly with $(get_libdir) if possible.
24#
25# Travis Tilley <lv@gentoo.org> (24 Aug 2004)
26get_libdir() {
27 if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then
28 # if there is an override, we want to use that... always.
29 CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}"
30 elif portageq has_version / '<sys-apps/portage-2.0.51_pre20' ; then
31 # and if there isnt an override, and we're using a version of
32 # portage without CONF_LIBDIR support, force the use of lib. dolib
33 # and friends from portage 2.0.50 wont be too happy otherwise.
34 CONF_LIBDIR="lib"
35 fi
36 # and of course, default to lib if CONF_LIBDIR isnt set
37 echo ${CONF_LIBDIR:=lib}
38}
39
40# Sometimes you need to override the value returned by get_libdir. A good
41# example of this is xorg-x11, where lib32 isnt a supported configuration,
42# and where lib64 -must- be used on amd64 (for applications that need lib
43# to be 32bit, such as adobe acrobat). Note that this override also bypasses
44# portage version sanity checking.
45# get_libdir_override expects one argument, the result get_libdir should
46# return:
47#
48# get_libdir_override lib64
49#
50# Travis Tilley <lv@gentoo.org> (31 Aug 2004)
51get_libdir_override() {
52 CONF_LIBDIR="$1"
53 CONF_LIBDIR_OVERRIDE="$1"
54}
18 55
19# This function generate linker scripts in /usr/lib for dynamic 56# This function generate linker scripts in /usr/lib for dynamic
20# libs in /lib. This is to fix linking problems when you have 57# libs in /lib. This is to fix linking problems when you have
21# the .so in /lib, and the .a in /usr/lib. What happens is that 58# the .so in /lib, and the .a in /usr/lib. What happens is that
22# in some cases when linking dynamic, the .a in /usr/lib is used 59# in some cases when linking dynamic, the .a in /usr/lib is used
33# to point to the latest version of the library present. 70# to point to the latest version of the library present.
34# 71#
35# <azarah@gentoo.org> (26 Oct 2002) 72# <azarah@gentoo.org> (26 Oct 2002)
36# 73#
37gen_usr_ldscript() { 74gen_usr_ldscript() {
38
39 # Just make sure it exists 75 # Just make sure it exists
40 dodir /usr/lib 76 dodir /usr/$(get_libdir)
41 77
42 cat > ${D}/usr/lib/$1 <<"END_LDSCRIPT" 78 cat > ${D}/usr/$(get_libdir)/$1 <<"END_LDSCRIPT"
43/* GNU ld script 79/* GNU ld script
44 Because Gentoo have critical dynamic libraries 80 Because Gentoo have critical dynamic libraries
45 in /lib, and the static versions in /usr/lib, we 81 in /lib, and the static versions in /usr/lib, we
46 need to have a "fake" dynamic lib in /usr/lib, 82 need to have a "fake" dynamic lib in /usr/lib,
47 otherwise we run into linking problems. 83 otherwise we run into linking problems.
48 See bug #4411 on http://bugs.gentoo.org/ for 84 See bug #4411 on http://bugs.gentoo.org/ for
49 more info. */ 85 more info. */
50GROUP ( /lib/libxxx )
51END_LDSCRIPT 86END_LDSCRIPT
52 87
88 echo "GROUP ( /$(get_libdir)/libxxx )" >> ${D}/usr/$(get_libdir)/$1
53 dosed "s:libxxx:$1:" /usr/lib/$1 89 dosed "s:libxxx:$1:" /usr/$(get_libdir)/$1
54 90
55 return 0 91 return 0
56} 92}
57 93
58# Simple function to draw a line consisting of '=' the same length as $* 94# Simple function to draw a line consisting of '=' the same length as $*
144 local SINGLE_PATCH="no" 180 local SINGLE_PATCH="no"
145 local x="" 181 local x=""
146 182
147 if [ "$#" -gt 1 ] 183 if [ "$#" -gt 1 ]
148 then 184 then
149 eerror "Invalid arguments to epatch()" 185 local m=""
150 die "Invalid arguments to epatch()" 186 einfo "${#} patches to apply..."
187 for m in "$@" ; do
188 epatch "${m}"
189 done
190 return 0
151 fi 191 fi
152 192
153 if [ -n "$1" -a -f "$1" ] 193 if [ -n "$1" -a -f "$1" ]
154 then 194 then
155 SINGLE_PATCH="yes" 195 SINGLE_PATCH="yes"
258 else 298 else
259 PATCH_TARGET="${x}" 299 PATCH_TARGET="${x}"
260 fi 300 fi
261 301
262 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 302 echo -n "PATCH COMMAND: " >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}
263 echo "patch ${popts} -p${count} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 303 echo "patch -p${count} ${popts} < ${PATCH_TARGET}" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}
264 304
265 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 305 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}
266 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 306 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}
267 307
268 if [ "${PATCH_SUFFIX}" != "patch" ] 308 if [ "${PATCH_SUFFIX}" != "patch" ]
275 count=5 315 count=5
276 break 316 break
277 fi 317 fi
278 fi 318 fi
279 319
280 if (cat ${PATCH_TARGET} | patch ${popts} --dry-run -f -p${count}) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1 320 if (cat ${PATCH_TARGET} | patch -p${count} ${popts} --dry-run -f) >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 2>&1
281 then 321 then
282 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 322 draw_line "***** ${x##*/} *****" > ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real
283 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 323 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real
284 echo "ACTUALLY APPLYING ${x##*/}..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 324 echo "ACTUALLY APPLYING ${x##*/}..." >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real
285 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 325 echo >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real
286 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 326 draw_line "***** ${x##*/} *****" >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real
287 327
288 cat ${PATCH_TARGET} | patch ${popts} -p${count} >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 2>&1 328 cat ${PATCH_TARGET} | patch -p${count} ${popts} >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real 2>&1
289 329
290 if [ "$?" -ne 0 ] 330 if [ "$?" -ne 0 ]
291 then 331 then
292 cat ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/} 332 cat ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}.real >> ${STDERR_TARGET%/*}/${x##*/}-${STDERR_TARGET##*/}
293 echo 333 echo
431 then 471 then
432 jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))" 472 jobs="$((`grep -c ^processor /proc/cpuinfo` * 2))"
433 else 473 else
434 jobs=2 474 jobs=2
435 fi 475 fi
476 elif [ "${ARCH}" = "s390" ]
477 then
478 # s390 has "# processors : "
479 jobs="$((`grep "^\# processors" /proc/cpuinfo | sed -e "s/^.*: //"` * 2))"
436 else 480 else
437 jobs="$((`grep -c ^cpu /proc/cpuinfo` * 2))" 481 jobs="$((`grep -c ^cpu /proc/cpuinfo` * 2))"
438 die "Unknown ARCH -- ${ARCH}!" 482 die "Unknown ARCH -- ${ARCH}!"
439 fi 483 fi
440 484
471 mktemp -p ${topdir} 515 mktemp -p ${topdir}
472 else 516 else
473 local tmp="${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}" 517 local tmp="${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}"
474 touch ${tmp} 518 touch ${tmp}
475 echo ${tmp} 519 echo ${tmp}
520 fi
521}
522
523# Small wrapper for getent (Linux) and nidump (Mac OS X)
524# used in enewuser()/enewgroup()
525# Joe Jezak <josejx@gmail.com> and usata@gentoo.org
526#
527# egetent(database, key)
528egetent() {
529 if [ "${ARCH}" == "macos" ] ; then
530 case "$2" in
531 *[!0-9]*) # Non numeric
532 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
533 ;;
534 *) # Numeric
535 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
536 ;;
537 esac
538 else
539 getent $1 $2
476 fi 540 fi
477} 541}
478 542
479# Simplify/standardize adding users to the system 543# Simplify/standardize adding users to the system
480# vapier@gentoo.org 544# vapier@gentoo.org
496 then 560 then
497 eerror "No username specified !" 561 eerror "No username specified !"
498 die "Cannot call enewuser without a username" 562 die "Cannot call enewuser without a username"
499 fi 563 fi
500 564
501 # setup a file for testing usernames/groups
502 local tmpfile="`mymktemp ${T}`"
503 chown ${euser} ${tmpfile} >& /dev/null
504 local realuser="`ls -l ${tmpfile} | awk '{print $3}'`"
505
506 # see if user already exists 565 # lets see if the username already exists
507 if [ "${euser}" == "${realuser}" ] 566 if [ "${euser}" == "`egetent passwd \"${euser}\" | cut -d: -f1`" ]
508 then 567 then
509 return 0 568 return 0
510 fi 569 fi
511 einfo "Adding user '${euser}' to your system ..." 570 einfo "Adding user '${euser}' to your system ..."
512 571
517 local euid="$1"; shift 576 local euid="$1"; shift
518 if [ ! -z "${euid}" ] && [ "${euid}" != "-1" ] 577 if [ ! -z "${euid}" ] && [ "${euid}" != "-1" ]
519 then 578 then
520 if [ "${euid}" -gt 0 ] 579 if [ "${euid}" -gt 0 ]
521 then 580 then
522 chown ${euid} ${tmpfile} >& /dev/null 581 if [ ! -z "`egetent passwd ${euid}`" ]
523 realuser="`ls -l ${tmpfile} | awk '{print $3}'`"
524 if [ "${realuser//[0-9]}" != "" ]
525 then 582 then
526 euid="uid is taken; using next available" 583 euid="next"
527 else
528 opts="${opts} -u ${euid}"
529 fi 584 fi
530 else 585 else
531 eerror "Userid given but is not greater than 0 !" 586 eerror "Userid given but is not greater than 0 !"
532 die "${euid} is not a valid UID" 587 die "${euid} is not a valid UID"
533 fi 588 fi
534 else 589 else
535 euid="next available" 590 euid="next"
591 fi
592 if [ "${euid}" == "next" ]
593 then
594 local pwrange
595 if [ "${ARCH}" == "macos" ] ; then
596 pwrange="`jot 898 101`"
597 else
598 pwrange="`seq 101 999`"
536 fi 599 fi
600 for euid in ${pwrange} ; do
601 [ -z "`egetent passwd ${euid}`" ] && break
602 done
603 fi
604 opts="${opts} -u ${euid}"
537 einfo " - Userid: ${euid}" 605 einfo " - Userid: ${euid}"
538 606
539 # handle shell 607 # handle shell
540 local eshell="$1"; shift 608 local eshell="$1"; shift
541 if [ ! -z "${eshell}" ] && [ "${eshell}" != "-1" ] 609 if [ ! -z "${eshell}" ] && [ "${eshell}" != "-1" ]
562 630
563 # handle groups 631 # handle groups
564 local egroups="$1"; shift 632 local egroups="$1"; shift
565 if [ ! -z "${egroups}" ] 633 if [ ! -z "${egroups}" ]
566 then 634 then
567 local realgroup=
568 local oldifs="${IFS}" 635 local oldifs="${IFS}"
569 export IFS="," 636 export IFS=","
570 for g in ${egroups} 637 for g in ${egroups}
571 do 638 do
572 chgrp ${g} ${tmpfile} >& /dev/null 639 if [ -z "`egetent group \"${g}\"`" ]
573 realgroup="`ls -l ${tmpfile} | awk '{print $4}'`"
574 if [ "${g}" != "${realgroup}" ]
575 then 640 then
576 eerror "You must add ${g} to the system first" 641 eerror "You must add group ${g} to the system first"
577 die "${g} is not a valid GID" 642 die "${g} is not a valid GID"
578 fi 643 fi
579 done 644 done
580 export IFS="${oldifs}" 645 export IFS="${oldifs}"
581 opts="${opts} -g ${egroups}" 646 opts="${opts} -g ${egroups}"
586 651
587 # handle extra and add the user 652 # handle extra and add the user
588 local eextra="$@" 653 local eextra="$@"
589 local oldsandbox="${SANDBOX_ON}" 654 local oldsandbox="${SANDBOX_ON}"
590 export SANDBOX_ON="0" 655 export SANDBOX_ON="0"
656 if [ "${ARCH}" == "macos" ];
657 then
658 ### Make the user
591 if [ -z "${eextra}" ] 659 if [ -z "${eextra}" ]
592 then 660 then
661 dscl . create /users/${euser} uid ${euid}
662 dscl . create /users/${euser} shell ${eshell}
663 dscl . create /users/${euser} home ${ehome}
664 dscl . create /users/${euser} realname "added by portage for ${PN}"
665 ### Add the user to the groups specified
666 for g in ${egroups}
667 do
668 dscl . merge /groups/${g} users ${euser}
669 done
670 else
671 einfo "Extra options are not supported on macos yet"
672 einfo "Please report the ebuild along with the info below"
673 einfo "eextra: ${eextra}"
674 die "Required function missing"
675 fi
676 else
677 if [ -z "${eextra}" ]
678 then
593 useradd ${opts} ${euser} \ 679 useradd ${opts} ${euser} \
594 -c "added by portage for ${PN}" \ 680 -c "added by portage for ${PN}" \
595 || die "enewuser failed" 681 || die "enewuser failed"
596 else 682 else
597 einfo " - Extra: ${eextra}" 683 einfo " - Extra: ${eextra}"
598 useradd ${opts} ${euser} ${eextra} \ 684 useradd ${opts} ${euser} ${eextra} \
599 || die "enewuser failed" 685 || die "enewuser failed"
686 fi
600 fi 687 fi
601 export SANDBOX_ON="${oldsandbox}" 688 export SANDBOX_ON="${oldsandbox}"
602 689
603 if [ ! -e "${ehome}" ] && [ ! -e "${D}/${ehome}" ] 690 if [ ! -e "${ehome}" ] && [ ! -e "${D}/${ehome}" ]
604 then 691 then
625 then 712 then
626 eerror "No group specified !" 713 eerror "No group specified !"
627 die "Cannot call enewgroup without a group" 714 die "Cannot call enewgroup without a group"
628 fi 715 fi
629 716
630 # setup a file for testing groupname
631 local tmpfile="`mymktemp ${T}`"
632 chgrp ${egroup} ${tmpfile} >& /dev/null
633 local realgroup="`ls -l ${tmpfile} | awk '{print $4}'`"
634
635 # see if group already exists 717 # see if group already exists
636 if [ "${egroup}" == "${realgroup}" ] 718 if [ "${egroup}" == "`egetent group \"${egroup}\" | cut -d: -f1`" ]
637 then 719 then
638 return 0 720 return 0
639 fi 721 fi
640 einfo "Adding group '${egroup}' to your system ..." 722 einfo "Adding group '${egroup}' to your system ..."
641 723
646 local egid="$1"; shift 728 local egid="$1"; shift
647 if [ ! -z "${egid}" ] 729 if [ ! -z "${egid}" ]
648 then 730 then
649 if [ "${egid}" -gt 0 ] 731 if [ "${egid}" -gt 0 ]
650 then 732 then
651 chgrp ${egid} ${tmpfile} >& /dev/null 733 if [ -z "`egetent group ${egid}`" ]
652 realuser="`ls -l ${tmpfile} | awk '{print $3}'`"
653 if [ "${realuser//[0-9]}" != "" ]
654 then 734 then
655 euid="gid is taken; using next available" 735 if [ "${ARCH}" == "macos" ] ; then
736 opts="${opts} ${egid}"
737 else
738 opts="${opts} -g ${egid}"
739 fi
656 else 740 else
657 opts="${opts} -g ${egid}" 741 egid="next available; requested gid taken"
658 fi 742 fi
659 else 743 else
660 eerror "Groupid given but is not greater than 0 !" 744 eerror "Groupid given but is not greater than 0 !"
661 die "${egid} is not a valid GID" 745 die "${egid} is not a valid GID"
662 fi 746 fi
670 opts="${opts} ${eextra}" 754 opts="${opts} ${eextra}"
671 755
672 # add the group 756 # add the group
673 local oldsandbox="${SANDBOX_ON}" 757 local oldsandbox="${SANDBOX_ON}"
674 export SANDBOX_ON="0" 758 export SANDBOX_ON="0"
759 if [ "${ARCH}" == "macos" ];
760 then
761 if [ ! -z "${eextra}" ];
762 then
763 einfo "Extra options are not supported on macos yet"
764 einfo "Please report the ebuild along with the info below"
765 einfo "eextra: ${eextra}"
766 die "Required function missing"
767 fi
768
769 # If we need the next available
770 case ${egid} in
771 *[!0-9]*) # Non numeric
772 for egid in `jot 898 101`; do
773 [ -z "`egetent group ${egid}`" ] && break
774 done
775 esac
776 dscl . create /groups/${egroup} gid ${egid}
777 dscl . create /groups/${egroup} passwd '*'
778 else
675 groupadd ${opts} ${egroup} || die "enewgroup failed" 779 groupadd ${opts} ${egroup} || die "enewgroup failed"
780 fi
676 export SANDBOX_ON="${oldsandbox}" 781 export SANDBOX_ON="${oldsandbox}"
677} 782}
678 783
679# Simple script to replace 'dos2unix' binaries 784# Simple script to replace 'dos2unix' binaries
680# vapier@gentoo.org 785# vapier@gentoo.org
701# name: the name that will show up in the menu 806# name: the name that will show up in the menu
702# icon: give your little like a pretty little icon ... 807# icon: give your little like a pretty little icon ...
703# this can be relative (to /usr/share/pixmaps) or 808# this can be relative (to /usr/share/pixmaps) or
704# a full path to an icon 809# a full path to an icon
705# type: what kind of application is this ? for categories: 810# type: what kind of application is this ? for categories:
706# http://www.freedesktop.org/standards/menu/draft/menu-spec/menu-spec.html 811# http://www.freedesktop.org/standards/menu-spec/
707# path: if your app needs to startup in a specific dir 812# path: if your app needs to startup in a specific dir
708make_desktop_entry() { 813make_desktop_entry() {
709 [ -z "$1" ] && eerror "You must specify the executable" && return 1 814 [ -z "$1" ] && eerror "You must specify the executable" && return 1
710 815
711 local exec="${1}" 816 local exec="${1}"
717 if [ -z "${type}" ] 822 if [ -z "${type}" ]
718 then 823 then
719 case ${CATEGORY} in 824 case ${CATEGORY} in
720 "app-emulation") 825 "app-emulation")
721 type=Emulator 826 type=Emulator
722 subdir="Games" 827 subdir="Emulation"
723 ;; 828 ;;
724 "games-"*) 829 "games-"*)
725 type=Game 830 type=Game
726 subdir="Games" 831 subdir="Games"
727 ;; 832 ;;
951 tail -n +${skip} ${src} | bzip2 -dc | tar --no-same-owner -xf - 1056 tail -n +${skip} ${src} | bzip2 -dc | tar --no-same-owner -xf -
952 ;; 1057 ;;
953 gzip*) 1058 gzip*)
954 tail -n +${skip} ${src} | tar --no-same-owner -xzf - 1059 tail -n +${skip} ${src} | tar --no-same-owner -xzf -
955 ;; 1060 ;;
1061 compress*)
1062 tail -n +${skip} ${src} | gunzip | tar --no-same-owner -xf -
1063 ;;
956 *) 1064 *)
1065 eerror "Unknown filetype \"${filetype}\" ?"
957 false 1066 false
958 ;; 1067 ;;
959 esac 1068 esac
960 assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})" 1069 assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})"
961} 1070}
1181 einfo "or hit CTRL+C to abort the emerge." 1290 einfo "or hit CTRL+C to abort the emerge."
1182 read 1291 read
1183 fi 1292 fi
1184 done 1293 done
1185} 1294}
1295
1296# Make sure that LINGUAS only contains languages that
1297# a package can support
1298#
1299# usage: strip-linguas <allow LINGUAS>
1300# strip-linguas -i <directories of .po files>
1301# strip-linguas -u <directories of .po files>
1302#
1303# The first form allows you to specify a list of LINGUAS.
1304# The -i builds a list of po files found in all the
1305# directories and uses the intersection of the lists.
1306# The -u builds a list of po files found in all the
1307# directories and uses the union of the lists.
1308strip-linguas() {
1309 local ls newls
1310 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then
1311 local op="$1"; shift
1312 ls=" $(find "$1" -name '*.po' -printf '%f ') "; shift
1313 local d f
1314 for d in "$@" ; do
1315 if [ "${op}" == "-u" ] ; then
1316 newls="${ls}"
1317 else
1318 newls=""
1319 fi
1320 for f in $(find "$d" -name '*.po' -printf '%f ') ; do
1321 if [ "${op}" == "-i" ] ; then
1322 [ "${ls/ ${f} /}" != "${ls}" ] && newls="${newls} ${f}"
1323 else
1324 [ "${ls/ ${f} /}" == "${ls}" ] && newls="${newls} ${f}"
1325 fi
1326 done
1327 ls="${newls}"
1328 done
1329 ls="${ls//.po}"
1330 else
1331 ls="$@"
1332 fi
1333
1334 ls=" ${ls} "
1335 newls=""
1336 for f in ${LINGUAS} ; do
1337 if [ "${ls/ ${f} /}" != "${ls}" ] ; then
1338 nl="${newls} ${f}"
1339 else
1340 ewarn "Sorry, but ${PN} does not support the ${f} LINGUA"
1341 fi
1342 done
1343 if [ -z "${newls}" ] ; then
1344 unset LINGUAS
1345 else
1346 export LINGUAS="${newls}"
1347 fi
1348}

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.97

  ViewVC Help
Powered by ViewVC 1.1.20