design.dbk 16 KB

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