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

Diff of /eclass/eutils.eclass

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

Revision 1.50 Revision 1.54
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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.50 2003/09/05 16:42:45 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.54 2003/09/17 16:53:46 avenj 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.
10# NB: If you add anything, please comment it! 10# NB: If you add anything, please comment it!
11 11
12ECLASS=eutils 12ECLASS=eutils
13INHERITED="$INHERITED $ECLASS" 13INHERITED="$INHERITED $ECLASS"
14 14
15DEPEND="$DEPEND !bootstrap? ( sys-devel/patch )" 15newdepend "!bootstrap? ( sys-devel/patch )"
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass" 17DESCRIPTION="Based on the ${ECLASS} eclass"
18 18
19# This function generate linker scripts in /usr/lib for dynamic 19# This function generate linker scripts in /usr/lib for dynamic
20# libs in /lib. This is to fix linking problems when you have 20# libs in /lib. This is to fix linking problems when you have
401 fi 401 fi
402 402
403 export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`" 403 export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`"
404 404
405 if [ "${ARCH}" = "amd64" -o "${ARCH}" = "x86" -o "${ARCH}" = "hppa" -o \ 405 if [ "${ARCH}" = "amd64" -o "${ARCH}" = "x86" -o "${ARCH}" = "hppa" -o \
406 "${ARCH}" = "arm" -o "${ARCH}" = "mips" ] 406 "${ARCH}" = "arm" -o "${ARCH}" = "mips" -o "${ARCH}" = "ia64" ]
407 then 407 then
408 # these archs will always have "[Pp]rocessor" 408 # these archs will always have "[Pp]rocessor"
409 jobs="$((`grep -c ^[Pp]rocessor /proc/cpuinfo` * 2))" 409 jobs="$((`grep -c ^[Pp]rocessor /proc/cpuinfo` * 2))"
410 410
411 elif [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ] 411 elif [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ]
451 export MAKEOPTS="${MAKEOPTS} -j${ADMINPARAM}" 451 export MAKEOPTS="${MAKEOPTS} -j${ADMINPARAM}"
452 else 452 else
453 einfo "Setting make jobs to \"-j${jobs}\" to ensure successful merge..." 453 einfo "Setting make jobs to \"-j${jobs}\" to ensure successful merge..."
454 export MAKEOPTS="${MAKEOPTS} -j${jobs}" 454 export MAKEOPTS="${MAKEOPTS} -j${jobs}"
455 fi 455 fi
456 fi
457}
458
459# Cheap replacement for when debianutils (and thus mktemp)
460# do not exist on the users system
461# vapier@gentoo.org
462#
463# Takes just 1 parameter (the directory to create tmpfile in)
464mymktemp() {
465 local topdir=$1
466 [ -z "${topdir}" ] && topdir=/tmp
467 if [ `which mktemp 2>/dev/null` ] ; then
468 mktemp -p ${topdir}
469 else
470 local tmp="${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}"
471 touch ${tmp}
472 echo ${tmp}
456 fi 473 fi
457} 474}
458 475
459# Simplify/standardize adding users to the system 476# Simplify/standardize adding users to the system
460# vapier@gentoo.org 477# vapier@gentoo.org
476 eerror "No username specified !" 493 eerror "No username specified !"
477 die "Cannot call enewuser without a username" 494 die "Cannot call enewuser without a username"
478 fi 495 fi
479 496
480 # setup a file for testing usernames/groups 497 # setup a file for testing usernames/groups
481 local tmpfile="`mktemp -p ${T}`" 498 local tmpfile="`mymktemp ${T}`"
482 touch ${tmpfile}
483 chown ${euser} ${tmpfile} >& /dev/null 499 chown ${euser} ${tmpfile} >& /dev/null
484 local realuser="`ls -l ${tmpfile} | awk '{print $3}'`" 500 local realuser="`ls -l ${tmpfile} | awk '{print $3}'`"
485 501
486 # see if user already exists 502 # see if user already exists
487 if [ "${euser}" == "${realuser}" ] ; then 503 if [ "${euser}" == "${realuser}" ] ; then
587 eerror "No group specified !" 603 eerror "No group specified !"
588 die "Cannot call enewgroup without a group" 604 die "Cannot call enewgroup without a group"
589 fi 605 fi
590 606
591 # setup a file for testing groupname 607 # setup a file for testing groupname
592 local tmpfile="`mktemp -p ${T}`" 608 local tmpfile="`mymktemp ${T}`"
593 touch ${tmpfile}
594 chgrp ${egroup} ${tmpfile} >& /dev/null 609 chgrp ${egroup} ${tmpfile} >& /dev/null
595 local realgroup="`ls -l ${tmpfile} | awk '{print $4}'`" 610 local realgroup="`ls -l ${tmpfile} | awk '{print $4}'`"
596 611
597 # see if group already exists 612 # see if group already exists
598 if [ "${egroup}" == "${realgroup}" ] ; then 613 if [ "${egroup}" == "${realgroup}" ] ; then
665 local type=${4} 680 local type=${4}
666 local path=${5:-${GAMES_PREFIX}} 681 local path=${5:-${GAMES_PREFIX}}
667 if [ -z "${type}" ] ; then 682 if [ -z "${type}" ] ; then
668 case ${CATEGORY} in 683 case ${CATEGORY} in
669 app-emulation) type=Emulator ;; 684 app-emulation) type=Emulator ;;
670 app-games) type=Game ;; 685 games-*) type=Game ;;
671 *) type="" ;; 686 *) type="" ;;
672 esac 687 esac
673 fi 688 fi
674 local desktop=${T}/${exec}.desktop 689 local desktop=${T}/${exec}.desktop
675 690

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.20