From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0B463139694 for ; Mon, 17 Apr 2017 21:57:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 67E3521C0E1; Mon, 17 Apr 2017 21:54:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2288321C0C6 for ; Mon, 17 Apr 2017 21:54:38 +0000 (UTC) Received: from symphony.aura-online.co.uk (154.189.187.81.in-addr.arpa [81.187.189.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: chewi) by smtp.gentoo.org (Postfix) with ESMTPSA id B09E4341683; Mon, 17 Apr 2017 21:54:36 +0000 (UTC) From: James Le Cuirot To: gentoo-dev Cc: James Le Cuirot Subject: [gentoo-dev] [PATCH 04/14] cdrom.eclass: Allow CDROM_NAMES changes before each cdrom_load_next_cd Date: Mon, 17 Apr 2017 22:53:49 +0100 Message-Id: <20170417215359.30641-5-chewi@gentoo.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170417215359.30641-1-chewi@gentoo.org> References: <20170417215359.30641-1-chewi@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 054edee0-d56f-4a77-83a9-b7e6a28f13c1 X-Archives-Hash: e2d5281c3226ddc525631b98cf90789d 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