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 72250556e624..9724c66ca2ce 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"
@@ -258,4 +252,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
--
2.11.0