Gentoo Archives: gentoo-dev

From: Ciaran McCreesh <ciaranm@×××××××.org>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [soc] Python bindings for Paludis
Date: Sat, 24 Mar 2007 21:02:42
Message-Id: 20070324205941.5adeb3f5@snowflake
In Reply to: Re: [gentoo-dev] [soc] Python bindings for Paludis by Luca Barbato
1 On Sat, 24 Mar 2007 20:25:45 +0100
2 Luca Barbato <lu_zero@g.o> wrote:
3 > Ciaran McCreesh wrote:
4 > > Assuming you mean piotr, who is not pioto... The difference is,
5 > > piotr's proposal is possible and doable within the timeframe,
6 > > whereas lu_zero's sounds nice if you don't know anything about any
7 > > of the package managers in question and can't be delivered within
8 > > three months.
9 >
10 > I'd like to know your opinion about which are the pitfalls and the
11 > issues since you are surely more informed than me on paludis and, to a
12 > large degree, on portage internals.
13 >
14 > I assumed that for a foundation and a non exaustive converage the
15 > summer would be more than enough.
16
17 If you're wanting to do a very simple API supporting approximately the
18 following, you're ok:
19
20 * Fetching a list of package versions that match a particular
21 dependency atom
22 * Fetching a list of available packages
23 * Simple metadata queries upon a particular package
24 * Fetching the contents of a particular package
25
26 If you're wanting to make a powerful API that lets people solve real
27 world problems, you're in for an awful lot of trouble.
28
29 The problem is this... Although Paludis, Pkgcore and Portage solve the
30 same ultimate problem, they do it in extremely different ways.
31 Internally and from a public API perspective, there's very little in
32 common between the three.
33
34 Portage is by and large procedural and messy. It's basically an
35 incoherent bunch of routines to do particular things. It doesn't
36 generalise well, and things you'd expect to be similar aren't (e.g.
37 you'd think finding out something about a package in VDB would be
38 the same as finding out something about a package in the tree, but
39 that would be far too easy...).
40
41 Paludis is basically what you'd expect from a highly OO, resource
42 managed language like C++. The problem is, a generalised API would end
43 up hiding nearly all of the flexibility and functionality.
44
45 You also can't wrap Paludis in any programming language that doesn't do
46 resource management of some kind (preferably fully controlled, but
47 since only C++ offers that, garbage collected works too). Writing a
48 common middle layer in C and then writing language extensions on top of
49 that isn't doable -- the common middle layer would have to be C++,
50 since you can't write Ruby extensions in Python or suchlike...
51
52 Pkgcore is closer to being AO than OO, largely because of programming
53 language differences. Again, a generalised API would mask flexibility
54 and functionality. You'd have a hard time getting callbacks to
55 generalise cleanly.
56
57 Design issues aside, there're also problems conceptually. The three
58 package managers have very different ideas of certain key concepts like
59 repositories, packages, the general operating environment (or domain)
60 and version metadata. You'd have to come up with a whole new conceptual
61 model that can handle all three paradigms, and you'd have to do it in
62 such a way that you don't kill the performance techniques (delayed and
63 batch loading, effectively) used by Paludis and Pkgcore.
64
65 So it's down to a question of scope. Are you trying to make an API to
66 do a few very basic queries, or are you trying to make an API powerful
67 enough to, say, make a graphical front end? The former is doable and
68 useless, the latter is a massive project.
69
70 Now, what you *could* do is implement a portageq-style tool with more
71 functionality. You'd still have conceptual issues (Paludis doesn't
72 particularly like giving you global configuration information, for
73 example -- simple things like querying whether a USE flag is enabled
74 need an associated c/p-v::r), but they wouldn't be as bad. Such a tool
75 would be slow, of limited use and easily doable within the available
76 time.
77
78 > I'm more interested in a solid base than a complete and exaustive
79 > wrapper =)
80
81 Which is the problem... The base is extremely different for all three.
82
83 --
84 Ciaran McCreesh
85
86 --
87 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] [soc] Python bindings for Paludis Luca Barbato <lu_zero@g.o>