public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] huse: new helper for low level eclass writers
@ 2011-10-19 18:05 Mike Frysinger
  2011-10-19 18:25 ` Mike Frysinger
  2011-10-19 18:53 ` Brian Harring
  0 siblings, 2 replies; 13+ messages in thread
From: Mike Frysinger @ 2011-10-19 18:05 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

i wrote a new func for toolchain.eclass: huse.  this is because the 
toolchain.eclass supports multiple versions in parallel, and the IUSE value 
can vary greatly between them.  so doing `use foo` without checking IUSE first 
doesn't work.  since i got a request to use this in other eclasses (for the 
same reason), i figured i'd move it to eutils.eclass so more people can benefit.

now that we have "in_iuse" in eutils.eclass (with all the caveats), i'll be 
adding huse:
	huse() {
		in_iuse $1 || return 1
		use $1
	}

any comments before i publish ?
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-19 18:05 [gentoo-dev] huse: new helper for low level eclass writers Mike Frysinger
@ 2011-10-19 18:25 ` Mike Frysinger
  2011-10-19 18:53 ` Brian Harring
  1 sibling, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2011-10-19 18:25 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 577 bytes --]

On Wednesday 19 October 2011 14:05:50 Mike Frysinger wrote:
> now that we have "in_iuse" in eutils.eclass (with all the caveats), i'll be
> adding huse:
> 	huse() {
> 		in_iuse $1 || return 1
> 		use $1
> 	}

actually, after posting this, "iuse" is probably a better name.  "huse" came 
up because the code constructs i was using before was like:
	has foo ${IUSE} && use foo && .....
which collapses into:
	h[as foo ${IUSE} && ]use foo && ...
	huse foo && ...

so new proposal for those who love 1 liners:
	iuse() { in_iuse $1 && use $1 || return 1 ; }
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-19 18:05 [gentoo-dev] huse: new helper for low level eclass writers Mike Frysinger
  2011-10-19 18:25 ` Mike Frysinger
@ 2011-10-19 18:53 ` Brian Harring
  2011-10-19 19:26   ` Mike Frysinger
  2011-10-19 19:50   ` Michał Górny
  1 sibling, 2 replies; 13+ messages in thread
From: Brian Harring @ 2011-10-19 18:53 UTC (permalink / raw
  To: gentoo-dev

On Wed, Oct 19, 2011 at 02:05:50PM -0400, Mike Frysinger wrote:
> i wrote a new func for toolchain.eclass: huse.  this is because the 
> toolchain.eclass supports multiple versions in parallel, and the IUSE value 
> can vary greatly between them.  so doing `use foo` without checking IUSE first 
> doesn't work.  since i got a request to use this in other eclasses (for the 
> same reason), i figured i'd move it to eutils.eclass so more people can benefit.
> 
> now that we have "in_iuse" in eutils.eclass (with all the caveats), i'll be 
> adding huse:
> 	huse() {
> 		in_iuse $1 || return 1
> 		use $1
> 	}
> 
> any comments before i publish ?

Call it safe_use.
~brian



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-19 18:53 ` Brian Harring
@ 2011-10-19 19:26   ` Mike Frysinger
  2011-10-19 19:40     ` Brian Harring
  2011-10-19 19:50   ` Michał Górny
  1 sibling, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2011-10-19 19:26 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 883 bytes --]

On Wednesday 19 October 2011 14:53:07 Brian Harring wrote:
> On Wed, Oct 19, 2011 at 02:05:50PM -0400, Mike Frysinger wrote:
> > i wrote a new func for toolchain.eclass: huse.  this is because the
> > toolchain.eclass supports multiple versions in parallel, and the IUSE
> > value can vary greatly between them.  so doing `use foo` without
> > checking IUSE first doesn't work.  since i got a request to use this in
> > other eclasses (for the same reason), i figured i'd move it to
> > eutils.eclass so more people can benefit.
> > 
> > now that we have "in_iuse" in eutils.eclass (with all the caveats), i'll
> > be
> > 
> > adding huse:
> > 	huse() {
> > 	
> > 		in_iuse $1 || return 1
> > 		use $1
> > 	
> > 	}
> > 
> > any comments before i publish ?
> 
> Call it safe_use.

safe for who ?  that implies to me much more vagueness than "iuse" ...
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-19 19:26   ` Mike Frysinger
@ 2011-10-19 19:40     ` Brian Harring
  2011-10-20  5:26       ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Brian Harring @ 2011-10-19 19:40 UTC (permalink / raw
  To: gentoo-dev

On Wed, Oct 19, 2011 at 03:26:21PM -0400, Mike Frysinger wrote:
> On Wednesday 19 October 2011 14:53:07 Brian Harring wrote:
> > On Wed, Oct 19, 2011 at 02:05:50PM -0400, Mike Frysinger wrote:
> > > i wrote a new func for toolchain.eclass: huse.  this is because the
> > > toolchain.eclass supports multiple versions in parallel, and the IUSE
> > > value can vary greatly between them.  so doing `use foo` without
> > > checking IUSE first doesn't work.  since i got a request to use this in
> > > other eclasses (for the same reason), i figured i'd move it to
> > > eutils.eclass so more people can benefit.
> > > 
> > > now that we have "in_iuse" in eutils.eclass (with all the caveats), i'll
> > > be
> > > 
> > > adding huse:
> > > 	huse() {
> > > 	
> > > 		in_iuse $1 || return 1
> > > 		use $1
> > > 	
> > > 	}
> > > 
> > > any comments before i publish ?
> > 
> > Call it safe_use.
> 
> safe for who ?  that implies to me much more vagueness than "iuse" ...

Safe in the sense it does basic IUSE checks prior, so it doesn't 
trigger QA warnings for when the ebuild doesn't support the flag.

Name's a bit off though considering if the host was amd64, `huse amd64`
would return 1 since it's not in IUSE.

Either way, the 'iuse' naming rather sucks imo; that implies the 
equivalent of `use` (is this flag in iuse?) rather than "is this flag 
in iuse and use".

If you're primarily doing this to bypass the QA warnings, than jam 
safe into the name, and/or while making sure the docs are clear about 
it.

Either way, go nuts- rather not get into a bikeshedding discussion on 
this one. ;)
~harring



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-19 18:53 ` Brian Harring
  2011-10-19 19:26   ` Mike Frysinger
@ 2011-10-19 19:50   ` Michał Górny
  1 sibling, 0 replies; 13+ messages in thread
From: Michał Górny @ 2011-10-19 19:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: ferringb

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

On Wed, 19 Oct 2011 11:53:07 -0700
Brian Harring <ferringb@gmail.com> wrote:

> On Wed, Oct 19, 2011 at 02:05:50PM -0400, Mike Frysinger wrote:
> > i wrote a new func for toolchain.eclass: huse.  this is because the 
> > toolchain.eclass supports multiple versions in parallel, and the
> > IUSE value can vary greatly between them.  so doing `use foo`
> > without checking IUSE first doesn't work.  since i got a request to
> > use this in other eclasses (for the same reason), i figured i'd
> > move it to eutils.eclass so more people can benefit.
> > 
> > now that we have "in_iuse" in eutils.eclass (with all the caveats),
> > i'll be adding huse:
> > 	huse() {
> > 		in_iuse $1 || return 1
> > 		use $1
> > 	}
> > 
> > any comments before i publish ?
> 
> Call it safe_use.

Maybe something off 'default' instead? It could be made a little like
USE defaults, falling back to the default value when USE isn't declared.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-19 19:40     ` Brian Harring
@ 2011-10-20  5:26       ` Mike Frysinger
  2011-10-20 15:58         ` Donnie Berkholz
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2011-10-20  5:26 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 234 bytes --]

On Wednesday 19 October 2011 15:40:50 Brian Harring wrote:
> Name's a bit off though considering if the host was amd64, `huse amd64`
> would return 1 since it's not in IUSE.

good point.  how about "iuse_use" ?  or "use_iuse" ?
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-20  5:26       ` Mike Frysinger
@ 2011-10-20 15:58         ` Donnie Berkholz
  2011-10-20 16:22           ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Donnie Berkholz @ 2011-10-20 15:58 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

On 01:26 Thu 20 Oct     , Mike Frysinger wrote:
> On Wednesday 19 October 2011 15:40:50 Brian Harring wrote:
> > Name's a bit off though considering if the host was amd64, `huse amd64`
> > would return 1 since it's not in IUSE.
> 
> good point.  how about "iuse_use" ?  or "use_iuse" ?
> -mike

use_in_iuse ?

-- 
Thanks,
Donnie

Donnie Berkholz
Council Member / Sr. Developer
Gentoo Linux
Blog: http://dberkholz.com

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-20 15:58         ` Donnie Berkholz
@ 2011-10-20 16:22           ` Mike Frysinger
  2011-10-20 19:22             ` Donnie Berkholz
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2011-10-20 16:22 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 486 bytes --]

On Thursday 20 October 2011 11:58:44 Donnie Berkholz wrote:
> On 01:26 Thu 20 Oct     , Mike Frysinger wrote:
> > On Wednesday 19 October 2011 15:40:50 Brian Harring wrote:
> > > Name's a bit off though considering if the host was amd64, `huse amd64`
> > > would return 1 since it's not in IUSE.
> > 
> > good point.  how about "iuse_use" ?  or "use_iuse" ?
> 
> use_in_iuse ?

to me, that sounds like "is the use flag in iuse".  but maybe i'm over thinking 
things.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-20 16:22           ` Mike Frysinger
@ 2011-10-20 19:22             ` Donnie Berkholz
  2011-10-20 20:01               ` "Paweł Hajdan, Jr."
  0 siblings, 1 reply; 13+ messages in thread
From: Donnie Berkholz @ 2011-10-20 19:22 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

On 12:22 Thu 20 Oct     , Mike Frysinger wrote:
> On Thursday 20 October 2011 11:58:44 Donnie Berkholz wrote:
> > On 01:26 Thu 20 Oct     , Mike Frysinger wrote:
> > > On Wednesday 19 October 2011 15:40:50 Brian Harring wrote:
> > > > Name's a bit off though considering if the host was amd64, `huse amd64`
> > > > would return 1 since it's not in IUSE.
> > > 
> > > good point.  how about "iuse_use" ?  or "use_iuse" ?
> > 
> > use_in_iuse ?
> 
> to me, that sounds like "is the use flag in iuse".  but maybe i'm over thinking 
> things.

alright, use_if_iuse. That's my last bikeshed for today.


-- 
Thanks,
Donnie

Donnie Berkholz
Council Member / Sr. Developer
Gentoo Linux
Blog: http://dberkholz.com

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-20 19:22             ` Donnie Berkholz
@ 2011-10-20 20:01               ` "Paweł Hajdan, Jr."
  2011-10-20 20:43                 ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: "Paweł Hajdan, Jr." @ 2011-10-20 20:01 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]

On 10/20/11 9:22 PM, Donnie Berkholz wrote:
> alright, use_if_iuse. That's my last bikeshed for today.

I think this is the best one. I didn't really like any of the previously
proposed names, but this one is good.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 203 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-20 20:01               ` "Paweł Hajdan, Jr."
@ 2011-10-20 20:43                 ` Mike Frysinger
  2011-10-26 23:27                   ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2011-10-20 20:43 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 386 bytes --]

On Thursday 20 October 2011 16:01:01 Paweł Hajdan, Jr. wrote:
> On 10/20/11 9:22 PM, Donnie Berkholz wrote:
> > alright, use_if_iuse. That's my last bikeshed for today.
> 
> I think this is the best one. I didn't really like any of the previously
> proposed names, but this one is good.

yeah, this works for me too

i'll commit this later if there's no more feedback
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] huse: new helper for low level eclass writers
  2011-10-20 20:43                 ` Mike Frysinger
@ 2011-10-26 23:27                   ` Mike Frysinger
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2011-10-26 23:27 UTC (permalink / raw
  To: gentoo-dev

hopefully i didn't break anything before i go to sleep ;D
http://sources.gentoo.org/eclass/toolchain.eclass?r1=1.474&r2=1.475
http://sources.gentoo.org/eclass/eutils.eclass?r1=1.366&r2=1.367
-mike



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-10-26 23:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-19 18:05 [gentoo-dev] huse: new helper for low level eclass writers Mike Frysinger
2011-10-19 18:25 ` Mike Frysinger
2011-10-19 18:53 ` Brian Harring
2011-10-19 19:26   ` Mike Frysinger
2011-10-19 19:40     ` Brian Harring
2011-10-20  5:26       ` Mike Frysinger
2011-10-20 15:58         ` Donnie Berkholz
2011-10-20 16:22           ` Mike Frysinger
2011-10-20 19:22             ` Donnie Berkholz
2011-10-20 20:01               ` "Paweł Hajdan, Jr."
2011-10-20 20:43                 ` Mike Frysinger
2011-10-26 23:27                   ` Mike Frysinger
2011-10-19 19:50   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox