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 21:17:02
Message-Id: 20120118221750.000bb061@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 15:39:24 -0500
2 Mike Frysinger <vapier@g.o> wrote:
3
4 > On Wednesday 18 January 2012 15:28:45 Michał Górny wrote:
5 > > On Wed, 18 Jan 2012 15:16:02 -0500 Mike Frysinger wrote:
6 > > > On Wednesday 18 January 2012 15:14:05 Michał Górny wrote:
7 > > > > On Wed, 18 Jan 2012 14:29:27 -0500 Mike Frysinger wrote:
8 > > > > > On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
9 > > > > > > On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
10 > > > > > > > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
11 > > > > > > > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
12 > > > > > > > > > > > # now we see if the user gave use
13 > > > > > > > > > > > CD_ROOT ... # if they did, let's just believe
14 > > > > > > > > > > > them that
15 > > > > > > > > > > >
16 > > > > > > > > > > > it's
17 > > > > > > > > > > >
18 > > > > > > > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
19 > > > > > > > > > > >
20 > > > > > > > > > > > local var=
21 > > > > > > > > > > > cdcnt=0
22 > > > > > > > > > > > while [[ ${cdcnt} -lt
23 > > > > > > > > > > >
24 > > > > > > > > > > > ${CDROM_TOTAL_CDS}
25 > > > > > > > > > > >
26 > > > > > > > > > > > ]] ; do ((++cdcnt))
27 > > > > > > > > > > >
28 > > > > > > > > > > > var="CD_ROOT_${cdcnt}"
29 > > > > > > > > > > > [[ -z ${!var} ]] &&
30 > > > > > > > > > > >
31 > > > > > > > > > > > var="CD_ROOT" if [[ -z ${!var} ]] ; then
32 > > > > > > > > > > >
33 > > > > > > > > > > > eerror "You must
34 > > > > > > > > > > >
35 > > > > > > > > > > > either
36 > > > > > > > > > > >
37 > > > > > > > > > > > use just the CD_ROOT" eerror "or specify ALL the
38 > > > > > > > > > > > CD_ROOT_X variables." eerror "In this case, you
39 > > > > > > > > > > > will need" \ "${CDROM_TOTAL_CDS} CD_ROOT_X
40 > > > > > > > > > > > variables." die "could not locate
41 > > > > > > > > > > > CD_ROOT_${cdcnt}"
42 > > > > > > > > > > >
43 > > > > > > > > > > > fi
44 > > > > > > > > > > >
45 > > > > > > > > > > > done
46 > > > > > > > > > > > export
47 > > > > > > > > > > >
48 > > > > > > > > > > > CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}} einfo "Found
49 > > > > > > > > > > > CD #${CDROM_CURRENT_CD} root
50 > > > > > > > > > > >
51 > > > > > > > > > > > at ${CDROM_ROOT}"
52 > > > > > > > > > >
53 > > > > > > > > > > #1. You are using 1 in variable calls, I don't see a
54 > > > > > > > > > > reason to use longer ${CDROM_CURRENT_CD} in this one
55 > > > > > > > > > > output case.
56 > > > > > > > > >
57 > > > > > > > > > i don't know what you mean
58 > > > > > > > >
59 > > > > > > > > einfo "Found CD #1 root at ..."
60 > > > > > > >
61 > > > > > > > *shrug* i preferred the # in the output
62 > > > > > >
63 > > > > > > I don't get what you mean. I just say it's pointless to use
64 > > > > > > ${CDROM_CURRENT_CD} here.
65 > > > > >
66 > > > > > in multi cd sets, it keeps thing clearer imo at little cost
67 > > > >
68 > > > > Consdiering that you always use ${CD_ROOT_1}?
69 > > >
70 > > > yes. i want to see the disc # and path.
71 > >
72 > > But isn't CDROM_CURRENT_ID always 1 there?
73 >
74 > yes. this func is the primer so it starts at 1, and after this,
75 > people call cdrom_load_next_cd which then prints out:
76 > einfo "Found CD #2 root at ..."
77 > einfo "Found CD #3 root at ..."
78 > einfo "Found CD #4 root at ..."
79 > since they have the same `einfo` message structure
80 >
81 > i could replace the variable in the first einfo with a "1", but it
82 > gains nothing, and imo kills the "these messages are clearly in sync
83 > between these two funcs".
84
85 Then please clearly use the ${!...} magic to get CD_ROOT_1 rather than
86 mixing hardcoded '1' and $CDROM_CURRENT_ID.
87
88 --
89 Best regards,
90 Michał Górny

Attachments

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

Replies