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 | 637f88dc4900d364ae0f0691b91daafb5a0c68f8 (patch) | |
tree | ade4b0961abae67d727d6686b6fe3b0ae8504709 /eclass/eutils.eclass | |
parent | Add virtual/xft to RDEPEND #175203 by Alexander Wigen. (diff) | |
download | gentoo-2-637f88dc4900d364ae0f0691b91daafb5a0c68f8.tar.gz gentoo-2-637f88dc4900d364ae0f0691b91daafb5a0c68f8.tar.bz2 gentoo-2-637f88dc4900d364ae0f0691b91daafb5a0c68f8.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 } |