public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Unified DEPENDENCIES concept
@ 2012-09-07 11:45 Ciaran McCreesh
  2012-09-07 12:29 ` Michał Górny
                   ` (5 more replies)
  0 siblings, 6 replies; 82+ messages in thread
From: Ciaran McCreesh @ 2012-09-07 11:45 UTC (permalink / raw
  To: gentoo-dev

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

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
        )"

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.

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.

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.

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

*** 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.

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.

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

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".

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.

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.

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.

-- 
Ciaran McCreesh

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

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

end of thread, other threads:[~2012-10-07 13:56 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-07 11:45 [gentoo-dev] Unified DEPENDENCIES concept Ciaran McCreesh
2012-09-07 12:29 ` Michał Górny
2012-09-07 12:36   ` Ciaran McCreesh
2012-09-07 14:23     ` Michał Górny
2012-09-07 14:53       ` Ciaran McCreesh
2012-09-07 15:02         ` Michał Górny
2012-09-07 15:07           ` Ciaran McCreesh
2012-09-07 15:16             ` Michał Górny
2012-09-07 15:25               ` Wulf C. Krueger
2012-09-07 14:50 ` Ian Stakenvicius
2012-09-07 14:58   ` Ciaran McCreesh
2012-09-07 15:46 ` Alexis Ballier
2012-09-07 16:03   ` Michał Górny
2012-09-07 16:11     ` Ian Stakenvicius
2012-09-07 16:28       ` Michael Mol
2012-09-07 16:34         ` Ciaran McCreesh
2012-09-07 16:40     ` "Paweł Hajdan, Jr."
2012-09-07 16:47       ` Ciaran McCreesh
2012-09-07 17:40     ` Alexis Ballier
2012-09-07 18:21       ` Michał Górny
2012-09-07 19:59         ` Alexis Ballier
2012-09-07 20:10           ` Michał Górny
2012-09-07 20:14             ` Ian Stakenvicius
2012-09-11  2:16               ` Brian Harring
2012-09-13 19:18                 ` Kent Fredric
2012-09-13 22:17                   ` Brian Harring
2012-09-15 11:06                     ` Kent Fredric
2012-09-15 20:33                       ` Brian Harring
2012-09-15 22:03                         ` Michał Górny
2012-09-16  1:20                           ` [gentoo-dev] example conversion of gentoo-x86 current deps to unified dependencies Brian Harring
2012-09-16  2:39                             ` Diego Elio Pettenò
2012-09-16  7:39                             ` Ben de Groot
2012-09-16 13:15                               ` Brian Harring
2012-09-18 22:51                                 ` Matt Turner
2012-09-19  4:22                                 ` Ben de Groot
2012-09-19 10:59                                   ` [gentoo-dev] " Duncan
2012-09-19 13:09                                     ` Michael Orlitzky
2012-09-19 13:16                                       ` Ian Stakenvicius
2012-09-30 22:15                                         ` Brian Harring
2012-10-01  0:23                                           ` Duncan
2012-10-02 17:47                                           ` Ian Stakenvicius
2012-10-03  4:00                                             ` Ben de Groot
2012-10-07 14:09                                           ` [gentoo-dev] " Steven J. Long
2012-09-16  7:56                             ` [gentoo-dev] " Michał Górny
2012-09-16 11:10                               ` Brian Harring
2012-09-16 11:21                                 ` Michał Górny
2012-09-16 11:49                                   ` Brian Harring
2012-09-16 12:02                                     ` Michał Górny
2012-09-16 13:38                                       ` Brian Harring
2012-09-07 16:10   ` [gentoo-dev] Unified DEPENDENCIES concept Ciaran McCreesh
2012-09-07 16:53     ` Zac Medico
2012-09-07 16:58       ` Ciaran McCreesh
2012-09-07 17:02         ` Ian Stakenvicius
2012-09-07 17:40           ` Zac Medico
2012-09-07 17:58             ` Ian Stakenvicius
2012-09-07 18:18               ` Zac Medico
2012-09-07 18:23                 ` Ciaran McCreesh
2012-09-07 18:23                 ` Zac Medico
2012-09-07 18:23               ` Michał Górny
2012-09-07 18:31                 ` Ciaran McCreesh
2012-09-07 18:46                   ` Michał Górny
2012-09-07 18:52                     ` Ciaran McCreesh
2012-09-07 19:11                       ` Michał Górny
2012-09-07 19:13                         ` Ciaran McCreesh
2012-09-07 19:21                           ` Michał Górny
2012-09-07 19:25                             ` Ciaran McCreesh
2012-09-07 20:07                               ` Michał Górny
2012-09-07 20:15                                 ` Ciaran McCreesh
2012-09-07 20:08                       ` Ian Stakenvicius
2012-09-07 20:14                         ` Ciaran McCreesh
2012-09-07 20:28                           ` Ian Stakenvicius
2012-09-07 20:40                             ` Ciaran McCreesh
2012-09-07 19:42                     ` Ian Stakenvicius
2012-09-07 17:31         ` Zac Medico
2012-09-07 16:12   ` "Paweł Hajdan, Jr."
2012-09-07 16:43     ` Michał Górny
2012-09-07 22:55 ` Michael Orlitzky
2012-09-08  6:43   ` Ciaran McCreesh
2012-09-08 13:01     ` Michael Orlitzky
2012-09-08  7:27   ` Michał Górny
2012-09-08  1:02 ` Patrick Lauer
2012-09-09  3:32 ` Matt Turner

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