design.sgml 16 KB

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