Gentoo Archives: gentoo-dev

From: Zach Forrest <diatribe@××××.ca>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] USE database?
Date: Thu, 06 Dec 2001 16:30:11
Message-Id: 3C0FF231.3020308@shaw.ca
In Reply to: Re: [gentoo-dev] USE database? by Mikael Hallendal
1 >
2 > The problem is that writing things in XML will be even harder than the
3 > pretty clean syntax you proposed.
4 >
5
6 Maybe a little more laborious, but not really that hard. Take this for
7 example:
8
9 use_var={"name":"esd",
10 "description":"Enable enlightenment sound daemon support.",
11 "priority":"OPTIONAL",
12 "depends":"media-sound/esound"}
13
14 To write this in XML it would look like this:
15
16 <usedatabase>
17
18 <useflag name=esd>
19 <description>Enable enlightenment sound daemon support</description>
20 <priority>OPTIONAL</priority>
21 <depends>media-sound/esound</depends>
22 </useflag>
23
24 </usedatabase>
25
26 (OK, not quite as _pretty_, but I've seen worse. The syntax, though, is
27 clean.)
28
29 Also, I don't think it would be too painful because it's not like
30 someone would have to spend all day editing/adding entries. It would be
31 pretty easy to write a script to prompt for the name/desc/etc. and
32 generate the XML.
33
34 Benefits of using XML also include:
35 - Rules, such as declaring "priority" flags, can be created in and
36 enforced by a schema.
37 - Validation in general.
38 - Consistent formatting would also be easy with XML.
39 - Flexibility.
40
41 (Not to sound like a commercial.)
42
43
44
45 Mikael Hallendal wrote:
46
47 > tor 2001-12-06 klockan 19.12 skrev Zach Forrest:
48 >
49 >>Before using python as an example, I had actually played with the idea
50 >>of using XML. Any thoughts on this? I know that compared to a plain text
51 >>file both of these notions seem somewhat cumbersome, but there are a
52 >>couple of arguments for using a more structured approach. One,
53 >>programatically handling the data is easier. Using either python or XML
54 >>(and a parser) allows named access rather positional access to the
55 >>fields. It also makes the definition of "records" more clear and easier
56 >>to understand for new developers (i.e. me). It wouldn't be too difficult
57 >>to parse XML (even into a dictionary).
58 >>
59 >
60 > Yes, I thought about using XML too, as you say, for parsing the file
61 > it'll be better since we don't narrow it down to python. Any language
62 > that can parse XML (most) can be used for tools and such.
63 >
64 > The problem is that writing things in XML will be even harder than the
65 > pretty clean syntax you proposed.
66
67 >
68 >>As far as GConf is concerned, I think that the base system should have
69 >>as few dependencies as possible. Python is already required, and, in my
70 >>opinion, with its XML capabilities (or just using dictionaries) I
71 >>believe a solution along these lines would be preferable.
72 >>
73 >
74 > Yes, GConf is IMHO not an option today, perhaps in the future when it:
75 > 1) is more stable/tested for these kind of things.
76 > 2) has nice tools for editing the contents.
77 >
78 > Regards,
79 > Mikael Hallendal
80 >
81 >

Replies

Subject Author
Re: [gentoo-dev] USE database? Daniel Robbins <drobbins@g.o>
Re: [gentoo-dev] USE database? Sebastian Werner <sebastian@××××××××××××××××××.de>