commit: aa4f0b23b8529c1dd464f23290d9bf68944a3d26 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> AuthorDate: Sun Apr 16 09:56:09 2017 +0000 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> CommitDate: Thu Apr 27 21:41:22 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa4f0b23
cdrom.eclass: Allow CDROM_NAMES changes before each cdrom_load_next_cd This works around the lack of per-set disc names. Once the first disc has been detected, ebuilds can adjust CDROM_NAMES to contain just the names from the matched CDROM_SET. eclass/cdrom.eclass | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/eclass/cdrom.eclass b/eclass/cdrom.eclass index 29418ecb1a8..5e1fc23edfd 100644 --- a/eclass/cdrom.eclass +++ b/eclass/cdrom.eclass @@ -102,15 +102,7 @@ cdrom_get_cds() { einfo "export CD_ROOT=/mnt/cdrom" echo else - if [[ -n ${CDROM_NAMES} ]] ; then - # Translate the CDROM_NAMES array into CDROM_NAME_# - cdcnt=0 - while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do - ((++cdcnt)) - export CDROM_NAME_${cdcnt}="${CDROM_NAMES[$((${cdcnt}-1))]}" - done - fi - + _cdrom_set_names einfo "This package will need access to ${CDROM_TOTAL_CDS} cds." cdcnt=0 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do @@ -152,6 +144,8 @@ cdrom_load_next_cd() { local var ((++CDROM_CURRENT_CD)) + _cdrom_set_names + unset CDROM_ROOT var=CD_ROOT_${CDROM_CURRENT_CD} [[ -z ${!var} ]] && var="CD_ROOT" @@ -268,4 +262,17 @@ _cdrom_glob_match() { ) } +# @FUNCTION: _cdrom_set_names +# @INTERNAL +# @DESCRIPTION: +# Populate CDROM_NAME_# variables with the CDROM_NAMES array. +_cdrom_set_names() { + if [[ -n ${CDROM_NAMES} ]] ; then + local i + for i in $(seq ${#CDROM_NAMES[@]}); do + export CDROM_NAME_${i}="${CDROM_NAMES[$((${i} - 1))]}" + done + fi +} + fi