Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   RFC: using array variables in qt4-r2.eclass (http://www.linux-archive.org/gentoo-development/683261-rfc-using-array-variables-qt4-r2-eclass.html)

Ben de Groot 07-13-2012 12:02 PM

RFC: using array variables in qt4-r2.eclass
 
Hi,

We'd like to start using array variables for DOCS and HTML_DOCS in
qt4-r2.eclass, as they are already more widely used in other eclasses.
Please check the attached diff and let us know what you think.

Thanks on behalf of the Qt team!
--
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin

Alexis Ballier 07-13-2012 12:34 PM

RFC: using array variables in qt4-r2.eclass
 
On Fri, 13 Jul 2012 20:02:19 +0800
Ben de Groot <yngwin@gentoo.org> wrote:

> --- /usr/portage/eclass/qt4-r2.eclass 2012-04-20
> 07:01:13.000000000 +0800 +++ qt4-r2.eclass.new 2012-07-13
> 19:45:59.259773917 +0800 @@ -19,6 +19,22 @@
>
> export XDG_CONFIG_HOME="${T}"
>
> +# @ECLASS-VARIABLE: DOCS
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Array containing documents passed to dodoc command.
> +# Paths can be absolute or relative to ${S}.
> +#
> +# Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" )
> +
> +# @ECLASS-VARIABLE: HTML_DOCS
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Array containing documents passed to dohtml command.
> +# Paths can be absolute or relative to ${S}.
> +#
> +# Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/"
> ) +
> # @ECLASS-VARIABLE: LANGS
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> @@ -44,6 +60,21 @@
> done
> unset x
>
> +# @ECLASS-VARIABLE: PATCHES
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Array variable containing all the patches to be applied. This
> variable +# is expected to be defined in the global scope of ebuilds.
> Make sure to +# specify the full path. This variable is used in
> src_prepare phase. +#
> +# Example:
> +# @CODE
> +# PATCHES=(
> +# "${FILESDIR}/mypatch.patch"
> +# "${FILESDIR}/mypatch2.patch"
> +# )
> +# @CODE
> +

this sounds like re-ordering and improving comments, no functional
change, right ?

[...]
> + # backward compatibility for non-array variables
> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS 2>/dev/null
> 2>&1)" != "declare -a"* ]]; then
> + dodoc ${DOCS} || die "dodoc failed"
> + fi
> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
> + fi
> }

maybe issue an eqawarn in that case telling people to convert to
arrays; some time later make this an ewarn telling non-array support
will be removed and again later make this a die :)
(if you take that route i would expect you to start converting packages
to use arrays)


+1 for the whole thing btw

A.

Davide Pesavento 07-13-2012 01:26 PM

RFC: using array variables in qt4-r2.eclass
 
On Fri, Jul 13, 2012 at 2:34 PM, Alexis Ballier <aballier@gentoo.org> wrote:
> On Fri, 13 Jul 2012 20:02:19 +0800
> Ben de Groot <yngwin@gentoo.org> wrote:
>
>> --- /usr/portage/eclass/qt4-r2.eclass 2012-04-20
>> 07:01:13.000000000 +0800 +++ qt4-r2.eclass.new 2012-07-13
>> 19:45:59.259773917 +0800 @@ -19,6 +19,22 @@
>>
>> export XDG_CONFIG_HOME="${T}"
>>
>> +# @ECLASS-VARIABLE: DOCS
>> +# @DEFAULT_UNSET
>> +# @DESCRIPTION:
>> +# Array containing documents passed to dodoc command.
>> +# Paths can be absolute or relative to ${S}.
>> +#
>> +# Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" )
>> +
>> +# @ECLASS-VARIABLE: HTML_DOCS
>> +# @DEFAULT_UNSET
>> +# @DESCRIPTION:
>> +# Array containing documents passed to dohtml command.
>> +# Paths can be absolute or relative to ${S}.
>> +#
>> +# Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/"
>> ) +
>> # @ECLASS-VARIABLE: LANGS
>> # @DEFAULT_UNSET
>> # @DESCRIPTION:
>> @@ -44,6 +60,21 @@
>> done
>> unset x
>>
>> +# @ECLASS-VARIABLE: PATCHES
>> +# @DEFAULT_UNSET
>> +# @DESCRIPTION:
>> +# Array variable containing all the patches to be applied. This
>> variable +# is expected to be defined in the global scope of ebuilds.
>> Make sure to +# specify the full path. This variable is used in
>> src_prepare phase. +#
>> +# Example:
>> +# @CODE
>> +# PATCHES=(
>> +# "${FILESDIR}/mypatch.patch"
>> +# "${FILESDIR}/mypatch2.patch"
>> +# )
>> +# @CODE
>> +
>
> this sounds like re-ordering and improving comments, no functional
> change, right ?
>

Correct, no functional changes in this hunk.

> [...]
>> + # backward compatibility for non-array variables
>> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS 2>/dev/null
>> 2>&1)" != "declare -a"* ]]; then
>> + dodoc ${DOCS} || die "dodoc failed"
>> + fi
>> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
>> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
>> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
>> + fi
>> }
>
> maybe issue an eqawarn in that case telling people to convert to
> arrays; some time later make this an ewarn telling non-array support
> will be removed and again later make this a die :)
> (if you take that route i would expect you to start converting packages
> to use arrays)
>

We have no intention of deprecating non-array variables in qt4-r2 eclass.

>
> +1 for the whole thing btw
>
> A.
>

Thanks,
Pesa

Alexis Ballier 07-13-2012 01:50 PM

RFC: using array variables in qt4-r2.eclass
 
On Fri, 13 Jul 2012 15:26:58 +0200
Davide Pesavento <pesa@gentoo.org> wrote:

> > [...]
> >> + # backward compatibility for non-array variables
> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS 2>/dev/null
> >> 2>&1)" != "declare -a"* ]]; then
> >> + dodoc ${DOCS} || die "dodoc failed"
> >> + fi
> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
> >> + fi
> >> }
> >
> > maybe issue an eqawarn in that case telling people to convert to
> > arrays; some time later make this an ewarn telling non-array support
> > will be removed and again later make this a die :)
> > (if you take that route i would expect you to start converting
> > packages to use arrays)
> >
>
> We have no intention of deprecating non-array variables in qt4-r2
> eclass.

why ? having two codepaths for the same thing, one being inferior,
sounds like a good reason to deprecate the inferior one :)

A.

Davide Pesavento 07-14-2012 10:29 AM

RFC: using array variables in qt4-r2.eclass
 
On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier <aballier@gentoo.org> wrote:
> On Fri, 13 Jul 2012 15:26:58 +0200
> Davide Pesavento <pesa@gentoo.org> wrote:
>
>> > [...]
>> >> + # backward compatibility for non-array variables
>> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS 2>/dev/null
>> >> 2>&1)" != "declare -a"* ]]; then
>> >> + dodoc ${DOCS} || die "dodoc failed"
>> >> + fi
>> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
>> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
>> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
>> >> + fi
>> >> }
>> >
>> > maybe issue an eqawarn in that case telling people to convert to
>> > arrays; some time later make this an ewarn telling non-array support
>> > will be removed and again later make this a die :)
>> > (if you take that route i would expect you to start converting
>> > packages to use arrays)
>> >
>>
>> We have no intention of deprecating non-array variables in qt4-r2
>> eclass.
>
> why ? having two codepaths for the same thing, one being inferior,
> sounds like a good reason to deprecate the inferior one :)
>
> A.
>

Maintaining these two codepaths has practically zero cost, while
forcing every ebuild using qt4-r2 to switch to arrays would waste
developers' time which is better spent elsewhere.

Furthermore, the non-array variant is not necessarily inferior,
because it allows you to use bash globbing, brace expansion, etc...

Thanks,
Pesa

Michał Górny 07-14-2012 02:00 PM

RFC: using array variables in qt4-r2.eclass
 
On Sat, 14 Jul 2012 12:29:59 +0200
Davide Pesavento <pesa@gentoo.org> wrote:

> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier <aballier@gentoo.org>
> wrote:
> > On Fri, 13 Jul 2012 15:26:58 +0200
> > Davide Pesavento <pesa@gentoo.org> wrote:
> >
> >> > [...]
> >> >> + # backward compatibility for non-array variables
> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS 2>/dev/null
> >> >> 2>&1)" != "declare -a"* ]]; then
> >> >> + dodoc ${DOCS} || die "dodoc failed"
> >> >> + fi
> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
> >> >> + fi
> >> >> }
> >> >
> >> > maybe issue an eqawarn in that case telling people to convert to
> >> > arrays; some time later make this an ewarn telling non-array
> >> > support will be removed and again later make this a die :)
> >> > (if you take that route i would expect you to start converting
> >> > packages to use arrays)
> >> >
> >>
> >> We have no intention of deprecating non-array variables in qt4-r2
> >> eclass.
> >
> > why ? having two codepaths for the same thing, one being inferior,
> > sounds like a good reason to deprecate the inferior one :)
> >
> > A.
> >
>
> Maintaining these two codepaths has practically zero cost, while
> forcing every ebuild using qt4-r2 to switch to arrays would waste
> developers' time which is better spent elsewhere.
>
> Furthermore, the non-array variant is not necessarily inferior,
> because it allows you to use bash globbing, brace expansion, etc...

And arrays stopped to allow that overnight?

--
Best regards,
Michał Górny

Davide Pesavento 07-15-2012 11:00 AM

RFC: using array variables in qt4-r2.eclass
 
On Sat, Jul 14, 2012 at 4:00 PM, Michał Górny <mgorny@gentoo.org> wrote:
> On Sat, 14 Jul 2012 12:29:59 +0200
> Davide Pesavento <pesa@gentoo.org> wrote:
>
>> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier <aballier@gentoo.org>
>> wrote:
>> > On Fri, 13 Jul 2012 15:26:58 +0200
>> > Davide Pesavento <pesa@gentoo.org> wrote:
>> >
>> >> > [...]
>> >> >> + # backward compatibility for non-array variables
>> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS 2>/dev/null
>> >> >> 2>&1)" != "declare -a"* ]]; then
>> >> >> + dodoc ${DOCS} || die "dodoc failed"
>> >> >> + fi
>> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
>> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
>> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
>> >> >> + fi
>> >> >> }
>> >> >
>> >> > maybe issue an eqawarn in that case telling people to convert to
>> >> > arrays; some time later make this an ewarn telling non-array
>> >> > support will be removed and again later make this a die :)
>> >> > (if you take that route i would expect you to start converting
>> >> > packages to use arrays)
>> >> >
>> >>
>> >> We have no intention of deprecating non-array variables in qt4-r2
>> >> eclass.
>> >
>> > why ? having two codepaths for the same thing, one being inferior,
>> > sounds like a good reason to deprecate the inferior one :)
>> >
>> > A.
>> >
>>
>> Maintaining these two codepaths has practically zero cost, while
>> forcing every ebuild using qt4-r2 to switch to arrays would waste
>> developers' time which is better spent elsewhere.
>>
>> Furthermore, the non-array variant is not necessarily inferior,
>> because it allows you to use bash globbing, brace expansion, etc...
>
> And arrays stopped to allow that overnight?
>

I mean that the following won't work as you might expect:

DOCS=("*.txt")

Thanks,
Pesa

Michał Górny 07-15-2012 01:42 PM

RFC: using array variables in qt4-r2.eclass
 
On Sun, 15 Jul 2012 13:00:47 +0200
Davide Pesavento <pesa@gentoo.org> wrote:

> On Sat, Jul 14, 2012 at 4:00 PM, Michał Górny <mgorny@gentoo.org>
> wrote:
> > On Sat, 14 Jul 2012 12:29:59 +0200
> > Davide Pesavento <pesa@gentoo.org> wrote:
> >
> >> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier
> >> <aballier@gentoo.org> wrote:
> >> > On Fri, 13 Jul 2012 15:26:58 +0200
> >> > Davide Pesavento <pesa@gentoo.org> wrote:
> >> >
> >> >> > [...]
> >> >> >> + # backward compatibility for non-array variables
> >> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS
> >> >> >> 2>/dev/null
> >> >> >> 2>&1)" != "declare -a"* ]]; then
> >> >> >> + dodoc ${DOCS} || die "dodoc failed"
> >> >> >> + fi
> >> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
> >> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
> >> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
> >> >> >> + fi
> >> >> >> }
> >> >> >
> >> >> > maybe issue an eqawarn in that case telling people to convert
> >> >> > to arrays; some time later make this an ewarn telling
> >> >> > non-array support will be removed and again later make this a
> >> >> > die :) (if you take that route i would expect you to start
> >> >> > converting packages to use arrays)
> >> >> >
> >> >>
> >> >> We have no intention of deprecating non-array variables in
> >> >> qt4-r2 eclass.
> >> >
> >> > why ? having two codepaths for the same thing, one being
> >> > inferior, sounds like a good reason to deprecate the inferior
> >> > one :)
> >> >
> >> > A.
> >> >
> >>
> >> Maintaining these two codepaths has practically zero cost, while
> >> forcing every ebuild using qt4-r2 to switch to arrays would waste
> >> developers' time which is better spent elsewhere.
> >>
> >> Furthermore, the non-array variant is not necessarily inferior,
> >> because it allows you to use bash globbing, brace expansion, etc...
> >
> > And arrays stopped to allow that overnight?
> >
>
> I mean that the following won't work as you might expect:
>
> DOCS=("*.txt")

I doubt anyone would expect quoted string to be evaluated as glob.

--
Best regards,
Michał Górny

Davide Pesavento 07-15-2012 03:36 PM

RFC: using array variables in qt4-r2.eclass
 
On Sun, Jul 15, 2012 at 3:42 PM, Michał Górny <mgorny@gentoo.org> wrote:
> On Sun, 15 Jul 2012 13:00:47 +0200
> Davide Pesavento <pesa@gentoo.org> wrote:
>
>> On Sat, Jul 14, 2012 at 4:00 PM, Michał Górny <mgorny@gentoo.org>
>> wrote:
>> > On Sat, 14 Jul 2012 12:29:59 +0200
>> > Davide Pesavento <pesa@gentoo.org> wrote:
>> >
>> >> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier
>> >> <aballier@gentoo.org> wrote:
>> >> > On Fri, 13 Jul 2012 15:26:58 +0200
>> >> > Davide Pesavento <pesa@gentoo.org> wrote:
>> >> >
>> >> >> > [...]
>> >> >> >> + # backward compatibility for non-array variables
>> >> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS
>> >> >> >> 2>/dev/null
>> >> >> >> 2>&1)" != "declare -a"* ]]; then
>> >> >> >> + dodoc ${DOCS} || die "dodoc failed"
>> >> >> >> + fi
>> >> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
>> >> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
>> >> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
>> >> >> >> + fi
>> >> >> >> }
>> >> >> >
>> >> >> > maybe issue an eqawarn in that case telling people to convert
>> >> >> > to arrays; some time later make this an ewarn telling
>> >> >> > non-array support will be removed and again later make this a
>> >> >> > die :) (if you take that route i would expect you to start
>> >> >> > converting packages to use arrays)
>> >> >> >
>> >> >>
>> >> >> We have no intention of deprecating non-array variables in
>> >> >> qt4-r2 eclass.
>> >> >
>> >> > why ? having two codepaths for the same thing, one being
>> >> > inferior, sounds like a good reason to deprecate the inferior
>> >> > one :)
>> >> >
>> >> > A.
>> >> >
>> >>
>> >> Maintaining these two codepaths has practically zero cost, while
>> >> forcing every ebuild using qt4-r2 to switch to arrays would waste
>> >> developers' time which is better spent elsewhere.
>> >>
>> >> Furthermore, the non-array variant is not necessarily inferior,
>> >> because it allows you to use bash globbing, brace expansion, etc...
>> >
>> > And arrays stopped to allow that overnight?
>> >
>>
>> I mean that the following won't work as you might expect:
>>
>> DOCS=("*.txt")
>
> I doubt anyone would expect quoted string to be evaluated as glob.
>

It depends on when the expansion is performed, although in the
base.eclass case, DOCS=(*.txt) doesn't work either, because the
quoting happens inside the eclass function.

Anyway, I was just explaining why I argued that "the non-array variant
is not necessarily inferior". Using DOCS="*.txt" is actually a
supported use case and a valid reason not to deprecate non-array
variables.

Regards,
Pesa

Michał Górny 07-15-2012 03:53 PM

RFC: using array variables in qt4-r2.eclass
 
On Sun, 15 Jul 2012 17:36:05 +0200
Davide Pesavento <pesa@gentoo.org> wrote:

> On Sun, Jul 15, 2012 at 3:42 PM, Michał Górny <mgorny@gentoo.org>
> wrote:
> > On Sun, 15 Jul 2012 13:00:47 +0200
> > Davide Pesavento <pesa@gentoo.org> wrote:
> >
> >> On Sat, Jul 14, 2012 at 4:00 PM, Michał Górny <mgorny@gentoo.org>
> >> wrote:
> >> > On Sat, 14 Jul 2012 12:29:59 +0200
> >> > Davide Pesavento <pesa@gentoo.org> wrote:
> >> >
> >> >> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier
> >> >> <aballier@gentoo.org> wrote:
> >> >> > On Fri, 13 Jul 2012 15:26:58 +0200
> >> >> > Davide Pesavento <pesa@gentoo.org> wrote:
> >> >> >
> >> >> >> > [...]
> >> >> >> >> + # backward compatibility for non-array variables
> >> >> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS
> >> >> >> >> 2>/dev/null
> >> >> >> >> 2>&1)" != "declare -a"* ]]; then
> >> >> >> >> + dodoc ${DOCS} || die "dodoc failed"
> >> >> >> >> + fi
> >> >> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p
> >> >> >> >> HTML_DOCS
> >> >> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
> >> >> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml
> >> >> >> >> failed"
> >> >> >> >> + fi
> >> >> >> >> }
> >> >> >> >
> >> >> >> > maybe issue an eqawarn in that case telling people to
> >> >> >> > convert to arrays; some time later make this an ewarn
> >> >> >> > telling non-array support will be removed and again later
> >> >> >> > make this a die :) (if you take that route i would expect
> >> >> >> > you to start converting packages to use arrays)
> >> >> >> >
> >> >> >>
> >> >> >> We have no intention of deprecating non-array variables in
> >> >> >> qt4-r2 eclass.
> >> >> >
> >> >> > why ? having two codepaths for the same thing, one being
> >> >> > inferior, sounds like a good reason to deprecate the inferior
> >> >> > one :)
> >> >> >
> >> >> > A.
> >> >> >
> >> >>
> >> >> Maintaining these two codepaths has practically zero cost, while
> >> >> forcing every ebuild using qt4-r2 to switch to arrays would
> >> >> waste developers' time which is better spent elsewhere.
> >> >>
> >> >> Furthermore, the non-array variant is not necessarily inferior,
> >> >> because it allows you to use bash globbing, brace expansion,
> >> >> etc...
> >> >
> >> > And arrays stopped to allow that overnight?
> >> >
> >>
> >> I mean that the following won't work as you might expect:
> >>
> >> DOCS=("*.txt")
> >
> > I doubt anyone would expect quoted string to be evaluated as glob.
> >
>
> It depends on when the expansion is performed, although in the
> base.eclass case, DOCS=(*.txt) doesn't work either, because the
> quoting happens inside the eclass function.
>
> Anyway, I was just explaining why I argued that "the non-array variant
> is not necessarily inferior". Using DOCS="*.txt" is actually a
> supported use case and a valid reason not to deprecate non-array
> variables.

So, you're saying that you're going to support two different variants
of the variable which work two different ways?

--
Best regards,
Michał Górny


All times are GMT. The time now is 04:53 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.