]> git.saurik.com Git - apt.git/blame_incremental - doc/design.dbk
test framework: Correctly generate new paths in noopchroot
[apt.git] / doc / design.dbk
... / ...
CommitLineData
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4<!ENTITY % aptent SYSTEM "apt.ent"> %aptent;
5<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
6<!ENTITY % aptvendor SYSTEM "apt-vendor.ent"> %aptvendor;
7]>
8
9<book lang="en">
10
11<title>The APT project design document</title>
12
13<bookinfo>
14
15<authorgroup>
16 <author>
17 <personname>Manoj Srivastava</personname><email>srivasta@debian.org</email>
18 </author>
19</authorgroup>
20
21<releaseinfo>Version &apt-product-version;</releaseinfo>
22
23<abstract>
24<para>
25This document is an overview of the specifications and design goals of the APT
26project. It also attempts to give a broad description of the implementation
27as well.
28</para>
29</abstract>
30
31<copyright><year>1997</year><holder>Manoj Srivastava</holder></copyright>
32
33<legalnotice>
34<title>License Notice</title>
35<para>
36APT, including this document, is free software; you may redistribute it and/or
37modify it under the terms of the GNU General Public License as published by the
38Free Software Foundation; either version 2, or (at your option) any later
39version.
40</para>
41<para>
42This is distributed in the hope that it will be useful, but <emphasis>without
43any warranty</emphasis>; without even the implied warranty of merchantability
44or fitness for a particular purpose. See the GNU General Public License for
45more details.
46</para>
47<para>
48You should have received a copy of the GNU General Public License with your
49Debian system, in <literal>/usr/share/common-licenses/GPL</literal>, or with
50the <command>debiandoc-sgml</command> source package as the file
51<literal>COPYING</literal>. If not, write to the Free Software Foundation,
52Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
53</para>
54</legalnotice>
55
56</bookinfo>
57
58<chapter id="introduction"><title>Introduction</title>
59<para>
60APT is supposed to be a replacement for dselect, and not a replacement for
61dpkg. However, since addition functionality has been required for APT, and
62given the fact that this is very closely related to dpkg, it is not
63unreasonable to expect that additional functionality in the underlying dpkg
64would also be requested.
65</para>
66<para>
67Deity/dselect are the first introduction that people have to Debian, and
68unfortunately this first impression contributes greatly to the public
69perception of the distribution. It is imperative that this be a showcase for
70Debian, rather than frighten novices away (which has been an accusation often
71levelled at the current system)
72</para>
73</chapter>
74
75<chapter id="ch2"><title>Requirements</title>
76<orderedlist numeration="arabic">
77<listitem>
78<para>
79APT should be a replacement for dselect. Therefore it should have all the
80functionality that dselect has currently. This is the primary means of
81interaction between the user and the package management system, and it should
82be able to handle all tasks involved in installing, upgrading, and routine
83management without having the users take recourse to the underlying management
84system.
85</para>
86</listitem>
87<listitem>
88<para>
89It should be easier to use and less confusing for novice users. The primary
90stimulus for the creation of APT was the perceived intractability, complexity,
91and non-intuitive behavior of the existing user interface, and as such, human
92factors must be a primary mandate of APT.
93</para>
94</listitem>
95<listitem>
96<para>
97It should be able to group packages more flexibly, and possibly allow
98operations based on a group. One should be able to select, or deselect,
99a coherent group of related packages simultaneously, allowing one to add,
100remove, or upgrade functionality to a machine as one step.
101</para>
102</listitem>
103<listitem>
104<para>
105This would allow APT to handle <emphasis>standard installations</emphasis>,
106namely, one could then install a set of packages to enable a machine to
107fulfill specific tasks. Define a few standard installations, and which
108packages are included therein. The packages should be internally consistent.
109</para>
110</listitem>
111<listitem>
112<para>
113Make use of a keywords field in package headers; provide a standard list of
114keywords for people to use. This could be the underpinning to allow the
115previous two requirements to work (though the developers are not constrained
116to implement the previous requirements using keywords)
117</para>
118</listitem>
119<listitem>
120<para>
121Use dependencies, conflicts, and reverse dependencies to properly order
122packages for installation and removal. This has been a complaint in the past
123that the installation methods do not really understand dependencies, causing
124the upgrade process to break, or allowing the removal of packages that left the
125system in an untenable state by breaking the dependencies on packages that were
126dependent on the package being removed. A special emphasis is placed on
127handling pre-dependencies correctly; the target of a predependency has to be
128fully configured before attempting to install the pre-dependent package. Also,
129<emphasis>configure immediately</emphasis> requests mentioned below should be
130handled.
131</para>
132</listitem>
133<listitem>
134<para>
135Handle replacement of a package providing a virtual package with another (for
136example, it has been very difficult replacing <command>sendmail</command> with
137<command>smail</command>, or vice versa), making sure that the dependencies are
138still satisfied.
139</para>
140</listitem>
141<listitem>
142<para>
143Handle source lists for updates from multiple sources. APT should also be able
144to handle diverse methods of acquiring new packages; local filesystem,
145mountable CD-ROM drives, FTP accessible repositories are some of the methods
146that come to mind. Also, the source lists can be separated into categories,
147such as main, contrib, non-us, non-local, non-free, my-very-own, etc. APT
148should be set up to retrieve the Packages files from these multiple source
149lists, as well as retrieving the packages themselves.
150</para>
151</listitem>
152<listitem>
153<para>
154Handle base of source and acquire all Packages files underneath. (possibly
155select based on architecture), this should be a simple extension of the
156previous requirement.
157</para>
158</listitem>
159<listitem>
160<para>
161Handle remote installation (to be implemented maybe in a future version, it
162still needs to be designed). This would ease the burden of maintaining
163multiple Debian machines on a site. In the authors opinion this is a killer
164difference for the distribution, though it may be too hard a problem to be
165implemented with the initial version of APT. However, some thought must be
166given to this to enable APT to retain hooks for future functionality, or at
167least to refrain from methods that may preclude remote activity. It is
168desirable that adding remote installation not require a redesign of APT from
169the ground up.
170</para>
171</listitem>
172<listitem>
173<para>
174Be scalable. Dselect worked a lot better with 400 packages, but at last count
175the number of packages was around twelve hundred and climbing. This also
176requires APT to pay attention to the needs of small machines which are low on
177memory (though this requirement shall diminish as we move towards bigger
178machines, it would still be nice if Debian worked on all old machines where
179Linux itself would work).
180</para>
181</listitem>
182<listitem>
183<para>
184Handle install immediately requests. Some packages, like watchdog, are
185required to be working for the stability of the machine itself. There are
186others which may be required for the correct functioning of a production
187machine, or which are mission critical applications. APT should, in these
188cases, upgrade the packages with minimal downtime; allowing these packages to
189be one of potentially hundreds of packages being upgraded concurrently may
190not satisfy the requirements of the package or the site. (Watchdog, for
191example, if not restarted quickly, may cause the machine to reboot in the
192midst of installation, which may cause havoc on the machine)
193</para>
194</listitem>
195</orderedlist>
196</chapter>
197
198<chapter id="ch3"><title>Procedural description</title>
199<variablelist>
200<varlistentry>
201<term>Set Options</term>
202<listitem>
203<para>
204This process handles setting of user or site options, and configuration of all
205aspects of APT. It allows the user to set the location and order of package
206sources, allowing them to set up source list details, like ftp site locations,
207passwords, etc. Display options may also be set.
208</para>
209</listitem>
210</varlistentry>
211<varlistentry>
212<term>Updates</term>
213<listitem>
214<para>
215Build a list of available packages, using source lists or a base location and
216trawling for Packages files (needs to be aware of architecture). This may
217involve finding and retrieving Packages files, storing them locally for
218efficiency, and parsing the data for later use. This would entail contacting
219various underlying access modules (ftp, cdrom mounts, etc) Use a backing store
220for speed. This may also require downloading the actual package files locally
221for speed.
222</para>
223</listitem>
224</varlistentry>
225<varlistentry>
226<term>Local status</term>
227<listitem>
228<para>
229Build up a list of packages already installed. This requires reading and
230writing the local?? status file. For remote installation, this should
231probably use similar mechanisms as the Packages file retrieval does. Use
232the backing store for speed. One should consider multiple backing stores,
233one for each machine.
234</para>
235</listitem>
236</varlistentry>
237<varlistentry>
238<term>Relationship determination</term>
239<listitem>
240<para>
241Determine forward and reverse dependencies. All known dependency fields should
242be acted upon, since it is fairly cheap to do so. Update the backing store
243with this information.
244</para>
245</listitem>
246</varlistentry>
247<varlistentry>
248<term>Selection</term>
249<listitem>
250<para>
251Present the data to the user. Look at Behan Webster's documentation for the
252user interface procedures. (Note: In the authors opinion deletions and reverse
253dependencies should also be presented to the user, in a strictly symmetric
254fashion; this may make it easier to prevent a package being removed that breaks
255dependencies)
256</para>
257</listitem>
258</varlistentry>
259<varlistentry>
260<term>Ordering of package installations and configuration</term>
261<listitem>
262<para>
263Build a list of events. Simple topological sorting gives order of packages
264in dependency order. At certain points in this ordering,
265predependencies/immediate configure directives cause an break in normal
266ordering. We need to insert the uninstall/purge directive in the stream
267(default: as early as possible).
268</para>
269</listitem>
270</varlistentry>
271<varlistentry>
272<term>Action</term>
273<listitem>
274<para>
275Take the order of installations and removals and build up a stream of events
276to send to the packaging system (dpkg). Execute the list of events if
277successful. Do not partially install packages and leave system in broken
278state. Go to The Selection step as needed.
279</para>
280</listitem>
281</varlistentry>
282</variablelist>
283</chapter>
284
285<chapter id="ch4"><title>Modules and interfaces</title>
286<variablelist>
287<varlistentry>
288<term>The user interface module</term>
289<listitem>
290<para>
291Look at Behan Webster's documentation.
292</para>
293</listitem>
294</varlistentry>
295<varlistentry>
296<term>Widget set</term>
297<listitem>
298<para>
299Related closely to above Could some one present design decisions of the widget
300set here?
301</para>
302</listitem>
303</varlistentry>
304<varlistentry>
305<term>pdate Module</term>
306<listitem>
307<para>
308Distinct versions of the same package are recorded separately, but if multiple
309Packages files contain the same version of a package, then only the first one
310is recorded. For this reason, the least expensive update source should be
311listed first (local file system is better than a remote ftp site)
312</para>
313<para>
314This module should interact with the user interface module to set and change
315configuration parameters for the modules listed below. It needs to record that
316information in an on disk data file, to be read on future invocations.
317</para>
318<orderedlist numeration="arabic">
319<listitem>
320<para>
321FTP methods
322</para>
323</listitem>
324<listitem>
325<para>
326mount and file traversal module(s)?
327</para>
328</listitem>
329<listitem>
330<para>
331Other methods ???
332</para>
333</listitem>
334</orderedlist>
335</listitem>
336</varlistentry>
337<varlistentry>
338<term>Status file parser/generator</term>
339<listitem>
340<para>
341The status file records the current state of the system, listing the packages
342installed, etc. The status file is also one method of communicating with dpkg,
343since it is perfectly permissible for the user to use APT to request packages
344be updated, put others on hold, mark other for removal, etc, and then run
345<literal>dpkg -BORGiE</literal> on a file system.
346</para>
347</listitem>
348</varlistentry>
349<varlistentry>
350<term>Package file parser/generator</term>
351<listitem>
352<para>
353Related to above. Handle multiple Packages files, from different
354sources. Each package contains a link back to the packages file structure
355that contains details about the origin of the data.
356</para>
357</listitem>
358</varlistentry>
359<varlistentry>
360<term>Dependency module</term>
361<listitem>
362<itemizedlist>
363<listitem>
364<para>
365dependency/conflict determination and linking
366</para>
367</listitem>
368<listitem>
369<para>
370reverse dependency generator. Maybe merged with above
371</para>
372</listitem>
373</itemizedlist>
374</listitem>
375</varlistentry>
376<varlistentry>
377<term>Package ordering Module</term>
378<listitem>
379<para>
380Create an ordering of the actions to be taken.
381</para>
382</listitem>
383</varlistentry>
384<varlistentry>
385<term>Event generator</term>
386<listitem>
387<para>
388module to interact with dpkg
389</para>
390</listitem>
391</varlistentry>
392</variablelist>
393</chapter>
394
395<chapter id="ch5"><title>Data flow and conversions analysis.</title>
396<screen>
397 ____________
398 __\|ftp modules|
399 / /|___________|
400 _ ____________ / ________________
401 | update | / |mount/local file|
402 |==========================&gt;| module |/_____\| traversals |
403 | |_____________| /|________________|
404 | ^ ^
405 | | | ______________
406 ______|_______ _ _____ ______ | _____v________ \| |
407 |Configuration | |configuration| | |Packages Files| ===|Status file |
408 | module |&lt;=&gt;| data | | |______________| / /|____________|
409 |______________| |_____________| | ^ /
410 ^ | | /
411 | | _______v_______|/_
412 | | | | ________________
413 | | | |/_\| Dependency |
414 | | |backing store |\ /| Module |
415 | | |______________| _|_______________|
416 | \ ^ /| ^
417 | \ | / |
418 | _\|____v_______|/__ ____v_______
419 |_____________________________\| User interaction| | dpkg |
420 /|_________________|&lt;==&gt; Invoker |
421 |___________|
422</screen>
423<para>
424dpkg also interacts with status and available files.
425</para>
426<para>
427The backing store and the associated data structures are the core of APT. All
428modules essentially revolve around the backing store, feeding it data, adding
429and manipulating links and relationships between data in the backing store,
430allowing the user to interact with and modify the data in the backing store,
431and finally writing it out as the status file and possibly issuing directives
432to dpkg.
433</para>
434<para>
435The other focal point for APT is the user interface.
436</para>
437</chapter>
438
439</book>