Gentoo Archives: gentoo-portage-dev

From: Pieter Van den Abeele <pvdabeel@g.o>
To: gentoo-portage-dev@g.o
Subject: Re: [gentoo-portage-dev] The purpose of USE flags
Date: Tue, 16 Dec 2003 15:36:35
Message-Id: EB093AE7-300F-11D8-BE0F-0003938E7E46@gentoo.org
In Reply to: Re: [gentoo-portage-dev] The purpose of USE flags by "Sami Näätänen"
1 On 16 Dec 2003, at 18:11, Sami Näätänen wrote:
2
3 > We have a portage 'daemon' to handle all the database access, package
4 > installation and uninstallation. It doesn't need to be allways in the
5 > background, but it can be launced when something needs it.
6 >
7 > This one daemon controlls the dependency tree calculations etc and can
8 > compile multiple packages simultaneysly if all their dependencies are
9 > allready installed. Thi ofcourse depends wheter the multiple processes
10 > are allowed or not through SMP and/or distcc and/or openmosix
11 >
12 > So now one could que new packages to the daemon at will and it would
13 > add
14 > these to it's dependency tree.
15
16 The idea of having a deamon maintain a dependency tree is a good idea,
17 but somewhat too detailed for a requirement. It doesn't necessarily
18 need to be a daemon. It can be a simple standalone program too without
19 using a socket or something.
20
21 I'd rephrase it as:
22
23 A subset (module) of portage is responsible for maintaining a
24 representation of the system. We call the representation of a system a
25 build plan.
26 Installing new components can be seen as merging the buildplan for the
27 new components with the old build plan.
28 ...
29
30 > Now a litle more to the portage level. :)
31 >
32 > So the portage daemon would need to be a modular concept to be really
33 > usefull. So here are my hasty propositions to be as the modules.
34
35 modularity is what we want for several reasons
36
37 > 1. Main module, which controls the others. So is kind the current
38 > portage core. And the daemon really is only this the others are
39 > libraries.
40
41 I wouldn't call this the portage core, as the existence of this module
42 is not -really- crucial for portage to work. In a modular system, one
43 should (theoretically, whether this is easy or not is another question)
44 be able to communicate with each module, the main module should
45 implement things like:
46
47 - interaction with the user (a user controls other portage module
48 through executing a command like 'emerge --pretend blabla')
49 - userland modules (interaction with catalyst?) emerge --build-livecd
50 asystemspec
51 ...
52
53 > 2. Preferences module. Sets all the system options ie what database and
54 > the database URI to use etc. This is lot like the current
55 > make.profile and some parts of make.conf.
56
57 I would use 'knowledge base' instead of database, because it is a more
58 generic term. A ports directory is not really a database as we know it
59 (think SQL etc.). One of the benefits of formulating the core in
60 prolog, would be to use a 'datalog' syntax, datalog is regarded as a
61 universal query language. SQL can be expressed in datalog, just like it
62 can be expressed in relational algebra/calculus.
63
64 Preferences are a good idea, there can be system preferences, user
65 preferences ... containing statements about the knowledge base:
66
67 avoid pam,
68 filter unstable packages when the package is a core package
69 ...
70
71 I'm also thinking about having regular users specify their own
72 preferences, which can be taken into account by root when reasoning
73 about the system, but which should be interpreted as wishes instead of
74 'requirements'
75
76 > 3. Database handling. This should be so that there can be one for every
77 > database one might use, but of course not all of them made, but
78 > given
79 > the possibility to users to make their own. The default should be a
80 > very light weigth solution like flat files. This module is
81 > responsible for database queries and alterings.
82
83 see 2.
84
85 > 4. Build module. This builds a package in isolated environment
86
87 more generic: 'interprets build plans'
88
89 > 5. Install/uninstall module, which handles the file altering in the
90 > live
91 > system.
92
93 I'd add this to 4, The idea is to - just like catalyst - use a strategy
94 design pattern:
95
96 each concrete architecture/platform can implement its own
97 'instal/uninstall' strategy.
98
99 > Ebuilds wouldn't anymore be a shell scripts, but the build module will
100 > offer all necessary commands to build something. Ebuild will simply be
101 > a command sequence. Same goes for the install module.
102
103 This makes eclasses overriding/adding some default behaviour or
104 'meta-data' somewhat more difficult to implement.
105 I'd split ebuilds into two parts: the part detailing 'howto' and the
106 part detailing 'about'.
107
108 about: dependencies, keywords, use flags (iuse)
109 howto: command sequences.
110
111 howto data can take into account about data, but not the other way
112 around. Still, I'd abstract away from the concrete ebuild syntax and
113 the way to interpret it. The key is to design a system which is
114 powerfull enough to represent other (ports) systems in.
115
116 > This way it can be made more secure and easier to control.
117
118 right now when you write:
119
120 expoit() {
121 rm -rf /
122 }
123 expoit
124
125 at the top of the ebuild, this gets executed when reading data 'about'
126 the ebuild. Similarily one could write
127
128 DEPEND=""
129 setdepend() {
130 DEPEND=`date`
131 }
132 setdepend
133
134 which returns another value for DEPEND every time the ebuild is
135 interpreted.
136
137 I would however allow:
138
139 src_compile() {
140 sequence of commands
141 if (use foo) {
142 more commands
143 }
144 }
145
146 because that is really powerfull.
147
148
149 > Because this consept uses database abstaraction we can put only the
150 > staff that suits well to the database and use other type of data
151 > structures if more suitable to the needed task.
152
153 I certainly wouldn't exclude using a database (like in sql databases,
154 etc.), but wouldn't exclude other possibilities too. If anyone wants to
155 create one huge file containing all data in his own syntax, that should
156 be possible because of the modular design.
157
158 Pieter
159
160
161
162 --
163 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] The purpose of USE flags Paul de Vrieze <pauldv@g.o>