diff options
author | James Le Cuirot <chewi@gentoo.org> | 2017-04-16 10:56:09 +0100 |
---|---|---|
committer | James Le Cuirot <chewi@gentoo.org> | 2017-04-27 22:41:22 +0100 |
commit | aa4f0b23b8529c1dd464f23290d9bf68944a3d26 (patch) | |
tree | 45e790d195e4171c08693b363abac1130515d81e /eclass | |
parent | cdrom.eclass: Rename CDROM_NAME_SET array to CDROM_NAMES (diff) | |
download | gentoo-aa4f0b23b8529c1dd464f23290d9bf68944a3d26.tar.gz gentoo-aa4f0b23b8529c1dd464f23290d9bf68944a3d26.tar.bz2 gentoo-aa4f0b23b8529c1dd464f23290d9bf68944a3d26.zip |
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.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/cdrom.eclass | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/eclass/cdrom.eclass b/eclass/cdrom.eclass index 29418ecb1a86..5e1fc23edfd9 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 |