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 06-23-2012, 05:37 PM
Michael Palimaka
 
Default Patch: Linguas USE support for cmake-utils.eclass

Hi,

A number of package using cmake and qmake currently do something like this:

LANGS="en de fr"
for x in ${LANGS}; do
IUSE="${IUSE} linguas_${x}"
done

This is ugly, so for some time the loop has been included in qt4-r2, and
I'd also like to add it to cmake-utils.


As far as I can see, this change will have no visible effect on ebuilds
that already manually include the loop, and will cause only one package
to get linguas_* flags that it doesn't already have (which I'll fix).


Thoughts?

--- cmake-utils.eclass
+++ cmake-utils.eclass
@@ -20,0 +21,29 @@
+# @ECLASS-VARIABLE: LANGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# In case your application provides various translations, use this
variable to specify
+# them in order to populate "linguas_*" IUSE automatically. Make sure
that you set this

+# variable before inheriting cmake-utils eclass.
+# Example:
+# @CODE
+# LANGS="en el de"
+# @CODE
+for x in ${LANGS}; do
+ IUSE+=" linguas_${x}"
+done
+
+# @ECLASS-VARIABLE: LANGSLONG
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Same as above, but this variable is for LINGUAS that must be in long
format.

+# Remember to set this variable before inheriting cmake-utils eclass.
+# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
+# Example:
+# @CODE
+# LANGS="de_DE hu_HU"
+# @CODE
+for x in ${LANGSLONG}; do
+ IUSE+=" linguas_${x%_*}"
+done
+unset x
+

Best regards,
Michael
 
Old 06-23-2012, 05:57 PM
Michał Górny
 
Default Patch: Linguas USE support for cmake-utils.eclass

On Sun, 24 Jun 2012 03:37:59 +1000
Michael Palimaka <kensington@gentoo.org> wrote:

> --- cmake-utils.eclass
> +++ cmake-utils.eclass
> @@ -20,0 +21,29 @@
> +# @ECLASS-VARIABLE: LANGS

Please prefix.

> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# In case your application provides various translations, use this
> variable to specify
> +# them in order to populate "linguas_*" IUSE automatically. Make
> sure that you set this
> +# variable before inheriting cmake-utils eclass.
> +# Example:
> +# @CODE
> +# LANGS="en el de"
> +# @CODE
> +for x in ${LANGS}; do
> + IUSE+=" linguas_${x}"
> +done
> +
> +# @ECLASS-VARIABLE: LANGSLONG
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Same as above, but this variable is for LINGUAS that must be in
> long format.
> +# Remember to set this variable before inheriting cmake-utils eclass.
> +# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
> +# Example:
> +# @CODE
> +# LANGS="de_DE hu_HU"
> +# @CODE

Shouldn't this be LANGSLONG?

> +for x in ${LANGSLONG}; do
> + IUSE+=" linguas_${x%_*}"
> +done
> +unset x
> +

And how does it exactly differ from LANGS above? Is there a reason
those two can't be coerced into a single variable?

Shouldn't those do something more than setting IUSE? For example,
actually ensuring those LINGUAS will be installed?


--
Best regards,
Michał Górny
 
Old 06-23-2012, 06:32 PM
Mike Frysinger
 
Default Patch: Linguas USE support for cmake-utils.eclass

On Saturday 23 June 2012 13:37:59 Michael Palimaka wrote:
> +for x in ${LANGS}; do
> + IUSE+=" linguas_${x}"
> +done

if you don't want to make it into an array:
IUSE+=" $(printf 'linguas_%s ' ${LANGS})"
-mike
 
Old 06-24-2012, 08:18 AM
Ben de Groot
 
Default Patch: Linguas USE support for cmake-utils.eclass

On 24 June 2012 02:32, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 23 June 2012 13:37:59 Michael Palimaka wrote:
>> +for x in ${LANGS}; do
>> + * * * IUSE+=" linguas_${x}"
>> +done
>
> if you don't want to make it into an array:
> IUSE+=" $(printf 'linguas_%s ' ${LANGS})"
> -mike

What's wrong with the original? Why the subshell?

--
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead
 
Old 06-24-2012, 08:34 AM
Ben de Groot
 
Default Patch: Linguas USE support for cmake-utils.eclass

On 24 June 2012 01:57, Michał Górny <mgorny@gentoo.org> wrote:
> On Sun, 24 Jun 2012 03:37:59 +1000
> Michael Palimaka <kensington@gentoo.org> wrote:
>
>> --- cmake-utils.eclass
>> +++ cmake-utils.eclass
>> @@ -20,0 +21,29 @@
>> +# @ECLASS-VARIABLE: LANGS
>
> Please prefix.
>
>> +# @DEFAULT_UNSET
>> +# @DESCRIPTION:
>> +# In case your application provides various translations, use this
>> variable to specify
>> +# them in order to populate "linguas_*" IUSE automatically. Make
>> sure that you set this
>> +# variable before inheriting cmake-utils eclass.
>> +# Example:
>> +# @CODE
>> +# * LANGS="en el de"
>> +# @CODE
>> +for x in ${LANGS}; do
>> + * * * IUSE+=" linguas_${x}"
>> +done
>> +
>> +# @ECLASS-VARIABLE: LANGSLONG
>> +# @DEFAULT_UNSET
>> +# @DESCRIPTION:
>> +# Same as above, but this variable is for LINGUAS that must be in
>> long format.
>> +# Remember to set this variable before inheriting cmake-utils eclass.
>> +# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
>> +# Example:
>> +# @CODE
>> +# * LANGS="de_DE hu_HU"
>> +# @CODE
>
> Shouldn't this be LANGSLONG?
>
>> +for x in ${LANGSLONG}; do
>> + * * * IUSE+=" linguas_${x%_*}"
>> +done
>> +unset x
>> +
>
> And how does it exactly differ from LANGS above? Is there a reason
> those two can't be coerced into a single variable?

Some linguas correspond 1:1 between the package and portage's
linguas.desc, while others need the long form (e.g. el_GR) for the
package, but the short form (el) is used in portage.

> Shouldn't those do something more than setting IUSE? For example,
> actually ensuring those LINGUAS will be installed?

That would be a nice improvement.

We at qt@ have been discussing this on and off. We would like to
see a linguas.eclass happen, because already now we start having
code duplication. So instead of this duplication of code between
qt4-r2 and cmake-utils eclasses, why not put this into a separate
linguas.eclass that both can inherit?

Obviously the problem with handling more than just setting IUSE
is the variety of ways in which linguas are handled by different
packages and different build systems.

I'll be submitting some additions to qt4-r2.eclass for comments
later.

I hope we can continue this discussion. Ideas are very welcome!

--
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead
 
Old 06-24-2012, 08:48 AM
Michał Górny
 
Default Patch: Linguas USE support for cmake-utils.eclass

On Sun, 24 Jun 2012 16:34:55 +0800
Ben de Groot <yngwin@gentoo.org> wrote:

> On 24 June 2012 01:57, Michał Górny <mgorny@gentoo.org> wrote:
> > On Sun, 24 Jun 2012 03:37:59 +1000
> > Michael Palimaka <kensington@gentoo.org> wrote:
> >
> >> --- cmake-utils.eclass
> >> +++ cmake-utils.eclass
> >> @@ -20,0 +21,29 @@
> >> +# @ECLASS-VARIABLE: LANGS
> >
> > Please prefix.
> >
> >> +# @DEFAULT_UNSET
> >> +# @DESCRIPTION:
> >> +# In case your application provides various translations, use this
> >> variable to specify
> >> +# them in order to populate "linguas_*" IUSE automatically. Make
> >> sure that you set this
> >> +# variable before inheriting cmake-utils eclass.
> >> +# Example:
> >> +# @CODE
> >> +# * LANGS="en el de"
> >> +# @CODE
> >> +for x in ${LANGS}; do
> >> + * * * IUSE+=" linguas_${x}"
> >> +done
> >> +
> >> +# @ECLASS-VARIABLE: LANGSLONG
> >> +# @DEFAULT_UNSET
> >> +# @DESCRIPTION:
> >> +# Same as above, but this variable is for LINGUAS that must be in
> >> long format.
> >> +# Remember to set this variable before inheriting cmake-utils
> >> eclass. +# Look at ${PORTDIR}/profiles/desc/linguas.desc for
> >> details. +# Example:
> >> +# @CODE
> >> +# * LANGS="de_DE hu_HU"
> >> +# @CODE
> >
> > Shouldn't this be LANGSLONG?
> >
> >> +for x in ${LANGSLONG}; do
> >> + * * * IUSE+=" linguas_${x%_*}"
> >> +done
> >> +unset x
> >> +
> >
> > And how does it exactly differ from LANGS above? Is there a reason
> > those two can't be coerced into a single variable?
>
> Some linguas correspond 1:1 between the package and portage's
> linguas.desc, while others need the long form (e.g. el_GR) for the
> package, but the short form (el) is used in portage.

Ah, I see. I was confused because the code doesn't use these vars
anywhere else.

> > Shouldn't those do something more than setting IUSE? For example,
> > actually ensuring those LINGUAS will be installed?
>
> That would be a nice improvement.
>
> We at qt@ have been discussing this on and off. We would like to
> see a linguas.eclass happen, because already now we start having
> code duplication. So instead of this duplication of code between
> qt4-r2 and cmake-utils eclasses, why not put this into a separate
> linguas.eclass that both can inherit?

Yes, it's a much better idea than keeping two copies in sync.

> Obviously the problem with handling more than just setting IUSE
> is the variety of ways in which linguas are handled by different
> packages and different build systems.

Yes, that's one problem. Certainly, those flags have to be handled
by the build system and the disabled LINGUAS should not be built
at all. If there are built already, there's no point in removing them
later.

Of course, another question is whether LINGUAS does actually benefit
users. If compiling another .po files takes a lot of time, probably
yes. If it doesn't, I would think about getting rid of that and just
installing everything. Additional removal can be handled through
INSTALL_MASK.

--
Best regards,
Michał Górny
 
Old 06-24-2012, 01:56 PM
Michael Palimaka
 
Default Patch: Linguas USE support for cmake-utils.eclass

On 2012-06-24 18:34, Ben de Groot wrote:

We at qt@ have been discussing this on and off. We would like to
see a linguas.eclass happen, because already now we start having
code duplication. So instead of this duplication of code between
qt4-r2 and cmake-utils eclasses, why not put this into a separate
linguas.eclass that both can inherit?

>
> Obviously the problem with handling more than just setting IUSE
> is the variety of ways in which linguas are handled by different
> packages and different build systems.

I agree that linguas.eclass is a good idea, but how possible is it to
incorporate the various build systems, and the various approaches used
by each package?


If you have some ideas, I'm more than happy to help.
 
Old 06-24-2012, 02:23 PM
Ben de Groot
 
Default Patch: Linguas USE support for cmake-utils.eclass

On 24 June 2012 21:56, Michael Palimaka <kensington@gentoo.org> wrote:
> On 2012-06-24 18:34, Ben de Groot wrote:
>>
>> We at qt@ have been discussing this on and off. We would like to
>> see a linguas.eclass happen, because already now we start having
>> code duplication. So instead of this duplication of code between
>> qt4-r2 and cmake-utils eclasses, why not put this into a separate
>> linguas.eclass that both can inherit?

Actually, I was just thinking, since we are talking about two variables
and a few lines of code, maybe it would be better to add this to
base.eclass?

>> Obviously the problem with handling more than just setting IUSE
>> is the variety of ways in which linguas are handled by different
>> packages and different build systems.
>
> I agree that linguas.eclass is a good idea, but how possible is it to
> incorporate the various build systems, and the various approaches used by
> each package?
>
> If you have some ideas, I'm more than happy to help.

We could look at the most common use cases, and see if we can
come up with something generic that would work for most of
those.

We have some code in the qt overlay, but that is obviously
Qt specific.

--
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead
 
Old 06-24-2012, 02:33 PM
Michael Palimaka
 
Default Patch: Linguas USE support for cmake-utils.eclass

On 2012-06-24 18:48, Michał Górny wrote:

Of course, another question is whether LINGUAS does actually benefit
users. If compiling another .po files takes a lot of time, probably
yes. If it doesn't, I would think about getting rid of that and just
installing everything. Additional removal can be handled through
INSTALL_MASK.



I personally dislike installing numerous files that are useless to me
and enjoy the visibility the use flag gives.

I know this is not for everyone - I offer it as an option only.
 
Old 06-24-2012, 02:43 PM
Michał Górny
 
Default Patch: Linguas USE support for cmake-utils.eclass

On Sun, 24 Jun 2012 22:23:17 +0800
Ben de Groot <yngwin@gentoo.org> wrote:

> On 24 June 2012 21:56, Michael Palimaka <kensington@gentoo.org> wrote:
> > On 2012-06-24 18:34, Ben de Groot wrote:
> >>
> >> We at qt@ have been discussing this on and off. We would like to
> >> see a linguas.eclass happen, because already now we start having
> >> code duplication. So instead of this duplication of code between
> >> qt4-r2 and cmake-utils eclasses, why not put this into a separate
> >> linguas.eclass that both can inherit?
>
> Actually, I was just thinking, since we are talking about two
> variables and a few lines of code, maybe it would be better to add
> this to base.eclass?

That would change its API and result in possible lot of broken ebuilds.
Not to mention that base eclass currently doesn't require adding
additional phase functions to actually handle what it sets.

--
Best regards,
Michał Górny
 

Thread Tools




All times are GMT. The time now is 02:04 AM.

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