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 03-23-2012, 07:15 AM
Alexis Ballier
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

Hi,

Oasis [1] is becoming the de factor standard for ocaml packages. I've
been bored of copy/pasting always the same code from ebuilds to ebuilds
and thus decided to write an eclass simplifying everything.

Attached: said eclass, a diff of a random dev-ml package I've
converted to illustrate and said random ebuild now.

Comments welcome,

Alexis.

[1] http://oasis.forge.ocamlcore.org/
 
Old 03-23-2012, 02:58 PM
Mike Gilbert
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

On Fri, Mar 23, 2012 at 4:15 AM, Alexis Ballier <aballier@gentoo.org> wrote:

> DEPEND=">=dev-lang/ocaml-3.12[ocamlopt?]"
> DEPEND="${RDEPEND}"

That looks like a typo.

> oasis_src_compile() {
> oasis_src_compile_no_doc
> if has doc ${IUSE} && use doc; then
> ocaml setup.ml -doc || die
> fi
> }

This should probably call use_if_iuse from eutils.eclass, which
handles IUSE="[+-]doc".
 
Old 03-23-2012, 03:02 PM
Ciaran McCreesh
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

On Fri, 23 Mar 2012 11:58:47 -0400
Mike Gilbert <floppym@gentoo.org> wrote:
> > oasis_src_compile() {
> > oasis_src_compile_no_doc
> > if has doc ${IUSE} && use doc; then
> > ocaml setup.ml -doc || die
> > fi
> > }
>
> This should probably call use_if_iuse from eutils.eclass, which
> handles IUSE="[+-]doc".

Actually, neither way works. The spec says:

Global variables must only contain invariant values
(see~
ef{sec:metadata-invariance}). If a global variable's value is
invariant, it may have the value that would be generated at any
given point in the build sequence.

So you can't rely upon IUSE having the "merged" value in an eclass.

--
Ciaran McCreesh
 
Old 03-23-2012, 03:14 PM
Ian Stakenvicius
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

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

On 23/03/12 12:02 PM, Ciaran McCreesh wrote:
> On Fri, 23 Mar 2012 11:58:47 -0400 Mike Gilbert
> <floppym@gentoo.org> wrote:
>>> oasis_src_compile() { oasis_src_compile_no_doc if has doc
>>> ${IUSE} && use doc; then ocaml setup.ml -doc || die fi }
>>
>> This should probably call use_if_iuse from eutils.eclass, which
>> handles IUSE="[+-]doc".
>
> Actually, neither way works. The spec says:
>
> Global variables must only contain invariant values
> (see~
ef{sec:metadata-invariance}). If a global variable's value
> is invariant, it may have the value that would be generated at any
> given point in the build sequence.
>
> So you can't rely upon IUSE having the "merged" value in an
> eclass.
>

I don't know if I follow this one or not. When inheriting an eclass,
all entities within the eclass get merged into the ebuild. As long as
there aren't any special conditional tricks being used to assign to
global variables like IUSE, it would still be invariant wouldn't it?

I think 'any point in the build sequence' is still
post-eclass-inheritance isn't it?



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

iF4EAREIAAYFAk9soW8ACgkQAJxUfCtlWe1UJQEAuTQriXmsu6 YKcpeADGusTNdZ
k8Vr99LdEFwyXicZHMsBAN2bo95GvLvdrpVEj8h1THQ4HMZDvP Rx0o/yrWzjxGNZ
=+e3P
-----END PGP SIGNATURE-----
 
Old 03-23-2012, 03:19 PM
Ciaran McCreesh
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

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

On Fri, 23 Mar 2012 12:14:39 -0400
Ian Stakenvicius <axs@gentoo.org> wrote:
> I don't know if I follow this one or not. When inheriting an eclass,
> all entities within the eclass get merged into the ebuild. As long as
> there aren't any special conditional tricks being used to assign to
> global variables like IUSE, it would still be invariant wouldn't it?

The point is that the merging might be done inside the package manager
(not in bash code) on the IUSE metadata variable, and the changes don't
have to be reflected in the IUSE environment variable inside the ebuild.

> I think 'any point in the build sequence' is still
> post-eclass-inheritance isn't it?

Nope. It's also at any point during the sourcing of any of the files.

- --
Ciaran McCreesh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iEYEARECAAYFAk9sonsACgkQ96zL6DUtXhEtFgCgyT/pUwKQIaLE8e28U8P0uS3x
HF8An1frYjZvoNYSC2/Qs1eNzqdlgVzT
=Kj+k
-----END PGP SIGNATURE-----
 
Old 03-23-2012, 03:32 PM
Ian Stakenvicius
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

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

On 23/03/12 12:19 PM, Ciaran McCreesh wrote:
> On Fri, 23 Mar 2012 12:14:39 -0400 Ian Stakenvicius
> <axs@gentoo.org> wrote:
>> I don't know if I follow this one or not. When inheriting an
>> eclass, all entities within the eclass get merged into the
>> ebuild. As long as there aren't any special conditional tricks
>> being used to assign to global variables like IUSE, it would
>> still be invariant wouldn't it?
>
> The point is that the merging might be done inside the package
> manager (not in bash code) on the IUSE metadata variable, and the
> changes don't have to be reflected in the IUSE environment variable
> inside the ebuild.

If that was the case, then eclasses could no longer append deps to
(R)DEPEND, either .....?


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

iF4EAREIAAYFAk9spYUACgkQAJxUfCtlWe1g+QEA1NAl+nl3zC EOmTIjCN1271r7
pCJNO7aCW/iNrXniCQUA/3j1xktcStPmQL8rXPRLSjMy+vqBsclWQwFHa4eytu6B
=g3Dz
-----END PGP SIGNATURE-----
 
Old 03-23-2012, 03:36 PM
Ian Stakenvicius
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

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

On 23/03/12 12:32 PM, Ian Stakenvicius wrote:
> On 23/03/12 12:19 PM, Ciaran McCreesh wrote:
>> On Fri, 23 Mar 2012 12:14:39 -0400 Ian Stakenvicius
>> <axs@gentoo.org> wrote:
>>> I don't know if I follow this one or not. When inheriting an
>>> eclass, all entities within the eclass get merged into the
>>> ebuild. As long as there aren't any special conditional
>>> tricks being used to assign to global variables like IUSE, it
>>> would still be invariant wouldn't it?
>
>> The point is that the merging might be done inside the package
>> manager (not in bash code) on the IUSE metadata variable, and
>> the changes don't have to be reflected in the IUSE environment
>> variable inside the ebuild.
>
> If that was the case, then eclasses could no longer append deps to
> (R)DEPEND, either .....?

Err, nvm.. i think i'm following the difference now. functions like
has_version and so forth don't actually work on the value(s) of
*DEPEND themselves, so in the case of (R)DEPEND it wouldn't matter of
the package manager didn't expose the merge.


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

iF4EAREIAAYFAk9spp8ACgkQAJxUfCtlWe1a2wD/YsHDM1hYik+d46fJ90yckI/U
OKr1ThK6hhJTbjmqGpgBAMekpXzx8NFIPerRPm037FgWQiCuUP DezAhmj8S73EPV
=CNHZ
-----END PGP SIGNATURE-----
 
Old 03-23-2012, 03:43 PM
Ciaran McCreesh
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

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

On Fri, 23 Mar 2012 12:32:05 -0400
Ian Stakenvicius <axs@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 23/03/12 12:19 PM, Ciaran McCreesh wrote:
> > On Fri, 23 Mar 2012 12:14:39 -0400 Ian Stakenvicius
> > <axs@gentoo.org> wrote:
> >> I don't know if I follow this one or not. When inheriting an
> >> eclass, all entities within the eclass get merged into the
> >> ebuild. As long as there aren't any special conditional tricks
> >> being used to assign to global variables like IUSE, it would
> >> still be invariant wouldn't it?
> >
> > The point is that the merging might be done inside the package
> > manager (not in bash code) on the IUSE metadata variable, and the
> > changes don't have to be reflected in the IUSE environment variable
> > inside the ebuild.
>
> If that was the case, then eclasses could no longer append deps to
> (R)DEPEND, either .....?

The point of the wording is to allow an eclass to do this:

DEPEND="cat/two"

and an ebuild do this:

DEPEND="cat/one"

and to have the package manager, but not necessarily bash code, know
that there are two dependencies. It also makes the annoying RDEPEND
value behaviour that older EAPIs specify possible.

So yes, you *could* argue that with the way it's worded, this in an
eclass isn't guaranteed to work:

DEPEND="cat/three"
DEPEND="${DEPEND} cat/four"

What the wording is supposed to imply is that if some bash code looks
at DEPEND, it could contain either "cat/three cat/four", or "cat/one
cat/three cat/four". If the first DEPEND looked like the second, then
it would also be allowed to contain "cat/one cat/one cat/three
cat/four" and similar.

What this really comes down to is that bash is the wrong tool for doing
what we're doing, and that we can't have this work "the way we want
it to" since bash doesn't provide the interfaces we need to get it
to work, and every time we try to be clever it breaks on newer bash
releases...

- --
Ciaran McCreesh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iEYEARECAAYFAk9sqFAACgkQ96zL6DUtXhFnJgCfZhLF1/UsWWCARATI2I9pg5Yv
ATMAn3exnOUWgwQTt84v1q9mE9ptOiH/
=BQ2n
-----END PGP SIGNATURE-----
 
Old 03-23-2012, 03:50 PM
Mike Gilbert
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

On Fri, Mar 23, 2012 at 12:02 PM, Ciaran McCreesh
<ciaran.mccreesh@googlemail.com> wrote:
> On Fri, 23 Mar 2012 11:58:47 -0400
> Mike Gilbert <floppym@gentoo.org> wrote:
>> > oasis_src_compile() {
>> > * * oasis_src_compile_no_doc
>> > * * if has doc ${IUSE} && use doc; then
>> > * * * * * * ocaml setup.ml -doc || die
>> > * * fi
>> > }
>>
>> This should probably call use_if_iuse from eutils.eclass, which
>> handles IUSE="[+-]doc".
>
> Actually, neither way works. The spec says:
>
> * *Global variables must only contain invariant values
> * *(see~
ef{sec:metadata-invariance}). If a global variable's value is
> * *invariant, it may have the value that would be generated at any
> * *given point in the build sequence.
>
> So you can't rely upon IUSE having the "merged" value in an eclass.
>

use_if_iuse is called from functions in several eclasses already in
the tree. See chromium, kde4-base, qt4-build, and toolchain.

Are all of these usages incorrect? Do you have an alternate solution?
 
Old 03-23-2012, 03:52 PM
Ciaran McCreesh
 
Default New eclass: oasis.eclass for oasis-based ocaml packages.

On Fri, 23 Mar 2012 12:50:51 -0400
Mike Gilbert <floppym@gentoo.org> wrote:
> use_if_iuse is called from functions in several eclasses already in
> the tree. See chromium, kde4-base, qt4-build, and toolchain.
>
> Are all of these usages incorrect? Do you have an alternate solution?

We had this discussion when the function was introduced, and we were
assured that it "would only be used correctly"... The correct solution
is probably to have ebuilds define a variable like "OASIS_WANT_DOCS",
and to use that.

--
Ciaran McCreesh
 

Thread Tools




All times are GMT. The time now is 02:46 PM.

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