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

Diff of /eclass/eutils.eclass

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

Revision 1.214 Revision 1.215
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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.214 2005/10/26 00:39:12 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.215 2005/10/27 07:28:49 vapier 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.
1252 export CDROM_TOTAL_CDS=${cdcnt} 1252 export CDROM_TOTAL_CDS=${cdcnt}
1253 export CDROM_CURRENT_CD=1 1253 export CDROM_CURRENT_CD=1
1254 1254
1255 # now we see if the user gave use CD_ROOT ... 1255 # now we see if the user gave use CD_ROOT ...
1256 # if they did, let's just believe them that it's correct 1256 # if they did, let's just believe them that it's correct
1257 if [[ ! -z ${CD_ROOT} ]] ; then
1258 export CDROM_ROOT=${CD_ROOT}
1259 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1260 return
1261 fi
1262 # do the same for CD_ROOT_X
1263 if [[ ! -z ${CD_ROOT_1} ]] ; then 1257 if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
1264 local var= 1258 local var=
1265 cdcnt=0 1259 cdcnt=0
1266 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do 1260 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1267 ((++cdcnt)) 1261 ((++cdcnt))
1268 var="CD_ROOT_${cdcnt}" 1262 var="CD_ROOT_${cdcnt}"
1263 [[ -z ${!var} ]] && var="CD_ROOT"
1269 if [[ -z ${!var} ]] ; then 1264 if [[ -z ${!var} ]] ; then
1270 eerror "You must either use just the CD_ROOT" 1265 eerror "You must either use just the CD_ROOT"
1271 eerror "or specify ALL the CD_ROOT_X variables." 1266 eerror "or specify ALL the CD_ROOT_X variables."
1272 eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables." 1267 eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables."
1273 die "could not locate CD_ROOT_${cdcnt}" 1268 die "could not locate CD_ROOT_${cdcnt}"
1274 fi 1269 fi
1275 export CDROM_ROOTS_${cdcnt}="${!var}"
1276 done 1270 done
1277 export CDROM_ROOT=${CDROM_ROOTS_1} 1271 export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
1278 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}" 1272 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1273 export CDROM_SET=-1
1274 for f in ${CDROM_CHECK_1//:/ } ; do
1275 ((++CDROM_SET))
1276 [[ -e ${CD_ROOT}/${f} ]] && break
1277 done
1278 export CDROM_MATCH=${f}
1279 return 1279 return
1280 fi 1280 fi
1281 1281
1282 # User didn't help us out so lets make sure they know they can
1283 # simplify the whole process ...
1282 if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then 1284 if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then
1283 einfon "This ebuild will need the " 1285 einfo "This ebuild will need the ${CDROM_NAME:-cdrom for ${PN}}"
1284 if [[ -z ${CDROM_NAME} ]] ; then
1285 echo "cdrom for ${PN}."
1286 else
1287 echo "${CDROM_NAME}."
1288 fi
1289 echo 1286 echo
1290 einfo "If you do not have the CD, but have the data files" 1287 einfo "If you do not have the CD, but have the data files"
1291 einfo "mounted somewhere on your filesystem, just export" 1288 einfo "mounted somewhere on your filesystem, just export"
1292 einfo "the variable CD_ROOT so that it points to the" 1289 einfo "the variable CD_ROOT so that it points to the"
1293 einfo "directory containing the files." 1290 einfo "directory containing the files."
1321 echo 1318 echo
1322 einfo "For example:" 1319 einfo "For example:"
1323 einfo "export CD_ROOT_1=/mnt/cdrom" 1320 einfo "export CD_ROOT_1=/mnt/cdrom"
1324 echo 1321 echo
1325 fi 1322 fi
1323
1326 export CDROM_SET="" 1324 export CDROM_SET=""
1327 export CDROM_CURRENT_CD=0 1325 export CDROM_CURRENT_CD=0
1328 cdrom_load_next_cd 1326 cdrom_load_next_cd
1329} 1327}
1330 1328
1331# this is only used when you need access to more than one cd. 1329# this is only used when you need access to more than one cd.
1332# when you have finished using the first cd, just call this function. 1330# when you have finished using the first cd, just call this function.
1333# when it returns, CDROM_ROOT will be pointing to the second cd. 1331# when it returns, CDROM_ROOT will be pointing to the second cd.
1334# remember, you can only go forward in the cd chain, you can't go back. 1332# remember, you can only go forward in the cd chain, you can't go back.
1335cdrom_load_next_cd() { 1333cdrom_load_next_cd() {
1336 export CDROM_CURRENT_CD=$((CDROM_CURRENT_CD + 1))
1337 local var= 1334 local var
1338 1335 ((++CDROM_CURRENT_CD))
1339 if [[ ! -z ${CD_ROOT} ]] ; then
1340 einfo "Using same root as before for CD #${CDROM_CURRENT_CD}"
1341 return
1342 fi
1343 1336
1344 unset CDROM_ROOT 1337 unset CDROM_ROOT
1345 var=CDROM_ROOTS_${CDROM_CURRENT_CD} 1338 var=CD_ROOT_${CDROM_CURRENT_CD}
1339 [[ -z ${!var} ]] && var="CD_ROOT"
1346 if [[ -z ${!var} ]] ; then 1340 if [[ -z ${!var} ]] ; then
1347 var="CDROM_CHECK_${CDROM_CURRENT_CD}" 1341 var="CDROM_CHECK_${CDROM_CURRENT_CD}"
1348 cdrom_locate_file_on_cd ${!var} 1342 _cdrom_locate_file_on_cd ${!var}
1349 else 1343 else
1350 export CDROM_ROOT=${!var} 1344 export CDROM_ROOT=${!var}
1351 fi 1345 fi
1352 1346
1353 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}" 1347 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1358# all it does is try to locate a give file on a cd ... if the cd isn't 1352# all it does is try to locate a give file on a cd ... if the cd isn't
1359# found, then a message asking for the user to insert the cdrom will be 1353# found, then a message asking for the user to insert the cdrom will be
1360# displayed and we'll hang out here until: 1354# displayed and we'll hang out here until:
1361# (1) the file is found on a mounted cdrom 1355# (1) the file is found on a mounted cdrom
1362# (2) the user hits CTRL+C 1356# (2) the user hits CTRL+C
1363cdrom_locate_file_on_cd() { 1357_cdrom_locate_file_on_cd() {
1364 local mline="" 1358 local mline=""
1365 local showedmsg=0 1359 local showedmsg=0
1366 1360
1367 while [[ -z ${CDROM_ROOT} ]] ; do 1361 while [[ -z ${CDROM_ROOT} ]] ; do
1368 local i=0 1362 local i=0

Legend:
Removed from v.1.214  
changed lines
  Added in v.1.215

  ViewVC Help
Powered by ViewVC 1.1.20