diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-05-05 07:52:26 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-05-05 07:52:26 +0000 |
commit | 84e37eeeb1a8065148b021cdb135ab5e43134f54 (patch) | |
tree | 448ab37feb92befb7cefa0c505e1044710f6aade /eclass/eutils.eclass | |
parent | Add virtual/xft to RDEPEND #175203 by Alexander Wigen. (diff) | |
download | historical-84e37eeeb1a8065148b021cdb135ab5e43134f54.tar.gz historical-84e37eeeb1a8065148b021cdb135ab5e43134f54.tar.bz2 historical-84e37eeeb1a8065148b021cdb135ab5e43134f54.zip |
code from Fabian Groffen to simplify emktemp() for all userlands #174061
Diffstat (limited to 'eclass/eutils.eclass')
-rw-r--r-- | eclass/eutils.eclass | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 25e5ce6a8d1d..547565497029 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.279 2007/04/25 09:14:35 carlo Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.280 2007/05/05 07:52:26 vapier Exp $ # # This eclass is for general purpose functions that most ebuilds # have to implement themselves. @@ -368,7 +368,8 @@ emktemp() { || topdir=${T} fi - if [[ -z $(type -p mktemp) ]] ; then + if ! type -P mktemp > /dev/null ; then + # system lacks `mktemp` so we have to fake it local tmp=/ while [[ -e ${tmp} ]] ; do tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM} @@ -376,14 +377,12 @@ emktemp() { ${exe} "${tmp}" || ${exe} -p "${tmp}" echo "${tmp}" else + # the args here will give slightly wierd names on BSD, + # but should produce a usable file on all userlands if [[ ${exe} == "touch" ]] ; then - [[ ${USERLAND} == "GNU" ]] \ - && mktemp -p "${topdir}" \ - || TMPDIR="${topdir}" mktemp -t tmp + TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX else - [[ ${USERLAND} == "GNU" ]] \ - && mktemp -d "${topdir}" \ - || TMPDIR="${topdir}" mktemp -dt tmp + TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX fi fi } |