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

Diff of /eclass/eutils.eclass

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

Revision 1.99 Revision 1.100
1# Copyright 1999-2004 Gentoo Foundation 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.99 2004/09/07 11:41:29 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.100 2004/09/12 07:16:45 mr_bones_ 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.
403# This function return true if we are using the NPTL pthreads 403# This function return true if we are using the NPTL pthreads
404# implementation. 404# implementation.
405# 405#
406# <azarah@gentoo.org> (06 March 2003) 406# <azarah@gentoo.org> (06 March 2003)
407# 407#
408
409have_NPTL() { 408have_NPTL() {
410
411 cat > ${T}/test-nptl.c <<-"END" 409 cat > ${T}/test-nptl.c <<-"END"
412 #define _XOPEN_SOURCE 410 #define _XOPEN_SOURCE
413 #include <unistd.h> 411 #include <unistd.h>
414 #include <stdio.h> 412 #include <stdio.h>
415 413
533# vapier@gentoo.org 531# vapier@gentoo.org
534# 532#
535# Takes just 1 parameter (the directory to create tmpfile in) 533# Takes just 1 parameter (the directory to create tmpfile in)
536mymktemp() { 534mymktemp() {
537 local topdir="$1" 535 local topdir="$1"
538 536
539 [ -z "${topdir}" ] && topdir=/tmp 537 [ -z "${topdir}" ] && topdir=/tmp
540 if [ "`which mktemp 2>/dev/null`" ] 538 if [ "`which mktemp 2>/dev/null`" ]
541 then 539 then
542 mktemp -p ${topdir} 540 mktemp -p ${topdir}
543 else 541 else
551# used in enewuser()/enewgroup() 549# used in enewuser()/enewgroup()
552# Joe Jezak <josejx@gmail.com> and usata@gentoo.org 550# Joe Jezak <josejx@gmail.com> and usata@gentoo.org
553# 551#
554# egetent(database, key) 552# egetent(database, key)
555egetent() { 553egetent() {
556 if [ "${ARCH}" == "macos" ] ; then 554 if [ "${ARCH}" == "macos" ] ; then
557 case "$2" in 555 case "$2" in
558 *[!0-9]*) # Non numeric 556 *[!0-9]*) # Non numeric
559 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" 557 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
560 ;; 558 ;;
561 *) # Numeric 559 *) # Numeric
678 676
679 # handle extra and add the user 677 # handle extra and add the user
680 local eextra="$@" 678 local eextra="$@"
681 local oldsandbox="${SANDBOX_ON}" 679 local oldsandbox="${SANDBOX_ON}"
682 export SANDBOX_ON="0" 680 export SANDBOX_ON="0"
683 if [ "${ARCH}" == "macos" ]; 681 if [ "${ARCH}" == "macos" ];
684 then 682 then
685 ### Make the user 683 ### Make the user
686 if [ -z "${eextra}" ] 684 if [ -z "${eextra}" ]
687 then 685 then
688 dscl . create /users/${euser} uid ${euid} 686 dscl . create /users/${euser} uid ${euid}
781 opts="${opts} ${eextra}" 779 opts="${opts} ${eextra}"
782 780
783 # add the group 781 # add the group
784 local oldsandbox="${SANDBOX_ON}" 782 local oldsandbox="${SANDBOX_ON}"
785 export SANDBOX_ON="0" 783 export SANDBOX_ON="0"
786 if [ "${ARCH}" == "macos" ]; 784 if [ "${ARCH}" == "macos" ];
787 then 785 then
788 if [ ! -z "${eextra}" ]; 786 if [ ! -z "${eextra}" ];
789 then 787 then
790 einfo "Extra options are not supported on macos yet" 788 einfo "Extra options are not supported on macos yet"
791 einfo "Please report the ebuild along with the info below" 789 einfo "Please report the ebuild along with the info below"
792 einfo "eextra: ${eextra}" 790 einfo "eextra: ${eextra}"
793 die "Required function missing" 791 die "Required function missing"
794 fi 792 fi
795 793
796 # If we need the next available 794 # If we need the next available
797 case ${egid} in 795 case ${egid} in
798 *[!0-9]*) # Non numeric 796 *[!0-9]*) # Non numeric
799 for egid in `jot 898 101`; do 797 for egid in `jot 898 101`; do
800 [ -z "`egetent group ${egid}`" ] && break 798 [ -z "`egetent group ${egid}`" ] && break
801 done 799 done
802 esac 800 esac
803 dscl . create /groups/${egroup} gid ${egid} 801 dscl . create /groups/${egroup} gid ${egid}
804 dscl . create /groups/${egroup} passwd '*' 802 dscl . create /groups/${egroup} passwd '*'
805 else 803 else
806 groupadd ${opts} ${egroup} || die "enewgroup failed" 804 groupadd ${opts} ${egroup} || die "enewgroup failed"
807 fi 805 fi
808 export SANDBOX_ON="${oldsandbox}" 806 export SANDBOX_ON="${oldsandbox}"
809} 807}
843 local exec="${1}" 841 local exec="${1}"
844 local name="${2:-${PN}}" 842 local name="${2:-${PN}}"
845 local icon="${3:-${PN}.png}" 843 local icon="${3:-${PN}.png}"
846 local type="${4}" 844 local type="${4}"
847 local subdir="${6}" 845 local subdir="${6}"
848 local path="${5:-${GAMES_PREFIX}}" 846 local path="${5:-${GAMES_BINDIR}}"
849 if [ -z "${type}" ] 847 if [ -z "${type}" ]
850 then 848 then
851 case ${CATEGORY} in 849 case ${CATEGORY} in
852 "app-emulation") 850 "app-emulation")
853 type=Emulator 851 type=Emulator
1318 read 1316 read
1319 fi 1317 fi
1320 done 1318 done
1321} 1319}
1322 1320
1323# Make sure that LINGUAS only contains languages that 1321# Make sure that LINGUAS only contains languages that
1324# a package can support 1322# a package can support
1325# 1323#
1326# usage: strip-linguas <allow LINGUAS> 1324# usage: strip-linguas <allow LINGUAS>
1327# strip-linguas -i <directories of .po files> 1325# strip-linguas -i <directories of .po files>
1328# strip-linguas -u <directories of .po files> 1326# strip-linguas -u <directories of .po files>
1329# 1327#
1330# The first form allows you to specify a list of LINGUAS. 1328# The first form allows you to specify a list of LINGUAS.
1331# The -i builds a list of po files found in all the 1329# The -i builds a list of po files found in all the
1332# directories and uses the intersection of the lists. 1330# directories and uses the intersection of the lists.
1333# The -u builds a list of po files found in all the 1331# The -u builds a list of po files found in all the
1334# directories and uses the union of the lists. 1332# directories and uses the union of the lists.
1335strip-linguas() { 1333strip-linguas() {
1336 local ls newls 1334 local ls newls
1337 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then 1335 if [ "$1" == "-i" ] || [ "$1" == "-u" ] ; then
1338 local op="$1"; shift 1336 local op="$1"; shift

Legend:
Removed from v.1.99  
changed lines
  Added in v.1.100

  ViewVC Help
Powered by ViewVC 1.1.20