FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 01-18-2012, 06:11 PM
Michał Górny
 
Default RFD: split out some functions from eutils.eclass?

On Wed, 18 Jan 2012 09:48:59 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > # now we see if the user gave use CD_ROOT ...
> > > > > # if they did, let's just believe them that it's
> > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > >
> > > > > local var=
> > > > > cdcnt=0
> > > > > while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ;
> > > > > do ((++cdcnt))
> > > > > var="CD_ROOT_${cdcnt}"
> > > > > [[ -z ${!var} ]] && var="CD_ROOT"
> > > > > if [[ -z ${!var} ]] ; then
> > > > > eerror "You must either use
> > > > > just the CD_ROOT" eerror "or specify ALL the CD_ROOT_X
> > > > > variables." eerror "In this case, you will
> > > > > need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > variables." die "could not locate CD_ROOT_${cdcnt}"
> > > > > fi
> > > > > done
> > > > > export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
> > > > > einfo "Found CD #${CDROM_CURRENT_CD} root at
> > > > > ${CDROM_ROOT}"
> > > >
> > > > #1. You are using 1 in variable calls, I don't see a reason to
> > > > use longer ${CDROM_CURRENT_CD} in this one output case.
> > >
> > > i don't know what you mean
> >
> > einfo "Found CD #1 root at ..."
>
> *shrug* i preferred the # in the output

I don't get what you mean. I just say it's pointless to use
${CDROM_CURRENT_CD} here.

--
Best regards,
Michał Górny
 
Old 01-18-2012, 06:29 PM
Mike Frysinger
 
Default RFD: split out some functions from eutils.eclass?

On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
> On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
> > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > > # now we see if the user gave use CD_ROOT ...
> > > > > > # if they did, let's just believe them that it's
> > > > > >
> > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > > > local var=
> > > > > > cdcnt=0
> > > > > > while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]] ;
> > > > > > do ((++cdcnt))
> > > > > > var="CD_ROOT_${cdcnt}"
> > > > > > [[ -z ${!var} ]] && var="CD_ROOT"
> > > > > > if [[ -z ${!var} ]] ; then
> > > > > >
> > > > > > eerror "You must either use
> > > > > > just the CD_ROOT" eerror "or specify ALL the CD_ROOT_X
> > > > > > variables." eerror "In this case, you will
> > > > > > need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > > variables." die "could not locate CD_ROOT_${cdcnt}"
> > > > > > fi
> > > > > > done
> > > > > > export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
> > > > > > einfo "Found CD #${CDROM_CURRENT_CD} root at
> > > > > > ${CDROM_ROOT}"
> > > > >
> > > > > #1. You are using 1 in variable calls, I don't see a reason to
> > > > > use longer ${CDROM_CURRENT_CD} in this one output case.
> > > >
> > > > i don't know what you mean
> > >
> > > einfo "Found CD #1 root at ..."
> >
> > *shrug* i preferred the # in the output
>
> I don't get what you mean. I just say it's pointless to use
> ${CDROM_CURRENT_CD} here.

in multi cd sets, it keeps thing clearer imo at little cost
-mike
 
Old 01-18-2012, 07:14 PM
Michał Górny
 
Default RFD: split out some functions from eutils.eclass?

On Wed, 18 Jan 2012 14:29:27 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
> > On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
> > > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > > > # now we see if the user gave use CD_ROOT ...
> > > > > > > # if they did, let's just believe them that it's
> > > > > > >
> > > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > > > > local var=
> > > > > > > cdcnt=0
> > > > > > > while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS}
> > > > > > > ]] ; do ((++cdcnt))
> > > > > > > var="CD_ROOT_${cdcnt}"
> > > > > > > [[ -z ${!var} ]] && var="CD_ROOT"
> > > > > > > if [[ -z ${!var} ]] ; then
> > > > > > >
> > > > > > > eerror "You must either
> > > > > > > use just the CD_ROOT" eerror "or specify ALL the CD_ROOT_X
> > > > > > > variables." eerror "In this case, you will
> > > > > > > need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > > > variables." die "could not locate CD_ROOT_${cdcnt}"
> > > > > > > fi
> > > > > > > done
> > > > > > > export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
> > > > > > > einfo "Found CD #${CDROM_CURRENT_CD} root
> > > > > > > at ${CDROM_ROOT}"
> > > > > >
> > > > > > #1. You are using 1 in variable calls, I don't see a reason
> > > > > > to use longer ${CDROM_CURRENT_CD} in this one output case.
> > > > >
> > > > > i don't know what you mean
> > > >
> > > > einfo "Found CD #1 root at ..."
> > >
> > > *shrug* i preferred the # in the output
> >
> > I don't get what you mean. I just say it's pointless to use
> > ${CDROM_CURRENT_CD} here.
>
> in multi cd sets, it keeps thing clearer imo at little cost

Consdiering that you always use ${CD_ROOT_1}?

--
Best regards,
Michał Górny
 
Old 01-18-2012, 07:16 PM
Mike Frysinger
 
Default RFD: split out some functions from eutils.eclass?

On Wednesday 18 January 2012 15:14:05 Michał Górny wrote:
> On Wed, 18 Jan 2012 14:29:27 -0500 Mike Frysinger wrote:
> > On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
> > > On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
> > > > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > > > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > > > > # now we see if the user gave use CD_ROOT ...
> > > > > > > > # if they did, let's just believe them that it's
> > > > > > > >
> > > > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > > > > >
> > > > > > > > local var=
> > > > > > > > cdcnt=0
> > > > > > > > while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS}
> > > > > > > >
> > > > > > > > ]] ; do ((++cdcnt))
> > > > > > > >
> > > > > > > > var="CD_ROOT_${cdcnt}"
> > > > > > > > [[ -z ${!var} ]] && var="CD_ROOT"
> > > > > > > > if [[ -z ${!var} ]] ; then
> > > > > > > >
> > > > > > > > eerror "You must either
> > > > > > > >
> > > > > > > > use just the CD_ROOT" eerror "or specify ALL the CD_ROOT_X
> > > > > > > > variables." eerror "In this case, you will
> > > > > > > > need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > > > > variables." die "could not locate CD_ROOT_${cdcnt}"
> > > > > > > >
> > > > > > > > fi
> > > > > > > >
> > > > > > > > done
> > > > > > > > export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
> > > > > > > > einfo "Found CD #${CDROM_CURRENT_CD} root
> > > > > > > >
> > > > > > > > at ${CDROM_ROOT}"
> > > > > > >
> > > > > > > #1. You are using 1 in variable calls, I don't see a reason
> > > > > > > to use longer ${CDROM_CURRENT_CD} in this one output case.
> > > > > >
> > > > > > i don't know what you mean
> > > > >
> > > > > einfo "Found CD #1 root at ..."
> > > >
> > > > *shrug* i preferred the # in the output
> > >
> > > I don't get what you mean. I just say it's pointless to use
> > > ${CDROM_CURRENT_CD} here.
> >
> > in multi cd sets, it keeps thing clearer imo at little cost
>
> Consdiering that you always use ${CD_ROOT_1}?

yes. i want to see the disc # and path.
-mike
 
Old 01-18-2012, 07:28 PM
Michał Górny
 
Default RFD: split out some functions from eutils.eclass?

On Wed, 18 Jan 2012 15:16:02 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> On Wednesday 18 January 2012 15:14:05 Michał Górny wrote:
> > On Wed, 18 Jan 2012 14:29:27 -0500 Mike Frysinger wrote:
> > > On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
> > > > On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
> > > > > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > > > > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > > > > > # now we see if the user gave use CD_ROOT ...
> > > > > > > > > # if they did, let's just believe them that
> > > > > > > > > it's
> > > > > > > > >
> > > > > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > > > > > >
> > > > > > > > > local var=
> > > > > > > > > cdcnt=0
> > > > > > > > > while [[ ${cdcnt} -lt
> > > > > > > > > ${CDROM_TOTAL_CDS}
> > > > > > > > >
> > > > > > > > > ]] ; do ((++cdcnt))
> > > > > > > > >
> > > > > > > > > var="CD_ROOT_${cdcnt}"
> > > > > > > > > [[ -z ${!var} ]] &&
> > > > > > > > > var="CD_ROOT" if [[ -z ${!var} ]] ; then
> > > > > > > > >
> > > > > > > > > eerror "You must
> > > > > > > > > either
> > > > > > > > >
> > > > > > > > > use just the CD_ROOT" eerror "or specify ALL the
> > > > > > > > > CD_ROOT_X variables." eerror "In this case, you will
> > > > > > > > > need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > > > > > variables." die "could not locate CD_ROOT_${cdcnt}"
> > > > > > > > >
> > > > > > > > > fi
> > > > > > > > >
> > > > > > > > > done
> > > > > > > > > export
> > > > > > > > > CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}} einfo "Found CD
> > > > > > > > > #${CDROM_CURRENT_CD} root
> > > > > > > > >
> > > > > > > > > at ${CDROM_ROOT}"
> > > > > > > >
> > > > > > > > #1. You are using 1 in variable calls, I don't see a
> > > > > > > > reason to use longer ${CDROM_CURRENT_CD} in this one
> > > > > > > > output case.
> > > > > > >
> > > > > > > i don't know what you mean
> > > > > >
> > > > > > einfo "Found CD #1 root at ..."
> > > > >
> > > > > *shrug* i preferred the # in the output
> > > >
> > > > I don't get what you mean. I just say it's pointless to use
> > > > ${CDROM_CURRENT_CD} here.
> > >
> > > in multi cd sets, it keeps thing clearer imo at little cost
> >
> > Consdiering that you always use ${CD_ROOT_1}?
>
> yes. i want to see the disc # and path.

But isn't CDROM_CURRENT_ID always 1 there?

--
Best regards,
Michał Górny
 
Old 01-18-2012, 07:39 PM
Mike Frysinger
 
Default RFD: split out some functions from eutils.eclass?

On Wednesday 18 January 2012 15:28:45 Michał Górny wrote:
> On Wed, 18 Jan 2012 15:16:02 -0500 Mike Frysinger wrote:
> > On Wednesday 18 January 2012 15:14:05 Michał Górny wrote:
> > > On Wed, 18 Jan 2012 14:29:27 -0500 Mike Frysinger wrote:
> > > > On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
> > > > > On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
> > > > > > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > > > > > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > > > > > > # now we see if the user gave use CD_ROOT ...
> > > > > > > > > > # if they did, let's just believe them that
> > > > > > > > > >
> > > > > > > > > > it's
> > > > > > > > > >
> > > > > > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > > > > > > >
> > > > > > > > > > local var=
> > > > > > > > > > cdcnt=0
> > > > > > > > > > while [[ ${cdcnt} -lt
> > > > > > > > > >
> > > > > > > > > > ${CDROM_TOTAL_CDS}
> > > > > > > > > >
> > > > > > > > > > ]] ; do ((++cdcnt))
> > > > > > > > > >
> > > > > > > > > > var="CD_ROOT_${cdcnt}"
> > > > > > > > > > [[ -z ${!var} ]] &&
> > > > > > > > > >
> > > > > > > > > > var="CD_ROOT" if [[ -z ${!var} ]] ; then
> > > > > > > > > >
> > > > > > > > > > eerror "You must
> > > > > > > > > >
> > > > > > > > > > either
> > > > > > > > > >
> > > > > > > > > > use just the CD_ROOT" eerror "or specify ALL the
> > > > > > > > > > CD_ROOT_X variables." eerror "In this case, you will
> > > > > > > > > > need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > > > > > > variables." die "could not locate CD_ROOT_${cdcnt}"
> > > > > > > > > >
> > > > > > > > > > fi
> > > > > > > > > >
> > > > > > > > > > done
> > > > > > > > > > export
> > > > > > > > > >
> > > > > > > > > > CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}} einfo "Found CD
> > > > > > > > > > #${CDROM_CURRENT_CD} root
> > > > > > > > > >
> > > > > > > > > > at ${CDROM_ROOT}"
> > > > > > > > >
> > > > > > > > > #1. You are using 1 in variable calls, I don't see a
> > > > > > > > > reason to use longer ${CDROM_CURRENT_CD} in this one
> > > > > > > > > output case.
> > > > > > > >
> > > > > > > > i don't know what you mean
> > > > > > >
> > > > > > > einfo "Found CD #1 root at ..."
> > > > > >
> > > > > > *shrug* i preferred the # in the output
> > > > >
> > > > > I don't get what you mean. I just say it's pointless to use
> > > > > ${CDROM_CURRENT_CD} here.
> > > >
> > > > in multi cd sets, it keeps thing clearer imo at little cost
> > >
> > > Consdiering that you always use ${CD_ROOT_1}?
> >
> > yes. i want to see the disc # and path.
>
> But isn't CDROM_CURRENT_ID always 1 there?

yes. this func is the primer so it starts at 1, and after this, people call
cdrom_load_next_cd which then prints out:
einfo "Found CD #2 root at ..."
einfo "Found CD #3 root at ..."
einfo "Found CD #4 root at ..."
since they have the same `einfo` message structure

i could replace the variable in the first einfo with a "1", but it gains
nothing, and imo kills the "these messages are clearly in sync between these
two funcs".
-mike
 
Old 01-18-2012, 08:17 PM
Michał Górny
 
Default RFD: split out some functions from eutils.eclass?

On Wed, 18 Jan 2012 15:39:24 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> On Wednesday 18 January 2012 15:28:45 Michał Górny wrote:
> > On Wed, 18 Jan 2012 15:16:02 -0500 Mike Frysinger wrote:
> > > On Wednesday 18 January 2012 15:14:05 Michał Górny wrote:
> > > > On Wed, 18 Jan 2012 14:29:27 -0500 Mike Frysinger wrote:
> > > > > On Wednesday 18 January 2012 14:11:14 Michał Górny wrote:
> > > > > > On Wed, 18 Jan 2012 09:48:59 -0500 Mike Frysinger wrote:
> > > > > > > On Wednesday 18 January 2012 08:39:04 Michał Górny wrote:
> > > > > > > > On Wed, 18 Jan 2012 06:22:24 -0500 Mike Frysinger wrote:
> > > > > > > > > > > # now we see if the user gave use
> > > > > > > > > > > CD_ROOT ... # if they did, let's just believe
> > > > > > > > > > > them that
> > > > > > > > > > >
> > > > > > > > > > > it's
> > > > > > > > > > >
> > > > > > > > > > > correct if [[ -n ${CD_ROOT}${CD_ROOT_1} ]] ; then
> > > > > > > > > > >
> > > > > > > > > > > local var=
> > > > > > > > > > > cdcnt=0
> > > > > > > > > > > while [[ ${cdcnt} -lt
> > > > > > > > > > >
> > > > > > > > > > > ${CDROM_TOTAL_CDS}
> > > > > > > > > > >
> > > > > > > > > > > ]] ; do ((++cdcnt))
> > > > > > > > > > >
> > > > > > > > > > > var="CD_ROOT_${cdcnt}"
> > > > > > > > > > > [[ -z ${!var} ]] &&
> > > > > > > > > > >
> > > > > > > > > > > var="CD_ROOT" if [[ -z ${!var} ]] ; then
> > > > > > > > > > >
> > > > > > > > > > > eerror "You must
> > > > > > > > > > >
> > > > > > > > > > > either
> > > > > > > > > > >
> > > > > > > > > > > use just the CD_ROOT" eerror "or specify ALL the
> > > > > > > > > > > CD_ROOT_X variables." eerror "In this case, you
> > > > > > > > > > > will need" "${CDROM_TOTAL_CDS} CD_ROOT_X
> > > > > > > > > > > variables." die "could not locate
> > > > > > > > > > > CD_ROOT_${cdcnt}"
> > > > > > > > > > >
> > > > > > > > > > > fi
> > > > > > > > > > >
> > > > > > > > > > > done
> > > > > > > > > > > export
> > > > > > > > > > >
> > > > > > > > > > > CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}} einfo "Found
> > > > > > > > > > > CD #${CDROM_CURRENT_CD} root
> > > > > > > > > > >
> > > > > > > > > > > at ${CDROM_ROOT}"
> > > > > > > > > >
> > > > > > > > > > #1. You are using 1 in variable calls, I don't see a
> > > > > > > > > > reason to use longer ${CDROM_CURRENT_CD} in this one
> > > > > > > > > > output case.
> > > > > > > > >
> > > > > > > > > i don't know what you mean
> > > > > > > >
> > > > > > > > einfo "Found CD #1 root at ..."
> > > > > > >
> > > > > > > *shrug* i preferred the # in the output
> > > > > >
> > > > > > I don't get what you mean. I just say it's pointless to use
> > > > > > ${CDROM_CURRENT_CD} here.
> > > > >
> > > > > in multi cd sets, it keeps thing clearer imo at little cost
> > > >
> > > > Consdiering that you always use ${CD_ROOT_1}?
> > >
> > > yes. i want to see the disc # and path.
> >
> > But isn't CDROM_CURRENT_ID always 1 there?
>
> yes. this func is the primer so it starts at 1, and after this,
> people call cdrom_load_next_cd which then prints out:
> einfo "Found CD #2 root at ..."
> einfo "Found CD #3 root at ..."
> einfo "Found CD #4 root at ..."
> since they have the same `einfo` message structure
>
> i could replace the variable in the first einfo with a "1", but it
> gains nothing, and imo kills the "these messages are clearly in sync
> between these two funcs".

Then please clearly use the ${!...} magic to get CD_ROOT_1 rather than
mixing hardcoded '1' and $CDROM_CURRENT_ID.

--
Best regards,
Michał Górny
 
Old 01-18-2012, 09:16 PM
Mike Frysinger
 
Default RFD: split out some functions from eutils.eclass?

On Wednesday 18 January 2012 16:17:50 Michał Górny wrote:
> On Wed, 18 Jan 2012 15:39:24 -0500 Mike Frysinger wrote:
> > yes. this func is the primer so it starts at 1, and after this,
> >
> > people call cdrom_load_next_cd which then prints out:
> > einfo "Found CD #2 root at ..."
> > einfo "Found CD #3 root at ..."
> > einfo "Found CD #4 root at ..."
> >
> > since they have the same `einfo` message structure
> >
> > i could replace the variable in the first einfo with a "1", but it
> > gains nothing, and imo kills the "these messages are clearly in sync
> > between these two funcs".
>
> Then please clearly use the ${!...} magic to get CD_ROOT_1 rather than
> mixing hardcoded '1' and $CDROM_CURRENT_ID.

pretty sure that's independent of the `einfo` output

i'm probably not going to bother looking for feedback on the code style until
it gets rewritten in arrays
-mike
 

Thread Tools




All times are GMT. The time now is 01:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org