Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Thu, 27 Apr 2017 21:41:59
Message-Id: 1493329282.aa4f0b23b8529c1dd464f23290d9bf68944a3d26.chewi@gentoo
1 commit: aa4f0b23b8529c1dd464f23290d9bf68944a3d26
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 16 09:56:09 2017 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 27 21:41:22 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa4f0b23
7
8 cdrom.eclass: Allow CDROM_NAMES changes before each cdrom_load_next_cd
9
10 This works around the lack of per-set disc names. Once the first disc
11 has been detected, ebuilds can adjust CDROM_NAMES to contain just the
12 names from the matched CDROM_SET.
13
14 eclass/cdrom.eclass | 25 ++++++++++++++++---------
15 1 file changed, 16 insertions(+), 9 deletions(-)
16
17 diff --git a/eclass/cdrom.eclass b/eclass/cdrom.eclass
18 index 29418ecb1a8..5e1fc23edfd 100644
19 --- a/eclass/cdrom.eclass
20 +++ b/eclass/cdrom.eclass
21 @@ -102,15 +102,7 @@ cdrom_get_cds() {
22 einfo "export CD_ROOT=/mnt/cdrom"
23 echo
24 else
25 - if [[ -n ${CDROM_NAMES} ]] ; then
26 - # Translate the CDROM_NAMES array into CDROM_NAME_#
27 - cdcnt=0
28 - while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
29 - ((++cdcnt))
30 - export CDROM_NAME_${cdcnt}="${CDROM_NAMES[$((${cdcnt}-1))]}"
31 - done
32 - fi
33 -
34 + _cdrom_set_names
35 einfo "This package will need access to ${CDROM_TOTAL_CDS} cds."
36 cdcnt=0
37 while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
38 @@ -152,6 +144,8 @@ cdrom_load_next_cd() {
39 local var
40 ((++CDROM_CURRENT_CD))
41
42 + _cdrom_set_names
43 +
44 unset CDROM_ROOT
45 var=CD_ROOT_${CDROM_CURRENT_CD}
46 [[ -z ${!var} ]] && var="CD_ROOT"
47 @@ -268,4 +262,17 @@ _cdrom_glob_match() {
48 )
49 }
50
51 +# @FUNCTION: _cdrom_set_names
52 +# @INTERNAL
53 +# @DESCRIPTION:
54 +# Populate CDROM_NAME_# variables with the CDROM_NAMES array.
55 +_cdrom_set_names() {
56 + if [[ -n ${CDROM_NAMES} ]] ; then
57 + local i
58 + for i in $(seq ${#CDROM_NAMES[@]}); do
59 + export CDROM_NAME_${i}="${CDROM_NAMES[$((${i} - 1))]}"
60 + done
61 + fi
62 +}
63 +
64 fi