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

Diff of /eclass/eutils.eclass

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

Revision 1.213 Revision 1.214
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.213 2005/10/22 19:04:02 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.214 2005/10/26 00:39:12 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.
1244 # first we figure out how many cds we're dealing with by 1244 # first we figure out how many cds we're dealing with by
1245 # the # of files they gave us 1245 # the # of files they gave us
1246 local cdcnt=0 1246 local cdcnt=0
1247 local f= 1247 local f=
1248 for f in "$@" ; do 1248 for f in "$@" ; do
1249 cdcnt=$((cdcnt + 1)) 1249 ((++cdcnt))
1250 export CDROM_CHECK_${cdcnt}="$f" 1250 export CDROM_CHECK_${cdcnt}="$f"
1251 done 1251 done
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
1262 # do the same for CD_ROOT_X 1262 # do the same for CD_ROOT_X
1263 if [[ ! -z ${CD_ROOT_1} ]] ; then 1263 if [[ ! -z ${CD_ROOT_1} ]] ; then
1264 local var= 1264 local var=
1265 cdcnt=0 1265 cdcnt=0
1266 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do 1266 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1267 cdcnt=$((cdcnt + 1)) 1267 ((++cdcnt))
1268 var="CD_ROOT_${cdcnt}" 1268 var="CD_ROOT_${cdcnt}"
1269 if [[ -z ${!var} ]] ; then 1269 if [[ -z ${!var} ]] ; then
1270 eerror "You must either use just the CD_ROOT" 1270 eerror "You must either use just the CD_ROOT"
1271 eerror "or specify ALL the CD_ROOT_X variables." 1271 eerror "or specify ALL the CD_ROOT_X variables."
1272 eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables." 1272 eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables."
1297 echo 1297 echo
1298 else 1298 else
1299 einfo "This package will need access to ${CDROM_TOTAL_CDS} cds." 1299 einfo "This package will need access to ${CDROM_TOTAL_CDS} cds."
1300 cdcnt=0 1300 cdcnt=0
1301 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do 1301 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1302 cdcnt=$((cdcnt + 1)) 1302 ((++cdcnt))
1303 var="CDROM_NAME_${cdcnt}" 1303 var="CDROM_NAME_${cdcnt}"
1304 [[ ! -z ${!var} ]] && einfo " CD ${cdcnt}: ${!var}" 1304 [[ ! -z ${!var} ]] && einfo " CD ${cdcnt}: ${!var}"
1305 done 1305 done
1306 echo 1306 echo
1307 einfo "If you do not have the CDs, but have the data files" 1307 einfo "If you do not have the CDs, but have the data files"
1308 einfo "mounted somewhere on your filesystem, just export" 1308 einfo "mounted somewhere on your filesystem, just export"
1309 einfo "the following variables so they point to the right place:" 1309 einfo "the following variables so they point to the right place:"
1310 einfon "" 1310 einfon ""
1311 cdcnt=0 1311 cdcnt=0
1312 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do 1312 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
1313 cdcnt=$((cdcnt + 1)) 1313 ((++cdcnt))
1314 echo -n " CD_ROOT_${cdcnt}" 1314 echo -n " CD_ROOT_${cdcnt}"
1315 done 1315 done
1316 echo 1316 echo
1317 einfo "Or, if you have all the files in the same place, or" 1317 einfo "Or, if you have all the files in the same place, or"
1318 einfo "you only have one cdrom, you can export CD_ROOT" 1318 einfo "you only have one cdrom, you can export CD_ROOT"
1321 echo 1321 echo
1322 einfo "For example:" 1322 einfo "For example:"
1323 einfo "export CD_ROOT_1=/mnt/cdrom" 1323 einfo "export CD_ROOT_1=/mnt/cdrom"
1324 echo 1324 echo
1325 fi 1325 fi
1326 export CDROM_SET=""
1326 export CDROM_CURRENT_CD=0 1327 export CDROM_CURRENT_CD=0
1327 cdrom_load_next_cd 1328 cdrom_load_next_cd
1328} 1329}
1329 1330
1330# this is only used when you need access to more than one cd. 1331# this is only used when you need access to more than one cd.
1358# found, then a message asking for the user to insert the cdrom will be 1359# found, then a message asking for the user to insert the cdrom will be
1359# displayed and we'll hang out here until: 1360# displayed and we'll hang out here until:
1360# (1) the file is found on a mounted cdrom 1361# (1) the file is found on a mounted cdrom
1361# (2) the user hits CTRL+C 1362# (2) the user hits CTRL+C
1362cdrom_locate_file_on_cd() { 1363cdrom_locate_file_on_cd() {
1364 local mline=""
1365 local showedmsg=0
1366
1363 while [[ -z ${CDROM_ROOT} ]] ; do 1367 while [[ -z ${CDROM_ROOT} ]] ; do
1364 local dir=$(dirname "$*") 1368 local i=0
1369 local -a cdset=(${*//:/ })
1370 if [[ -n ${CDROM_SET} ]] ; then
1371 cdset=(${cdset[${CDROM_SET}]})
1372 fi
1373
1374 while [[ -n ${cdset[${i}]} ]] ; do
1375 local dir=$(dirname ${cdset[${i}]})
1365 local file=$(basename "$*") 1376 local file=$(basename ${cdset[${i}]})
1366 local mline=""
1367 local showedmsg=0
1368 1377
1369 for mline in $(mount | egrep -e '(iso|cdrom|fs=cdfss)' | awk '{print $3}') ; do 1378 for mline in $(mount | gawk '/(iso|cdrom|fs=cdfss)/ {print $3}') ; do
1370 [[ -d ${mline}/${dir} ]] || continue 1379 [[ -d ${mline}/${dir} ]] || continue
1371 [[ ! -z $(find ${mline}/${dir} -maxdepth 1 -iname ${file}) ]] \ 1380 if [[ -n $(find ${mline}/${dir} -maxdepth 1 -iname ${file}) ]] ; then
1372 && export CDROM_ROOT=${mline} 1381 export CDROM_ROOT=${mline}
1382 export CDROM_SET=${i}
1383 export CDROM_MATCH=${cdset[${i}]}
1384 return
1385 fi
1386 done
1387
1388 ((++i))
1373 done 1389 done
1374 1390
1375 if [[ -z ${CDROM_ROOT} ]] ; then
1376 echo 1391 echo
1377 if [[ ${showedmsg} -eq 0 ]] ; then 1392 if [[ ${showedmsg} -eq 0 ]] ; then
1378 if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then 1393 if [[ ${CDROM_TOTAL_CDS} -eq 1 ]] ; then
1379 if [[ -z ${CDROM_NAME} ]] ; then 1394 if [[ -z ${CDROM_NAME} ]] ; then
1380 einfo "Please insert the cdrom for ${PN} now !" 1395 einfo "Please insert+mount the cdrom for ${PN} now !"
1381 else
1382 einfo "Please insert the ${CDROM_NAME} cdrom now !"
1383 fi
1384 else 1396 else
1385 if [[ -z ${CDROM_NAME_1} ]] ; then
1386 einfo "Please insert cd #${CDROM_CURRENT_CD} for ${PN} now !"
1387 else
1388 local var="CDROM_NAME_${CDROM_CURRENT_CD}"
1389 einfo "Please insert+mount the ${!var} cdrom now !" 1397 einfo "Please insert+mount the ${CDROM_NAME} cdrom now !"
1390 fi
1391 fi 1398 fi
1392 showedmsg=1 1399 else
1400 if [[ -z ${CDROM_NAME_1} ]] ; then
1401 einfo "Please insert+mount cd #${CDROM_CURRENT_CD} for ${PN} now !"
1402 else
1403 local var="CDROM_NAME_${CDROM_CURRENT_CD}"
1404 einfo "Please insert+mount the ${!var} cdrom now !"
1405 fi
1393 fi 1406 fi
1407 showedmsg=1
1408 fi
1394 einfo "Press return to scan for the cd again" 1409 einfo "Press return to scan for the cd again"
1395 einfo "or hit CTRL+C to abort the emerge." 1410 einfo "or hit CTRL+C to abort the emerge."
1396 echo 1411 echo
1397 einfo "If you are having trouble with the detection" 1412 einfo "If you are having trouble with the detection"
1398 einfo "of your CD, it is possible that you do not have" 1413 einfo "of your CD, it is possible that you do not have"
1399 einfo "Joliet support enabled in your kernel. Please" 1414 einfo "Joliet support enabled in your kernel. Please"
1400 einfo "check that CONFIG_JOLIET is enabled in your kernel." 1415 einfo "check that CONFIG_JOLIET is enabled in your kernel."
1401 read 1416 read
1402 fi
1403 done 1417 done
1404} 1418}
1405 1419
1406# Make sure that LINGUAS only contains languages that 1420# Make sure that LINGUAS only contains languages that
1407# a package can support 1421# a package can support

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

  ViewVC Help
Powered by ViewVC 1.1.20