Gentoo Archives: gentoo-dev

From: Yannick Koehler <yannick.koehler@××××××××.com>
To: gentoo-dev@g.o
Subject: [gentoo-dev] Gentoo XML Database
Date: Fri, 07 Feb 2003 17:43:03
Message-Id: 200302071234.44766.yannick.koehler@colubris.com
1 For the fun of it, I created a little tool very custom and untested that will
2 read the the cache files of gentoo and generate on the stdout a valid xml
3 file.
4
5 Now the schema/dtd has been created without any thinking. This may or not
6 open the door to people to experiment with a gentoo equivalent database.
7
8 What's interesting is that the database is generated from a gentoo system
9 pretty easily because of the presence of the cache. One could easily think
10 about creating a direct ebuilds -> xml db software instead of passing through
11 the cache.
12
13 Discussion with carspaski reveal thought that the use of the database will
14 actually not speed up emerge. Because emerge loads the cache inside an
15 internal memory database and python allow him to leave that in memory in
16 between runs making it very fast and efficient as only the require entry of
17 the database gets loaded instead of the whole database.
18
19 Some benefit I see from the xml db is for side-tools, for example search
20 description of ebuilds is faster when using xml db as it is a single file and
21 software only look for string that start with <description>. One can use
22 grep/regexp to do such query or built an xml capable application.
23
24 I believe that more works need to be put into this to figure out a better dtd
25 and a separation of elements that would make more sense to some of the
26 application such as kportage and others gui tools that try to load all at
27 startup due to lack of persistent daemon keeping stuff in memory.
28
29 test.sh is the bash script that start the xml output and then do a recursive
30 ls of /var/cache/edb/dep. Then for each file it calls xmltest which is a
31 libxml2 app that will only convert the read text in ISO-8859-1 and then
32 output with escaping special chars as defined in XML 1.0.
33
34 I'm including only the source. I use the following compile line:
35
36 gcc -I /usr/include/libxml2 -o xmltest xmltest.c -lxml2
37
38 To run,
39
40 ./test.sh > gentoo.xml
41
42 It generate a 9525071 bytes file.
43
44 --
45
46 Yannick Koehler

Attachments

File name MIME type
test.sh application/x-shellscript
xmltest.c text/x-csrc

Replies

Subject Author
Re: [gentoo-dev] Gentoo XML Database Vano D <gentoo-dev@××××××××××××××××.com>
[gentoo-dev] Re: Gentoo XML Database Denys Duchier <duchier@×××××××××.de>
[gentoo-dev] Gentoo XML Database: More Data Yannick Koehler <yannick.koehler@××××××××.com>