public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
@ 2012-11-08 18:18 Jeroen Roovers
  2012-11-08 18:37 ` Rick "Zero_Chaos" Farina
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jeroen Roovers @ 2012-11-08 18:18 UTC (permalink / raw
  To: gentoo-dev

For a while I've been thinking that it would be sweet to feed all
variants (enabled/disabled) of several USE flags to a script to automate
testing with different USE flag combinations.

USE=" x  y"
USE="-x  y"
USE=" x -y"
USE="-x -y"

This should be so simple to script but I can't figure out how to do it.
Anyone have any ideas or a ready example script?


     jer


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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:18 [gentoo-dev] A script/binary that iterates over arguments and spits out different variants? Jeroen Roovers
@ 2012-11-08 18:37 ` Rick "Zero_Chaos" Farina
  2012-11-09  6:07   ` Thomas Kahle
  2012-11-08 18:41 ` Fabian Groffen
  2012-11-08 18:54 ` Alexandre Rostovtsev
  2 siblings, 1 reply; 8+ messages in thread
From: Rick "Zero_Chaos" Farina @ 2012-11-08 18:37 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/08/2012 01:18 PM, Jeroen Roovers wrote:
> For a while I've been thinking that it would be sweet to feed all
> variants (enabled/disabled) of several USE flags to a script to automate
> testing with different USE flag combinations.
> 
> USE=" x  y"
> USE="-x  y"
> USE=" x -y"
> USE="-x -y"
> 
> This should be so simple to script but I can't figure out how to do it.
> Anyone have any ideas or a ready example script?

if I'm not mistaken app-portage/tatt already can test all the possible
use flag combinations of a package. it sucks a little to use but it's
moderately functional.

- -Zero_Chaos
> 
> 
>      jer
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQm/v6AAoJEKXdFCfdEflKcxMP/0eQFHhlF7TMZbk391IqL09K
6DK02w/uOKtR7MfCJicjmAcr93fmW3B09D1/k7OzGTjnT8HJ0M4kUCFIDDyDI9ns
GbNyyYqmjkjdd8kU+bb5ABAhM7FTdkjzqhPQNp6nQ+P/S98/6D8VhtLDsx2fpEov
0kTeoY/mpk3PWYqEVm7MLvl+T24fZOP8XUE4SfVbSbCGS2CY0ROVS9Ra2UNGIqbL
lNaH0qaje2HSqGOHseLTLN2ryxJ+bfac6Lld9Dpwpi/6TkrEd72APwT5QCW6gKsz
UBEYwy9SixscHfjO3D3iITu84CdormDArOZifA+TOgY7hhAm9JTlPFsXTxKosW7q
TE6rW1N5jzKxQ/6DyypbckLZJNC9vxUU4i4YBx6TNs0xdOKbfF4Vi4yUuEm+iH1e
T9hpodV1NYPMHnOoxEV5XfnPK1dZm5nrSBlE7VmLZEoib5qkMqEQ04fr1mWa6b8X
XH4wzqgAIg6j7+z7KWBqTOCq50yE0Mk9qMcuDFVEhVPeEDRubqkG/Wc6ft7VDv+K
WsSaxb6/N0D7Bg+mB66Pu6raDMocKYYkjId1R1Hi1sfFhZYt/5fSfs1LWFIybLaL
CFdDfyOxFGGa/3Wi1CA7690Tn7to6Q/5vFt0Wsvgz55lrvpnPdDYEQKntbD6H93B
dikEJHfhIeGNSN3B0So2
=5yRv
-----END PGP SIGNATURE-----


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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:18 [gentoo-dev] A script/binary that iterates over arguments and spits out different variants? Jeroen Roovers
  2012-11-08 18:37 ` Rick "Zero_Chaos" Farina
@ 2012-11-08 18:41 ` Fabian Groffen
  2012-11-08 18:46   ` Ian Stakenvicius
  2012-11-08 18:46   ` Fabian Groffen
  2012-11-08 18:54 ` Alexandre Rostovtsev
  2 siblings, 2 replies; 8+ messages in thread
From: Fabian Groffen @ 2012-11-08 18:41 UTC (permalink / raw
  To: gentoo-dev

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

On 08-11-2012 19:18:10 +0100, Jeroen Roovers wrote:
> For a while I've been thinking that it would be sweet to feed all
> variants (enabled/disabled) of several USE flags to a script to automate
> testing with different USE flag combinations.
> 
> USE=" x  y"
> USE="-x  y"
> USE=" x -y"
> USE="-x -y"
> 
> This should be so simple to script but I can't figure out how to do it.
> Anyone have any ideas or a ready example script?

% echo {x,-x}" "{y,-y}
x y x -y -x y -x -y

Is that what you need?


-- 
Fabian Groffen
Gentoo on a different level

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

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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:41 ` Fabian Groffen
@ 2012-11-08 18:46   ` Ian Stakenvicius
  2012-11-08 19:03     ` Fabian Groffen
  2012-11-08 18:46   ` Fabian Groffen
  1 sibling, 1 reply; 8+ messages in thread
From: Ian Stakenvicius @ 2012-11-08 18:46 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 08/11/12 01:41 PM, Fabian Groffen wrote:
> On 08-11-2012 19:18:10 +0100, Jeroen Roovers wrote:
>> For a while I've been thinking that it would be sweet to feed
>> all variants (enabled/disabled) of several USE flags to a script
>> to automate testing with different USE flag combinations.
>> 
>> USE=" x  y" USE="-x  y" USE=" x -y" USE="-x -y"
>> 
>> This should be so simple to script but I can't figure out how to
>> do it. Anyone have any ideas or a ready example script?
> 
> % echo {x,-x}" "{y,-y} x y x -y -x y -x -y
> 
> Is that what you need?
> 
> 


I'd expect the idea is to parse IUSE and run an individual test for
every combination of use flags (ie, n(IUSE) factorial tests)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlCb/fgACgkQ2ugaI38ACPC40AD8COEU5UJmZiWM95KpVfs8YfSH
r58FP/htfcTP+t0N+8ABAIfgWGNB4jSBBXRTbLvXKbnbhgDbDiPYPdj4Gsj2u1HQ
=9ulP
-----END PGP SIGNATURE-----


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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:41 ` Fabian Groffen
  2012-11-08 18:46   ` Ian Stakenvicius
@ 2012-11-08 18:46   ` Fabian Groffen
  1 sibling, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2012-11-08 18:46 UTC (permalink / raw
  To: gentoo-dev

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

On 08-11-2012 19:41:41 +0100, Fabian Groffen wrote:
> On 08-11-2012 19:18:10 +0100, Jeroen Roovers wrote:
> > For a while I've been thinking that it would be sweet to feed all
> > variants (enabled/disabled) of several USE flags to a script to automate
> > testing with different USE flag combinations.
> > 
> > USE=" x  y"
> > USE="-x  y"
> > USE=" x -y"
> > USE="-x -y"
> > 
> > This should be so simple to script but I can't figure out how to do it.
> > Anyone have any ideas or a ready example script?
> 
> % echo {x,-x}" "{y,-y}
> x y x -y -x y -x -y
> 
> Is that what you need?

Just in case...

$ echo $'\n'"USE=\""{x,-x}" "{y,-y}\"""

USE="x y" 
USE="x -y" 
USE="-x y" 
USE="-x -y"

Fabian


-- 
Fabian Groffen
Gentoo on a different level

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

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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:18 [gentoo-dev] A script/binary that iterates over arguments and spits out different variants? Jeroen Roovers
  2012-11-08 18:37 ` Rick "Zero_Chaos" Farina
  2012-11-08 18:41 ` Fabian Groffen
@ 2012-11-08 18:54 ` Alexandre Rostovtsev
  2 siblings, 0 replies; 8+ messages in thread
From: Alexandre Rostovtsev @ 2012-11-08 18:54 UTC (permalink / raw
  To: gentoo-dev

On Thu, 2012-11-08 at 19:18 +0100, Jeroen Roovers wrote:
> For a while I've been thinking that it would be sweet to feed all
> variants (enabled/disabled) of several USE flags to a script to automate
> testing with different USE flag combinations.
> 
> USE=" x  y"
> USE="-x  y"
> USE=" x -y"
> USE="-x -y"
> 
> This should be so simple to script but I can't figure out how to do it.
> Anyone have any ideas or a ready example script?
> 
> 
>      jer
> 

USE_variable=( foo bar baz )
USE_const=( wombat )

(( n = 0 ))
while (( n < 2**${#USE_variable[@]} )); do
    USE=${USE_const[@]}
    (( i = 0 ))
    while (( i < ${#USE_variable[@]} )); do
        if (( n & 2**i )); then
            USE+=" ${USE_variable[$i]}"
        else
            USE+=" -${USE_variable[$i]}"
        fi
        (( i++ ))
    done
    (( n++ ))
    echo ${USE}
done

# outputs:
# wombat -foo -bar -baz
# wombat foo -bar -baz
# wombat -foo bar -baz
# wombat foo bar -baz
# wombat -foo -bar baz
# wombat foo -bar baz
# wombat -foo bar baz
# wombat foo bar baz



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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:46   ` Ian Stakenvicius
@ 2012-11-08 19:03     ` Fabian Groffen
  0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2012-11-08 19:03 UTC (permalink / raw
  To: gentoo-dev

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

On 08-11-2012 13:46:16 -0500, Ian Stakenvicius wrote:
> I'd expect the idea is to parse IUSE and run an individual test for
> every combination of use flags (ie, n(IUSE) factorial tests)

pfff...

combs=
for flag in $( eval $(grep '^IUSE=' libdv-1.0.0-r2.ebuild) ; echo ${IUSE} ) ; do
    flag=${flag#+}
    flag=${flag#-}
    combs+='" "{'"${flag},-${flag}"'}'
done
combs="\$'\\n'IUSE=\\\"${combs#\" \"}\\\""
eval "echo ${combs}"


IUSE="debug sdl static-libs xv" 
IUSE="debug sdl static-libs -xv" 
IUSE="debug sdl -static-libs xv" 
IUSE="debug sdl -static-libs -xv" 
IUSE="debug -sdl static-libs xv" 
IUSE="debug -sdl static-libs -xv" 
IUSE="debug -sdl -static-libs xv" 
IUSE="debug -sdl -static-libs -xv" 
IUSE="-debug sdl static-libs xv" 
IUSE="-debug sdl static-libs -xv" 
IUSE="-debug sdl -static-libs xv" 
IUSE="-debug sdl -static-libs -xv" 
IUSE="-debug -sdl static-libs xv" 
IUSE="-debug -sdl static-libs -xv" 
IUSE="-debug -sdl -static-libs xv" 
IUSE="-debug -sdl -static-libs -xv"

Fabian


-- 
Fabian Groffen
Gentoo on a different level

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

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

* Re: [gentoo-dev] A script/binary that iterates over arguments and spits out different variants?
  2012-11-08 18:37 ` Rick "Zero_Chaos" Farina
@ 2012-11-09  6:07   ` Thomas Kahle
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Kahle @ 2012-11-09  6:07 UTC (permalink / raw
  To: gentoo-dev

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

On 13:37 Thu 08 Nov 2012, Rick "Zero_Chaos" Farina wrote:
> On 11/08/2012 01:18 PM, Jeroen Roovers wrote:
> > For a while I've been thinking that it would be sweet to feed all
> > variants (enabled/disabled) of several USE flags to a script to automate
> > testing with different USE flag combinations.
> > 
> > USE=" x  y"
> > USE="-x  y"
> > USE=" x -y"
> > USE="-x -y"
> > 
> > This should be so simple to script but I can't figure out how to do it.
> > Anyone have any ideas or a ready example script?
> 
> if I'm not mistaken app-portage/tatt already can test all the possible
> use flag combinations of a package. it sucks a little to use but it's
> moderately functional.

It's used to write scripts for testing USE combinations and reverse
dependencies and also for stabilizing.  It can filter USE flags that are
irrelevant like "linguas_*", etc.  If 2^{number of flags} is too much it
will give you a random subset, etc.  It can grab the necessary
information from bugzilla if you just give it a bugnumber and it can
also do many packages in one run.  The scripts are created using
templates, so in principle it should be pretty flexible.  I agree, it
sucks a little, but contributions are welcome.

Cheers,
Thomas




-- 
Thomas Kahle
http://dev.gentoo.org/~tomka/

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

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

end of thread, other threads:[~2012-11-09  6:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08 18:18 [gentoo-dev] A script/binary that iterates over arguments and spits out different variants? Jeroen Roovers
2012-11-08 18:37 ` Rick "Zero_Chaos" Farina
2012-11-09  6:07   ` Thomas Kahle
2012-11-08 18:41 ` Fabian Groffen
2012-11-08 18:46   ` Ian Stakenvicius
2012-11-08 19:03     ` Fabian Groffen
2012-11-08 18:46   ` Fabian Groffen
2012-11-08 18:54 ` Alexandre Rostovtsev

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