On Fri, 7 Sep 2012 12:45:59 +0100
Ciaran McCreesh <ciaran.mccre...@googlemail.com> wrote:

> Since DEPENDENCIES hasn't been written up in a Gentoo-friendly manner,
> and since the Exherbo documentation doesn't seem to suffice to explain
> the idea here, here's some more details on the DEPENDENCIES proposal.
> 
> We observe that a typical package will have something like this:
> 
>     DEPEND="
>         cat/first
>         cat/second
>         cat/third
>         cat/fourth
>         foo? (
>             foo/one
>             >=foo/two-2.34[monkeys]
>         )
>         bar? (
>              bar/one
>         )
>         baz? (
>              baz/one
>              baz/two
>         )
>         fnord? (
>              fnord/one
>         )"
> 
>     RDEPEND="
>         cat/second
>         cat/third
>         cat/fourth
>         cat/fifth
>         foo? (
>             >=foo/two-2.34[monkeys]
>             foo/three
>         )
>         bar? (
>              bar/one
>              bar/two
>              bar/three
>              bar/four
>         )"

Now please express that using bash variable references instead of
the overly verbose expansions. Also, real examples are much more useful
than counting and monkeys. This is not mathematics.

> Note how many dependencies that we think of as being "the same" are
> listed in two places, and are not in any way "the same".
> 
> Note also how the foo-related things, the bar-related things etc
> cannot be grouped together by their fooness or barness, but are
> rather grouped by their DEPENDness and RDEPENDness.

What is fooness and barness? Because I got lost near the four
non-existent word.

> Right now we've just got three variables. In a not too distant EAPI,
> it will be considerably more than three. We also have duplication;
> with HDEPEND, this will sometimes become triplication.

Sometimes != always. Sometimes HDEPEND will actually simplify
the current state. By moving a few things from DEPEND to HDEPEND, we
may be actually able to remove COMMON_DEPEND. Sometimes.

> Here's the important bit, which I shall prefix with some stars:
> 
> *** The point of DEPENDENCIES is not to replace n variables with one
> *** variable.

Yes, it is.

> *** The point of DEPENDENCIES is not to provide syntactic sugar over a
> *** group of n variables.

Yes, it is.

> *** The point of DEPENDENCIES is to allow a package's dependencies,
> *** which can be very complicated, to be expressed accurately and
> *** simply, in a way friendly to how developers deal with dependencies
> *** in practice.

Didn't we already prove that the syntactic sugar DEPENDENCIES allows
can make the dependency specifications very unclear and not anywhere
close to simple?

> So here's what DEPENDENCIES solves:
> 
> Firstly, it allows developers to group together foo-related
> dependencies and bar-related dependencies by their fooness and
> barness, not by their role.
> 
> Secondly, it reduces error-prone duplication.

No, it doesn't. It just provides an alternate solution over how we do
that now. Does variable substitution ring a bell?

> Thirdly, it avoids some fairly obtuse names (BADEPEND? LDEPEND?) in
> favour of something a tad more readable.

That is a side effect. DEPENDENCIES doesn't disallow us from choosing
to use labels like 'd:', 'r:'. Similarly, bash variables don't anyhow
stand in the way of using more verbose names.

> Here's the other important bit, with more stars:
> 
> *** It does it by replacing the concept of "a package has build
> *** dependencies, run dependencies, etc" with "a package has
> *** dependencies, and each dependency is applicable at one or more of
> *** build time, run tme, etc".

Really?

I think it actually gives concept of 'a package has a few random groups
of dependencies, where each group is applicable at one or more of build
time, run time, etc and consists of one or more dependencies or groups
of dependencies, where each group is applicable at one or more of build
time, run time, etc (which may or may not be the same as parent group)
and consists of one or more dependencies or groups of dependencies,
where each group is applicable at one or more of build time, run time,
etc (which may or may not be the same as parent group) and consists of
one or more dependencies or groups of dependencies, where each group is
applicable at one or more of build time, run time, etc (which may or
may not be the same as parent group) and consists of one or more
dependencies or groups of dependencies, where each group is applicable
at one or more of build time, run time, etc (which may or may not be
the same as parent group) and consists of one or more dependencies or
groups of dependencies, where each group is applicable at one or more
of build time, run time, etc (which may or may not be the same as
parent group) and consists ...'

> We could just mark each dependency individually by when it's
> applicable. But that turns out to be quite verbose, since packages
> have fairly long lists of dependencies of the same kind. So here's a
> much more concise syntax:
> 
>     DEPENDENCIES="
>         build:
>             cat/first
>         build+run:
>             cat/second
>             cat/third
>             cat/fourth
>         run:
>             cat/fifth
> 
>         foo? (
>             build:
>                 foo/one
>             build+run:
>                 >=foo/two-2.34[monkeys]
>             run:
>                 foo/three
>         )
> 
>         bar? (
>              build+run:
>                  bar/one
>              run:
>                  bar/two
>                  bar/three
>                  bar/four
>         )
> 
>         build:
>             baz? (
>                  baz/one
>                  baz/two
>             )
> 
>             fnord? (
>                  fnord/one
>             )"
> 
> Here are the rules for working out which labels apply to a given spec:
> 
> We have a "labels stack" when parsing. Initially, the value
> "build+run" is on the top. Whenever we encounter a block ("( )",
> "use? ( )" etc), we duplicate the top value of the stack, and when we
> leave the block we pop the value off. Whenever we encounter labels,
> we replace the top value on the stack with those labels. Whenever we
> encounter a spec, its associated labels are those on the top of the
> stack.

These are the rules for a machine. People don't actually read
dependencies sequentially. Provide a good algorithm which works from
any position.

> To avoid weirdness, so long as we're inside a || block, use of labels
> is forbidden. Note that this is a reflection of the current ambiguity
> as to what DEPEND="|| ( a b )" RDEPEND="|| ( a b )" means (can you
> build against a, and run against b?), and if we're wanting to tidy
> that up, that should be an independent proposal.

Yes, that's something you could work on instead of throwing a lot of
work on us just to reinvent the wheel your way because you believe that
your bicycle is much better when it has square wheels.

> These rules are mostly for flexibility: if developers sometimes prefer
> to group things by role rather than by fooness, then that's possible
> too.
> 
> The rules for eclass merging need changing too, to add a ( ) around
> values rather than merely appending. This is a technicality, and isn't
> developer visible.

The algorithm you presented above was technicality as well.

So, now that your forked the thread shall we repeat all
the disadvantages which you love to forgot to mention?

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to