Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: vapier@g.o
Subject: Re: [gentoo-dev] Re: RFD: split out some functions from eutils.eclass?
Date: Wed, 18 Jan 2012 13:38:12
Message-Id: 20120118143904.1bd1022c@pomiocik.lan
In Reply to: Re: [gentoo-dev] Re: RFD: split out some functions from eutils.eclass? by Mike Frysinger
1 On Wed, 18 Jan 2012 06:22:24 -0500
2 Mike Frysinger <vapier@g.o> wrote:
3
4 > > And then you can just refer to ${CDROM_CHECK[$i]} rather than using
5 > > all those ugly ${!...}.
6 >
7 > yes, i wrote this before i had a grasp of bash arrays. however, for
8 > Ulrich's work, he should just be relocating code without modifying.
9 > if we want to do cleanups, it'd be a follow up. i'm sure i could
10 > rewrite quite a bit now just by reading it.
11
12 Agreed.
13
14 > > > # now we see if the user gave use CD_ROOT ...
15 > > > # if they did, let's just believe them that it's correct
16 > > > if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
17 > > > local var=
18 > > > cdcnt=0
19 > > > while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ; do
20 > > > ((++cdcnt))
21 > > > var="CD_ROOT_${cdcnt}"
22 > > > [[ -z ${!var} ]] && var="CD_ROOT"
23 > > > if [[ -z ${!var} ]] ; then
24 > > > eerror "You must either use just
25 > > > the CD_ROOT" eerror "or specify ALL the CD_ROOT_X variables."
26 > > > eerror "In this case, you will
27 > > > need" \ "${CDROM_TOTAL_CDS} CD_ROOT_X
28 > > > variables." die "could not locate CD_ROOT_${cdcnt}"
29 > > > fi
30 > > > done
31 > > > export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
32 > > > einfo "Found CD #${CDROM_CURRENT_CD} root at
33 > > > ${CDROM_ROOT}"
34 > >
35 > > #1. You are using 1 in variable calls, I don't see a reason to use
36 > > longer ${CDROM_CURRENT_CD} in this one output case.
37 >
38 > i don't know what you mean
39
40 einfo "Found CD #1 root at ..."
41
42 --
43 Best regards,
44 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies