programmer.sgml 107 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991
  1. <!doctype debiandoc system>
  2. <!--
  3. Debian Linux dpkg package installation tool.
  4. programmers' manual.
  5. Copyright (C)1996 Ian Jackson; released under the terms of the GNU
  6. General Public License, version 2 or (at your option) any later.
  7. -->
  8. <book>
  9. <title><prgn/dpkg/ programmers' manual
  10. <author>Ian Jackson <email/ijackson@gnu.ai.mit.edu/
  11. <version><date>
  12. <abstract>
  13. This manual describes the technical aspects of creating Debian binary
  14. and source packages. It also documents the interface between
  15. <prgn/dselect/ and its access method scripts. It does not deal with
  16. the Debian Project policy requirements, and it assumes familiarity
  17. with <prgn/dpkg/'s functions from the system administrator's
  18. perspective.
  19. <copyright>Copyright &copy;1996 Ian Jackson.
  20. <p>
  21. This manual is free software; you may redistribute it and/or modify it
  22. under the terms of the GNU General Public License as published by the
  23. Free Software Foundation; either version 2, or (at your option) any
  24. later version.
  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 warranty of
  28. merchantability or fitness for a particular purpose. See the GNU
  29. General Public License for more details.
  30. <p>
  31. You should have received a copy of the GNU General Public License with
  32. your Debian GNU/Linux system, in <tt>/usr/doc/copyright/GPL</tt>, or
  33. with the <prgn/dpkg/ source package as the file <tt>COPYING</tt>. If
  34. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  35. Cambridge, MA 02139, USA.
  36. <toc sect>
  37. <!-- Describes the technical interface between a package and dpkg.
  38. How to safely put shared libraries in a package. Details of dpkg's
  39. handling of individual files. Sections on when to use which feature
  40. (eg Replaces vs. Replaces/Conflicts vs. update-alternatives
  41. vs. diversions) Cross-references to the policy document (see below)
  42. where appropriate. Description of the interface between dselect and
  43. its access methods. Hints on where to start with a new package (ie,
  44. the hello package). What to do about file aliasing.
  45. file aliasing
  46. Manpages are required for: update-rc.d, diversions,
  47. update-alternatives, install-info in a package.
  48. -->
  49. <chapt id="scope">Introduction and scope of this manual
  50. <p>
  51. <prgn/dpkg/ is a suite of programs for creating binary package files
  52. and installing and removing them on Unix systems.<footnote><prgn/dpkg/
  53. is targetted primarily at Debian GNU/Linux, but may work on or be
  54. ported to other systems.</footnote>
  55. <p>
  56. The binary packages are designed for the management of installed
  57. executable programs (usually compiled binaries) and their associated
  58. data, though source code examples and documentation are provided as
  59. part of some packages.
  60. <p>
  61. This manual describes the technical aspects of creating Debian binary
  62. packages (<tt/.deb/ files). It documents the behaviour of the
  63. package management programs <prgn/dpkg/, <prgn/dselect/ et al. and and the
  64. way they interact with packages.
  65. <p>
  66. It also documents the interaction between <prgn/dselect/'s core and the
  67. access method scripts it uses to actually install the selected
  68. packages, and describes how to create a new access method.
  69. <p>
  70. This manual does not go into detail about the options and usage of the
  71. package building and installation tools. It should therefore be read
  72. in conjuction with those programs' manpages.
  73. <p>
  74. The utility programs which are provided with <prgn/dpkg/ for managing
  75. various system configuration and similar issues, such as
  76. <prgn/update-rc.d/ and <prgn/install-info/, are not described in
  77. detail here - please see their manpages.
  78. <p>
  79. It does <em/not/ describe the policy requirements imposed on Debian
  80. packages, such as the permissions on files and directories,
  81. documentation requirements, upload procedure, and so on. You should
  82. see the Debian packaging policy manual for these details. (Many of
  83. them will probably turn out to be helpful even if you don't plan to
  84. upload your package and make it available as part of the
  85. distribution.)
  86. <p>
  87. It is assumed that the reader is reasonably familiar with the
  88. <prgn/dpkg/ System Administrators' manual.
  89. <p>
  90. The Debian version of the FSF's GNU hello program is provided as an
  91. example for people wishing to create Debian packages.
  92. <p>
  93. <em>Note that this document is still a draft!</em>
  94. <chapt id="binarypkg">Binary packages
  95. <p>
  96. The binary package has two main sections. The first part consists of
  97. various control information files and scripts used by <prgn/dpkg/ when
  98. installing and removing. See <ref id="controlarea">.
  99. <p>
  100. The second part is an archive (currently a <prgn/tar/ archive)
  101. containing files and directories to be installed.
  102. <p>
  103. In the future binary packages may also contain other components, such
  104. as checksums and digital signatures.
  105. <sect id="bincreating">Creating package files - <prgn/dpkg-deb/
  106. <p>
  107. All manipulation of binary package files is done by <prgn/dpkg-deb/;
  108. it's the only program that has knowledge of the format.
  109. (<prgn/dpkg-deb/ may be invoked by calling <prgn/dpkg/, as <prgn/dpkg/ will
  110. spot that the options requested are appropriate to <prgn/dpkg-deb/ and
  111. invoke that instead with the same arguments.)
  112. <p>
  113. In order to create a binary package you must make a directory tree
  114. which contains all the files and directories you want to have in the
  115. filesystem data part of the package. In Debian-format source packages
  116. this directory is usually <tt>debian/tmp</tt>, relative to the top of
  117. the package's source tree.
  118. <p>
  119. They should have the locations (relative to the root of the directory
  120. tree you're constructing) ownerships and permissions which you want
  121. them to have on the system when they are installed.
  122. <p>
  123. With current versions of <prgn/dpkg/ the uid/username and gid/groupname
  124. mappings for the users and groups being used should be the same on the
  125. system where the package is built and the one where it is installed.
  126. <p>
  127. You need to add one special directory to the root of the miniature
  128. filesystem tree you're creating: <prgn/DEBIAN/. It should contain the
  129. control information files, notably the binary package control file
  130. (see <ref id="controlfile">).
  131. <p>
  132. The <prgn/DEBIAN/ directory will not appear in the filesystem archive of
  133. the package, and so won't be installed by <prgn/dpkg/ when the package
  134. is installed.
  135. <p>
  136. When you've prepared the package, you should invoke:
  137. <example>
  138. dpkg --build <var/directory/
  139. </example>
  140. <p>
  141. This will build the package in <tt/<var/directory/.deb/.
  142. (<prgn/dpkg/ knows that <tt/--build/ is a <prgn/dpkg-deb/ option, so it
  143. invokes <prgn/dpkg-deb/ with the same arguments to build the package.)
  144. <p>
  145. See the manpage <manref name="dpkg-deb" section=8> for details of how
  146. to examine the contents of this newly-created file. You may find the
  147. output of following commands enlightening:
  148. <example>
  149. dpkg-deb --info <var/filename/.deb
  150. dpkg-deb --contents <var/filename/.deb
  151. </example>
  152. <sect id="controlarea">Package control information files
  153. <p>
  154. The control information portion of a binary package is a collection of
  155. files with names known to <prgn/dpkg/. It will treat the contents of
  156. these files specially - some of them contain information used by
  157. <prgn/dpkg/ when installing or removing the package; others are scripts
  158. which the package maintainer wants <prgn/dpkg/ to run.
  159. <p>
  160. It is possible to put other files in the package control area, but
  161. this is not generally a good idea (though they will largely be
  162. ignored).
  163. <p>
  164. Here is a brief list of the control info files supported by <prgn/dpkg/
  165. and a summary of what they're used for.
  166. <p>
  167. <taglist>
  168. <tag><tt/control/
  169. <item>
  170. This is the key description file used by <prgn/dpkg/. It specifies the
  171. package's name and version, gives its description for the user, states
  172. its relationships with other packages, and so forth.
  173. See <ref id="controlfile">.
  174. <tag><tt/postinst/, <tt/preinst/, <tt/postrm/, <tt/prerm/
  175. <item>
  176. These are exectuable files (usually scripts) which <prgn/dpkg/ runs
  177. during installation, upgrade and removal of packages. They allow the
  178. package to deal with matters which are particular to that package or
  179. require more complicated processing than that provided by <prgn/dpkg/.
  180. Details of when and how they are called are in
  181. <ref id="maintainerscripts">.
  182. <p>
  183. It is very important to make these scripts itempotent.<footnote>That
  184. means that if it runs successfully or fails and then you call it again
  185. it doesn't bomb out, but just ensures that everything is the way it
  186. ought to be.</footnote> This is so that if an error occurs, the user
  187. interrupts <prgn/dpkg/ or some other unforeseen circumstance happens you
  188. don't leave the user with a badly-broken package.
  189. <p>
  190. The maintainer scripts are guaranteed to run with a controlling
  191. terminal and can interact with the user. If they need to prompt for
  192. passwords, do full-screen interaction or something similar you should
  193. do these things to and from <tt>/dev/tty</>, since <prgn/dpkg/ will at
  194. some point redirect scripts' standard input and output so that it can
  195. log the installation process. Likewise, because these scripts may be
  196. executed with standard output redirected into a pipe for logging
  197. purposes, Perl scripts should set unbuffered output by setting
  198. <tt/$|=1/ so that the output is printed immediately rather than being
  199. buffered.
  200. <p>
  201. Each script should return a zero exit status for success, or a nonzero
  202. one for failure.
  203. <tag><tt/conffiles/
  204. <item>
  205. This file contains a list of configuration files which are to be
  206. handled automatically by <prgn/dpkg/ (see <ref id="conffiles">). Note
  207. that not necessarily every configuration file should be listed here.
  208. </taglist>
  209. <sect id="controlfile">The main control information file: <tt/control/
  210. <p>
  211. The most important control information file used by <prgn/dpkg/ when it
  212. installs a package is <tt/control/. It contains all the package's
  213. `vital statistics'.
  214. <p>
  215. The binary package control files of packages built from Debian sources
  216. are made by a special tool, <prgn/dpkg-gencontrol/, which reads
  217. <tt>debian/control</> and <tt>debian/changelog</> to find the
  218. information it needs. See <ref id="sourcepkg"> for more details.
  219. <p>
  220. The fields in binary package control files are:
  221. <list compact>
  222. <item><qref id="f-Package"><tt/Package/</> (mandatory)
  223. <item><qref id="versions"><tt/Version/</> (mandatory)
  224. <item><qref id="f-Architecture"><tt/Architecture/</>
  225. (mandatory)<footnote>This field should appear in all packages, though
  226. <prgn/dpkg/ doesn't require it yet so that old packages can still be
  227. installed.</footnote>
  228. <item><qref id="relationships"><tt/Depends/, <tt/Provides/ et al.</>
  229. <item><qref id="f-Essential"><tt/Essential/</>
  230. <item><qref id="f-Maintainer"><tt/Maintainer/</>
  231. <item><qref id="f-classification"><tt/Section/, <tt/Priority/</>
  232. <item><qref id="f-Source"><tt/Source/</>
  233. <item><qref id="descriptions"><tt/Description/</>
  234. </list>
  235. <p>
  236. A description of the syntax of control files and the purpose of these
  237. fields is available in <ref id="controlfields">.
  238. <chapt id="sourcepkg">Source packages
  239. <p>
  240. The Debian binary packages in the distribution are generated from
  241. Debian sources, which are in a special format to assist the easy and
  242. automatic building of binaries.
  243. <p>
  244. Tools are provided for manipulating source packages; they pack and
  245. unpack sources and help build of binary packages and help manage the
  246. distribution of new versions. See <manref name=dpkg-source section=1>
  247. for details.
  248. <sect>The Debianised source tree
  249. <p>
  250. The source archive scheme described later is intended to allow a
  251. Debianised source tree with some associated control information to be
  252. reproduced and transported easily. The Debianised source tree is a
  253. version of the original program with certain files added for the
  254. benefit of the Debianisation process, and with any other changes
  255. required made to the rest of the source code and installation scripts.
  256. <p>
  257. The extra files created for Debian are in the subdirectory <tt/debian/
  258. of the top level of the Debianised source tree. They are described
  259. below.
  260. <sect1><tt>debian/rules</tt> - the main building script
  261. <p>
  262. This file is an executable makefile, and contains the package-specific
  263. recipies for compiling the package and building binary package(s) out
  264. of the source.
  265. <p>
  266. It must start with the line <tt>#!/usr/bin/make -f</tt>, so that it
  267. can be invoked by saying its name rather than invoking <prgn/make/
  268. explicitly.
  269. <p>
  270. The targets which are required to be present are:
  271. <taglist>
  272. <tag/<tt/build//
  273. <item>
  274. This should perform all non-interactive configuration and compilation
  275. of the package. If a package has an interactive pre-build
  276. configuration routine, the Debianised source package should be built
  277. after this has taken place, so that it can be built without rerunning
  278. the configuration.
  279. <p>
  280. For some packages, notably ones where the same source tree is compiled
  281. in different ways to produce two binary packages, the <prgn/build/
  282. target does not make much sense. For these packages it is good enough
  283. to provide two (or more) targets (<tt/build-a/ and <tt/build-b/ or
  284. whatever) for each of the ways of building the package, and a
  285. <prgn/build/ target that does nothing. The <prgn/binary/ target will have
  286. to build the package in each of the possible ways and make the binary
  287. package out of each.
  288. <p>
  289. The <prgn/build/ target must not do anything that might require root
  290. privilege.
  291. <p>
  292. The <prgn/build/ target may need to run <prgn/clean/ first - see below.
  293. <p>
  294. When a package has a configuration routine that takes a long time, or
  295. when the makefiles are poorly designed, or when <prgn/build/ needs to
  296. run <prgn/clean/ first, it is a good idea to <tt/touch build/ when the
  297. build process is complete. This will ensure that if <tt>debian/rules
  298. build</tt> is run again it will not rebuild the whole program.
  299. <tag/<tt/binary//
  300. <item>
  301. This target should be all that is necessary for the user to build the
  302. binary package. It should depend on the <prgn/build/ target, above,
  303. so that the package is built if it has not been already. It should
  304. then create the binary package(s), using <prgn/dpkg-gencontrol/ to
  305. make their control files and <prgn/dpkg-deb/ to build them and place
  306. them in the parent of the top level directory.
  307. <p>
  308. <ref id="binarypkg"> describes how to construct binary packages.
  309. <p>
  310. The <prgn/binary/ target must be invoked as root.
  311. <tag/<tt/clean//
  312. <item>
  313. This should undo any effects that the <prgn/build/ and <prgn/binary/
  314. targets may have had, except that it should leave alone any output
  315. files created in the parent directory by a run of <prgn/binary/.
  316. <p>
  317. If a <prgn/build/ file is touched at the end of the <prgn/build/ target,
  318. as suggested above, it must be removed as the first thing that
  319. <prgn/clean/ does, so that running <prgn/build/ again after an interrupted
  320. <prgn/clean/ doesn't think that everything is already done.
  321. <p>
  322. The <prgn/clean/ target must be invoked as root if <prgn/binary/ has
  323. been invoked since the last <prgn/clean/, or if <prgn/build/ has been
  324. invoked as root (since <prgn/build/ may create directories, for
  325. example).
  326. <tag/<tt/get-orig-source//
  327. <item>
  328. This target fetches the most recent version of the original source
  329. package from a canonical archive site (via FTP or WWW, for example),
  330. does any necessary rearrangement to turn it into the original source
  331. tarfile format described below, and leaves it in the current directory.
  332. <p>
  333. This target may be invoked in any directory, and should take care to
  334. clean up any temporary files it may have left.
  335. <p>
  336. This target is optional, but providing it if possible is a good idea.
  337. </taglist>
  338. The <prgn/build/, <prgn/binary/ and <prgn/clean/ targets must be
  339. invoked with a current directory of the package's top-level
  340. directory.
  341. <p>
  342. Additional targets may exist in <tt>debian/rules</tt>, either as
  343. published or undocumented interfaces or for the package's internal
  344. use.
  345. <sect1><tt>debian/control</tt>
  346. <p>
  347. This file contains version-independent details about the source
  348. package and about the binary packages it creates.
  349. <p>
  350. It is a series of sets of control fields, each syntactically similar
  351. to a binary package control file. The sets are separated by one or
  352. more blank lines. The first set is information about the source
  353. package in general; each subsequent set describes one binary package
  354. that the source tree builds.
  355. <p>
  356. The syntax and semantics of the fields are described below in
  357. <ref id="controlfields">.
  358. <p>
  359. The general (binary-package-independent) fields are:
  360. <list compact>
  361. <item><qref id="f-Source"><tt/Source/</> (mandatory)
  362. <item><qref id="f-Maintainer"><tt/Maintainer/</>
  363. <item><qref id="f-classification"><tt/Section/ and <tt/Priority/</>
  364. (classification, mandatory)
  365. <item><qref id="f-Standards-Version"><tt/Standards-Version/</>
  366. </list>
  367. <p>
  368. The per-binary-package fields are:
  369. <list compact>
  370. <item><qref id="f-Package"><tt/Package/</> (mandatory)
  371. <item><qref id="f-Architecture"><tt/Architecture/</> (mandatory)
  372. <item><qref id="descriptions"><tt/Description/</>
  373. <item><qref id="f-classification"><tt/Section/ and <tt/Priority/</> (classification)
  374. <item><qref id="f-Essential"><tt/Essential/</>
  375. <item><qref id="relationships"><tt/Depends/ et al.</> (package interrelationships)
  376. </list>
  377. <p>
  378. These fields are used by <prgn/dpkg-gencontrol/ to generate control
  379. files for binary packages (see below), by <prgn/dpkg-genchanges/ to
  380. generate the <tt/.changes/ file to accompany the upload, and by
  381. <prgn/dpkg-source/ when it creates the <tt/.dsc/ source control file as
  382. part of a source archive.
  383. <p>
  384. The fields here may contain variable references - their values will be
  385. substituted by <prgn/dpkg-gencontrol/, <prgn/dpkg-genchanges/ or
  386. <prgn/dpkg-source/ when they generate output control files. See <ref
  387. id="srcsubstvars"> for details.
  388. <p>
  389. <sect2>User-defined fields
  390. <p>
  391. Additional user-defined fields may be added to the source package
  392. control file. Such fields will be ignored, and not copied to (for
  393. example) binary or source package control files or upload control
  394. files.
  395. <p>
  396. If you wish to add additional unsupported fields to these output files
  397. you should use the mechanism described here.
  398. <p>
  399. Fields in the main source control information file with names starting
  400. <tt/X/, followed by one or more of the letters <tt/BCS/ and a hyphen
  401. <tt/-/, will be copied to the output files. Only the part of the
  402. field name after the hyphen will be used in the output file. Where
  403. the letter <tt/B/ is used the field will appear in binary package
  404. control files, where the letter <tt/S/ is used in source package
  405. control files and where <tt/C/ is used in upload control
  406. (<tt/.changes/) files.
  407. <p>
  408. For example, if the main source information control file contains the
  409. field
  410. <example>
  411. XBS-Comment: I stand between the candle and the star.
  412. </example>
  413. then the binary and source package control files will contain the
  414. field
  415. <example>
  416. Comment: I stand between the candle and the star.
  417. </example>
  418. <sect1 id="dpkgchangelog"><tt>debian/changelog</>
  419. <p>
  420. This file records the changes to the Debian-specific parts of the
  421. package<footnote>Though there is nothing stopping an author who is
  422. also the Debian maintainer from using it for all their changes, it
  423. will have to be renamed if the Debian and upstream maintainers become
  424. different people.</footnote>.
  425. <p>
  426. It has a special format which allows the package building tools to
  427. discover which version of the package is being built and find out
  428. other release-specific information.
  429. <p>
  430. That format is a series of entries like this:
  431. <example>
  432. <var/package/ (<var/version/) <var/distribution(s)/; urgency=<var/urgency/
  433. * <var/change details/
  434. <var/more change details/
  435. * <var/even more change details/
  436. -- <var/maintainer name and email address/ <var/date/
  437. </example>
  438. <p>
  439. <var/package/ and <var/version/ are the source package name and
  440. version number. <var/distribution(s)/ lists the distributions where
  441. this version should be installed when it is uploaded - it is copied to
  442. the <tt/Distribution/ field in the <tt/.changes/ file. See <ref
  443. id="f-Distribution">.
  444. <p>
  445. <var/urgency/ is the value for the <tt/Urgency/ field in the
  446. <tt/.changes/ file for the upload. See <ref id="f-Urgency">. It is
  447. not possible to specify an urgency containing commas; commas are used
  448. to separate <tt/<var/keyword/=<var/value// settings in the <prgn/dpkg/
  449. changelog format (though there is currently only one useful
  450. <var/keyword/, <tt/urgency/).
  451. <p>
  452. The change details may in fact be any series of lines starting with at
  453. least two spaces, but conventionally each change starts with an
  454. asterisk and a separating space and continuation lines are indented so
  455. as to bring them in line with the start of the text above. Blank
  456. lines may be used here to separate groups of changes, if desired.
  457. <p>
  458. The maintainer name and email address should <em/not/ necessarily be
  459. those of the usual package maintainer. They should be the details of
  460. the person doing <em/this/ version. The information here will be
  461. copied to the <tt/.changes/ file, and then later used to send an
  462. acknowledgement when the upload has been installed.
  463. <p>
  464. The <var/date/ should be in RFC822 format; it should include the
  465. timezone specified numerically, with the timezone name or abbreviation
  466. optionally present as a comment.
  467. <p>
  468. The first `title' line with the package name should start at the left
  469. hand margin; the `trailer' line with the maintainer and date details
  470. should be preceded by exactly one space. The maintainer details and
  471. the date must be separated by exactly two spaces.
  472. <p>
  473. An Emacs mode for editing this format is available: it is called
  474. <tt/debian-changelog-mode/. You can have this mode selected
  475. automatically when you edit a Debian changelog by adding a local
  476. variables clause to the end of the changelog.
  477. <sect2>Defining alternative changelog formats
  478. <p>
  479. It is possible to use a different format to the standard one, by
  480. providing a parser for the format you wish to use.
  481. <p>
  482. In order to have <tt/dpkg-parsechangelog/ run your parser, you must
  483. include a line within the last 40 lines of your file matching the Perl
  484. regular expression:
  485. <example>
  486. \schangelog-format:\s+([0-9a-z]+)\W
  487. </example>
  488. The part in parentheses should be the name of the format.
  489. <p>
  490. If such a line exists then <tt/dpkg-parsechangelog/ will look for the
  491. parser as <tt>/usr/lib/dpkg/parsechangelog/<var/format-name/</> or
  492. <tt>/usr/local/lib/dpkg/parsechangelog/<var/format-name/</>; it is an
  493. error for it not to find it, or for it not to be an executable
  494. program. The default changelog format is <tt/dpkg/, and a parser for
  495. it is provided with the <tt/dpkg/ package.
  496. <p>
  497. The parser will be invoked with the changelog open on standard input
  498. at the start of the file. It should read the file (it may seek if it
  499. wishes) to determine the information required and return the parsed
  500. information to standard output in the form of a series of control
  501. fields in the standard format. By default it should return
  502. information about only the most recent version in the changelog; it
  503. should accept a <tt/-v<var/version// option to return changes
  504. information from all versions present <em/strictly after/
  505. <var/version/, and it should then be an error for <var/version/ not to
  506. be present in the changelog.
  507. <p>
  508. The fields are:
  509. <list compact>
  510. <item><qref id="f-Source"><tt/Source/</>
  511. <item><qref id="versions"><tt/Version/</> (mandatory)
  512. <item><qref id="f-Distribution"><tt/Distribution/</> (mandatory)
  513. <item><qref id="f-Urgency"><tt/Urgency/</> (mandatory)
  514. <item><qref id="f-Maintainer"><tt/Maintainer/</> (mandatory)
  515. <item><qref id="f-Date"><tt/Date/</>
  516. <item><qref id="f-Changes"><tt/Changes/</> (mandatory)
  517. </list>
  518. <p>
  519. If several versions are being returned (due to the use of <tt/-v/),
  520. the urgency value should be of the highest urgency code listed at the
  521. start of any of the versions requested followed by the concatenated
  522. (space-separated) comments from all the versions requested; the
  523. maintainer, version, distribution and date should always be from the
  524. most recent version.
  525. <p>
  526. For the format of the <tt/Changes/ field see <ref id="f-Changes">.
  527. <p>
  528. If the changelog format which is being parsed always or almost always
  529. leaves a blank line between individual change notes these blank lines
  530. should be stripped out, so as to make the resulting output compact.
  531. <p>
  532. If the changelog format does not contain date or package name
  533. information this information should be omitted from the output. The
  534. parser should not attempt to synthesise it or find it from other
  535. sources.
  536. <p>
  537. If the changelog does not have the expected format the parser should
  538. exit with a nonzero exit status, rather than trying to muddle through
  539. and possibly generating incorrect output.
  540. <p>
  541. A changelog parser may not interact with the user at all.
  542. <sect1 id="srcsubstvars"><tt>debian/substvars</> and variable substitutions
  543. <p>
  544. When <prgn/dpkg-gencontrol/, <prgn/dpkg-genchanges/ and
  545. <prgn/dpkg-source/ generate control files they do variable
  546. substitutions on their output just before writing it. Variable
  547. substitutions have the form <tt/${<var/variable-name/}/. The optional
  548. file <tt>debian/substvars</> contains variable substitutions to be
  549. used; variables can also be set directly from <tt>debian/rules</>
  550. using the <tt/-V/ option to the source packaging commands, and certain
  551. predefined variables are available.
  552. <p>
  553. The file may be a static part of the source archive, or generated and
  554. modified dynamically by <tt>debian/rules</> targets. In the latter
  555. case it must be removed by the <prgn/clean/ target.
  556. <p>
  557. See <manref name=dpkg-source section=1> for full details about source
  558. variable substitutions, including the format of
  559. <tt>debian/substvars</>.
  560. <sect1><tt>debian/files</>
  561. <p>
  562. This file is not a permanent part of the source tree; it is used while
  563. building packages to record which files are being generated.
  564. <prgn/dpkg-genchanges/ uses it when it generates a <tt/.changes/ file.
  565. <p>
  566. It should not exist in a shipped source package, and so it (and any
  567. backup files or temporary files such as
  568. <tt/files.new/<footnote><tt/files.new/ is used as a temporary file by
  569. <prgn/dpkg-gencontrol/ and <prgn/dpkg-distaddfile/ - they write a new
  570. version of <tt/files/ here before renaming it, to avoid leaving a
  571. corrupted copy if an error occurs</footnote>) should be removed by the
  572. <prgn/clean/ target. It may also be wise to ensure a fresh start by
  573. emptying or removing it at the start of the <prgn/binary/ target.
  574. <p>
  575. <prgn/dpkg-gencontrol/ adds an entry to this file for the <tt/.deb/
  576. file that will be created by <prgn/dpkg-deb/ from the control file
  577. that it generates, so for most packages all that needs to be done with
  578. this file is to delete it in <prgn/clean/.
  579. <p>
  580. If a package upload includes files besides the source package and any
  581. binary packages whose control files were made with
  582. <prgn/dpkg-gencontrol/ then they should be placed in the parent of the
  583. package's top-level directory and <prgn/dpkg-distaddfile/ should be
  584. called to add the file to the list in <tt>debian/files</>.
  585. <sect1><tt>debian/tmp</>
  586. <p>
  587. This is the canonical temporary location for the construction of
  588. binary packages by the <prgn/binary/ target. The directory <tt/tmp/
  589. serves as the root of the filesystem tree as it is being constructed
  590. (for example, by using the package's upstream makefiles install
  591. targets and redirecting the output there), and it also contains the
  592. <tt/DEBIAN/ subdirectory. See <ref id="bincreating">.
  593. <p>
  594. If several binary packages are generated from the same source tree it
  595. is usual to use several <tt>debian/tmp<var/something/</> directories,
  596. for example <tt/tmp-a/ or <tt/tmp-doc/.
  597. <p>
  598. Whatever <tt>tmp</> directories are created and used by <prgn/binary/
  599. must of course be removed by the <prgn/clean/ target.
  600. <sect id="sourcearchives">Source packages as archives
  601. <p>
  602. As it exists on the FTP site, a Debian source package consists of
  603. three related files. You must have the right versions of all three to
  604. be able to use them.
  605. <p>
  606. <taglist>
  607. <tag/Debian source control file - <tt/.dsc//
  608. <item>
  609. This file contains a series of fields, identified and separated just
  610. like the fields in the control file of a binary package. The fields
  611. are listed below; their syntax is described above, in
  612. <ref id="controlfields">.
  613. <list compact>
  614. <item><qref id="f-Source"><tt/Source/</>
  615. <item><qref id="versions"><tt/Version/</>
  616. <item><qref id="f-Maintainer"><tt/Maintainer/</>
  617. <item><qref id="f-Binary"><tt/Binary/</>
  618. <item><qref id="f-Architecture"><tt/Architecture/</>
  619. <item><qref id="f-Standards-Version"><tt/Standards-Version/</>
  620. <item><qref id="f-Files"><tt/Files/</>
  621. </list>
  622. <p>
  623. The source package control file is generated by <prgn/dpkg-source/
  624. when it builds the source archive, from other files in the source
  625. package, described above. When unpacking it is checked against the
  626. files and directories in the other parts of the source package, as
  627. described below.
  628. <tag/Original source archive - <tt/<var/package/_<var/upstream-version/.orig.tar.gz//
  629. <item>
  630. This is a compressed (with <tt/gzip -9/) <prgn/tar/ file containing
  631. the source code from the upstream authors of the program. The tarfile
  632. unpacks into a directory
  633. <tt/<var/package/-<var/upstream-version/.orig/, and does not contain
  634. files anywhere other than in there or in its subdirectories.
  635. <tag/Debianisation diff - <tt/<var/package/_<var/version-revision/.diff.gz//
  636. <item>
  637. This is a unified context diff (<tt/diff -u/) giving the changes which
  638. are required to turn the original source into the Debian source.
  639. These changes may only include editing and creating plain files. The
  640. permissions of files, the targets of symbolic links and the
  641. characteristics of special files or pipes may not be changed and no
  642. files may be removed or renamed.
  643. <p>
  644. All the directories in the diff must exist, except the <tt/debian/
  645. subdirectory of the top of the source tree, which will be created by
  646. <prgn/dpkg-source/ if necessary when unpacking.
  647. <p>
  648. The <prgn/dpkg-source/ program will automatically make the
  649. <tt>debian/rules</tt> file executable (see below).
  650. </taglist>
  651. <p>
  652. If there is no original source code - for example, if the package is
  653. specially prepared for Debian or the Debian maintainer is the same as
  654. the upstream maintainer - the format is slightly different: then there
  655. is no diff, and the tarfile is named
  656. <tt/<var/package/_<var/version/.tar.gz</> and contains a directory
  657. <tt/<var/package/-<var/version/</>.
  658. <sect>Unpacking a Debian source package without <prgn/dpkg-source/
  659. <p>
  660. <tt/dpkg-source -x/ is the recommended way to unpack a Debian source
  661. package. However, if it is not available it is possible to unpack a
  662. Debian source archive as follows:
  663. <enumlist compact>
  664. <item>Untar the tarfile, which will create a <tt/.orig/ directory.
  665. <item>Rename the <tt/.orig/ directory to
  666. <tt/<var/package/-<var/version//.
  667. <item>Create the subdirectory <tt/debian/ at the top of the source
  668. tree.
  669. <item>Apply the diff using <tt/patch -p0/.
  670. <item>Untar the tarfile again if you want a copy of the original
  671. source code alongside the Debianised version.
  672. </enumlist>
  673. <p>
  674. It is not possible to generate a valid Debian source archive without
  675. using <prgn/dpkg-source/. In particular, attempting to use
  676. <prgn/diff/ directly to generate the <tt/.diff.gz/ file will not work.
  677. <sect1>Restrictions on objects in source packages
  678. <p>
  679. The source package may not contain any device special files, sockets
  680. or setuid or setgid files.<footnote>Setgid directories are
  681. allowed.</footnote>
  682. <p>
  683. The source packaging tools manage the changes between the original and
  684. Debianised source using <prgn/diff/ and <prgn/patch/. Turning the
  685. original source tree as included in the <tt/.orig.tar.gz/ into the
  686. debianised source must not involve any changes which cannot be handled
  687. by these tools. Problematic changes which cause <prgn/dpkg-source/ to
  688. halt with an error when building the source package are:
  689. <list compact>
  690. <item>Adding or removing symbolic links, sockets or pipes.
  691. <item>Changing the targets of symbolic links.
  692. <item>Creating directories, other than <tt/debian/.
  693. <item>Changes to the contents of binary files.
  694. </list>
  695. Changes which cause <prgn/dpkg-source/ to print a warning but continue
  696. anyway are:
  697. <list compact>
  698. <item>Removing files, directories or symlinks. <footnote>Renaming a
  699. file is not treated specially - it is seen as the removal of the old
  700. file (which generates a warning, but is otherwise ignored), and the
  701. creation of the new one.</footnote>
  702. </list>
  703. Changes which are not represented, but which are not detected by
  704. <prgn/dpkg-source/, are:
  705. <list compact>
  706. <item>Changing the permissions of files (other than
  707. <tt>debian/rules</>) and directories.
  708. </list>
  709. <p>
  710. The <tt/debian/ directory and <tt>debian/rules</> are handled
  711. specially by <prgn/dpkg-source/ - before applying the changes it will
  712. create the <tt/debian/ directory, and afterwards it will make
  713. <tt>debian/rules</> world-exectuable.
  714. <chapt id="controlfields">Control files and their fields
  715. <p>
  716. Many of the tools in the <prgn/dpkg/ suite manipulate data in a common
  717. format, known as control files. Binary and source packages have
  718. control data as do the <tt/.changes/ files which control the
  719. installation of uploaded files, and <prgn/dpkg/'s internal databases
  720. are in a similar format.
  721. <sect>Syntax of control files
  722. <p>
  723. A file consists of one or more paragraphs of fields. The paragraphs
  724. are separated by blank lines. Some control files only allow one
  725. paragraph; others allow several, in which case each paragraph often
  726. refers to a different package.
  727. <p>
  728. Each paragraph is a series of fields and values; each field consists
  729. of a name, followed by a colon and the value. It ends at the end of
  730. the line. Horizontal whitespace (spaces and tabs) may occur before or
  731. after the value and is ignored there; it is conventional to put a
  732. single space after the colon.
  733. <p>
  734. Some fields' values may span several lines; in this case each
  735. continuation line <em/must/ start with a space or tab. Any trailing
  736. spaces or tabs at the end of individual lines of a field value are
  737. ignored.
  738. <p>
  739. Except where otherwise stated only a single line of data is allowed
  740. and whitespace is not significant in a field body. Whitespace may
  741. never appear inside names (of packages, architectures, files or
  742. anything else), version numbers or in between the characters of
  743. multi-character version relationships.
  744. <p>
  745. Field names are not case-sensitive, but it is usual to capitalise the
  746. fields using mixed case as shown below.
  747. <p>
  748. Blank lines, or lines consisting only of spaces and tabs, are not
  749. allowed within field values or between fields - that would mean a new
  750. paragraph.
  751. <p>
  752. It is important to note that there are several fields which are
  753. optional as far as <prgn/dpkg/ and the related tools are concerned,
  754. but which must appear in every Debian package, or whose omission may
  755. cause problems. When writing the control files for Debian packages
  756. you <em/must/ read the Debian policy manual in conjuction with the
  757. details below and the list of fields for the particular file.
  758. <sect>List of fields
  759. <sect1 id="f-Package"><tt/Package/
  760. <p>
  761. The name of the binary package. Package names consist of the
  762. alphanumerics and <tt/+/ <tt/-/ <tt/./ (plus, minus and full
  763. stop).<footnote>The characters <tt/@/ <tt/:/ <tt/=/ <tt/%/ <tt/_/ (at,
  764. colon, equals, percent and underscore) used to be legal and are still
  765. accepted when found in a package file, but may not be used in new
  766. packages</footnote>
  767. <p>
  768. They must be at least two characters and must start with an
  769. alphanumeric. In current versions of dpkg they are sort of
  770. case-sensitive<footnote>This is a bug.</footnote>; use lowercase
  771. package names unless the package you're building (or referring to, in
  772. other fields) is already using uppercase.
  773. <sect1 id="f-Version"><tt/Version/
  774. <p>
  775. This lists the source or binary package's version number - see <ref
  776. id="versions">.
  777. <sect1 id="f-Architecture"><tt/Architecture/
  778. <p>
  779. This is the architecture string; it is a single word for the CPU
  780. architecture.
  781. <p>
  782. <prgn/dpkg/ will check the declared architecture of a binary package
  783. against its own compiled-in value before it installs it.
  784. <p>
  785. The special value <tt/all/ indicates that the package is
  786. architecture-independent.
  787. <p>
  788. In the main <tt>debian/control</> file in the source package, or in
  789. the source package control file <tt/.dsc/, a list of architectures
  790. (separated by spaces) is also allowed, as is the special value
  791. <tt/any/. A list indicates that the source will build an
  792. architecture-dependent package, and will only work correctly on the
  793. listed architectures. <tt/any/ indicates that though the source
  794. package isn't dependent on any particular architecture and should
  795. compile fine on any one, the binary package(s) produced are not
  796. architecture-independent but will instead be specific to whatever the
  797. current build architecture is.
  798. <p>
  799. In a <tt/.changes/ file the <tt/Architecture/ field lists the
  800. architecture(s) of the package(s) currently being uploaded. This will
  801. be a list; if the source for the package is being uploaded too the
  802. special entry <tt/source/ is also present.
  803. <p>
  804. The current build architecture can be determined using <tt/dpkg
  805. --print-architecture/.<footnote>This actually invokes
  806. <example>
  807. gcc --print-libgcc-file-name
  808. </example>
  809. and parses and decomposes the output and looks the CPU type from the
  810. GCC configuration in a table in <prgn/dpkg/. This is so that it will
  811. work if you're cross-compiling.
  812. </footnote>
  813. This value is automatically used by <prgn/dpkg-gencontrol/ when
  814. building the control file for a binary package for which the source
  815. control information doesn't specify architecture <tt/all/.
  816. <p>
  817. There is a separate option, <tt/--print-installation-architecture/,
  818. for finding out what architecture <prgn/dpkg/ is willing to install.
  819. This information is also in the output of <tt/dpkg --version/.
  820. <sect1 id="f-Maintainer"><tt/Maintainer/
  821. <p>
  822. The package maintainer's name and email address. The name should come
  823. first, then the email address inside angle brackets <tt/&lt;&gt/ (in
  824. RFC822 format).
  825. <p>
  826. If the maintainer's name contains a full stop then the whole field
  827. will not work directly as an email address due to a misfeature in the
  828. syntax specified in RFC822; a program using this field as an address
  829. must check for this and correct the problem if necessary (for example
  830. by putting the name in round brackets and moving it to the end, and
  831. bringing the email address forward).
  832. <p>
  833. In a <tt/.changes/ file or parsed changelog data this contains the
  834. name and email address of the person responsible for the particular
  835. version in question - this may not be the package's usual maintainer.
  836. <p>
  837. This field is usually optional in as far as the <prgn/dpkg/ are
  838. concerned, but its absence when building packages usually generates a
  839. warning.
  840. <sect1 id="f-Source"><tt/Source/
  841. <p>
  842. This field identifies the source package name.
  843. <p>
  844. In a main source control information or a <tt/.changes/ or <tt/.dsc/
  845. file or parsed changelog data this may contain only the name of the
  846. source package.
  847. <p>
  848. In the control file of a binary package (or in a <tt/Packages/ file)
  849. it may be followed by a version number in parentheses.<footnote>It is
  850. usual to leave a space after the package name if a version number is
  851. specified.</footnote> This version number may be omitted (and is, by
  852. <prgn/dpkg-gencontrol/) if it has the same value as the <tt/Version/
  853. field of the binary package in question. The field itself may be
  854. omitted from a binary package control file when the source package has
  855. the same name and version as the binary package.
  856. <sect1>Package interrelationship fields:
  857. <tt/Depends/, <tt/Pre-Depends/, <tt/Recommends/
  858. <tt/Suggests/, <tt/Conflicts/, <tt/Provides/, <tt/Replaces/
  859. <p>
  860. These fields describe the package's relationships with other packages.
  861. Their syntax and semantics are described in <ref id="relationships">.
  862. <sect1 id="f-Description"><tt/Description/
  863. <p>
  864. In a binary package <tt/Packages/ file or main source control file
  865. this field contains a description of the binary package, in a special
  866. format. See <ref id="descriptions"> for details.
  867. <p>
  868. In a <tt/.changes/ file it contains a summary of the descriptions for
  869. the packages being uploaded. The part of the field before the first
  870. newline is empty; thereafter each line has the name of a binary
  871. package and the summary description line from that binary package.
  872. Each line is indented by one space.
  873. <sect1 id="f-Essential"><tt/Essential/
  874. <p>
  875. This is a boolean field which may occur only in the control file of a
  876. binary package (or in the <tt/Packages/ file) or in a per-package
  877. fields paragraph of a main source control data file.
  878. <p>
  879. If set to <tt/yes/ then <prgn/dpkg/ and <prgn/dselect/ will refuse to
  880. remove the package (though it can be upgraded and/or replaced). The
  881. other possible value is <tt/no/, which is the same as not having the
  882. field at all.
  883. <sect1 id="f-classification"><tt/Section/ and <tt/Priority/
  884. <p>
  885. These two fields classify the package. The <tt/Priority/ represents
  886. how important that it is that the user have it installed; the
  887. <tt/Section/ represents an application area into which the package has
  888. been classified.
  889. <p>
  890. When they appear in the <tt>debian/control</> file these fields give
  891. values for the section and priority subfields of the <tt/Files/ field
  892. of the <tt/.changes/ file, and give defaults for the section and
  893. priority of the binary packages.
  894. <p>
  895. The section and priority are represented, though not as separate
  896. fields, in the information for each file in the <qref
  897. id="f-Files"><tt/Files/</> field of a <tt/.changes/ file. The
  898. section value in a <tt/.changes/ file is used to decide where to
  899. install a package in the FTP archive.
  900. <p>
  901. These fields are not used by by <prgn/dpkg/ proper, but by
  902. <prgn/dselect/ when it sorts packages and selects defaults. See the
  903. Debian policy manual for the priorities in use and the criteria for
  904. selecting the priority for a Debian package, and look at the Debian
  905. FTP archive for a list of currently in-use priorities.
  906. <p>
  907. These fields may appear in binary package control files, in which case
  908. they provide a default value in case the <tt/Packages/ files are
  909. missing the information. <prgn/dpkg/ and <prgn/dselect/ will only use
  910. the value from a <tt/.deb/ file if they have no other information; a
  911. value listed in a <tt/Packages/ file will always take precedence. By
  912. default <prgn/dpkg-genchanges/ does not include the section and
  913. priority in the control file of a binary package - use the <tt/-isp/,
  914. <tt/-is/ or <tt/-ip/ options to achieve this effect.
  915. <sect1 id="f-Binary"><tt/Binary/
  916. <p>
  917. This field is a list of binary packages.
  918. <p>
  919. When it appears in the <tt/.dsc/ file it is the list of binary
  920. packages which a source package can produce. It does not necessarily
  921. produce all of these binary packages for every architecture. The
  922. source control file doesn't contain details of which architectures are
  923. appropriate for which of the binary packages.
  924. <p>
  925. When it appears in a <tt/.changes/ file it lists the names of the
  926. binary packages actually being uploaded.
  927. <p>
  928. The syntax is a list of binary packages separated by
  929. commas.<footnote>A space after each comma is conventional.</footnote>
  930. Currently the packages must be separated using only spaces in the
  931. <tt/.changes/ file.
  932. <sect1 id="f-Files"><tt/Files/
  933. <p>
  934. This field contains a list of files with information about each one.
  935. The exact information and syntax varies with the context. In all
  936. cases the the part of the field contents on the same line as the field
  937. name is empty. The remainder of the field is one line per file, each
  938. line being indented by one space and containing a number of sub-fields
  939. separated by spaces.
  940. <p>
  941. In the <tt/.dsc/ (Debian source control) file each line contains the
  942. MD5 checksum, size and filename of the tarfile and (optionally) diff
  943. file which make up the remainder of the source package.<footnote>That
  944. is, the parts which are not the <tt/.dsc/.</footnote> The exact forms
  945. of the filenames are described in <ref id="sourcearchives">.
  946. <p>
  947. In the <tt/.changes/ file this contains one line per file being
  948. uploaded. Each line contains the MD5 checksum, size, section and
  949. priority and the filename. The section and priority are the values of
  950. the corresponding fields in the main source control file - see <ref
  951. id="f-classification">. If no section or priority is specified then
  952. <tt/-/ should be used, though section and priority values must be
  953. specified for new packages to be installed properly.
  954. <p>
  955. The special value <tt/byhand/ for the section indicates that the file
  956. in question is not an ordinary package file and must by installed by
  957. hand by the distribution maintainers. If the section is <tt/byhand/
  958. the priority should be <tt/-/.
  959. <sect1 id="f-Standards-Version"><tt/Standards-Version/
  960. <p>
  961. The most recent version of the standards (the <prgn/dpkg/ programmers'
  962. and policy manuals and associated texts) with which the package
  963. complies. This is updated manually when editing the source package to
  964. conform to newer standards; it can sometimes be used to tell when a
  965. package needs attention.
  966. <p>
  967. Its format is the same as that of a version number except that no
  968. epoch or Debian revision is allowed - see <ref id="versions">.
  969. <sect1 id="f-Distribution"><tt/Distribution/
  970. <p>
  971. In a <tt/.changes/ file or parsed changelog output this contains the
  972. (space-separated) name(s) of the distribution(s) where this version of
  973. the package should be or was installed. Distribution names follow the
  974. rules for package names. (See <ref id="f-Package">).
  975. <p>
  976. Current distribution values are <tt/stable/, <tt/unstable/,
  977. <tt/contrib/, <tt/non-free/ and <tt/experimental/.
  978. <sect1 id="f-Urgency"><tt/Urgency/
  979. <p>
  980. This is a description of how important it is to upgrade to this
  981. version from previous ones. It consists of a single keyword usually
  982. taking one of the values <tt/LOW/, <tt/MEDIUM/ or <tt/HIGH/) followed
  983. by an optional commentary (separated by a space) which is usually in
  984. parentheses. For example:
  985. <example>
  986. Urgency: LOW (HIGH for diversions users)
  987. </example>
  988. <p>
  989. This field appears in the <tt/.changes/ file and in parsed changelogs;
  990. its value appears as the value of the <tt/urgency/ attribute in a
  991. <prgn/dpkg/-style changelog (see <ref id="dpkgchangelog">).
  992. <p>
  993. Urgency keywords are not case-sensitive.
  994. <sect1 id="f-Date"><tt/Date/
  995. <p>
  996. In <tt/.changes/ files and parsed changelogs, this gives the date the
  997. package was built or last edited.
  998. <sect1 id="f-Format"><tt/Format/
  999. <p>
  1000. This field occurs in <tt/.changes/ files, and specifies a format
  1001. revision for the file. The format described here is version <tt/1.5/.
  1002. The syntax of the format value is the same as that of a package
  1003. version number except that no epoch or Debian revision is allowed -
  1004. see <ref id="versions">.
  1005. <sect1 id="f-Changes"><tt/Changes/
  1006. <p>
  1007. In a <tt/.changes/ file or parsed changelog this field contains the
  1008. human-readable changes data, describing the differences between the
  1009. last version and the current one.
  1010. <p>
  1011. There should be nothing in this field before the first newline; all
  1012. the subsequent lines must be indented by at least one space; blank
  1013. lines must be represented by a line consiting only of a space and a
  1014. full stop.
  1015. <p>
  1016. Each version's change information should be preceded by a `title' line
  1017. giving at least the version, distribution(s) and urgency, in a
  1018. human-readable way.
  1019. <p>
  1020. If data from several versions is being returned the entry for the most
  1021. recent version should be returned first, and entries should be
  1022. separated by the representation of a blank line (the `title' line may
  1023. also be followed by the representation of blank line).
  1024. <sect1 id="f-Filename"><tt/Filename/ and <tt/MSDOS-Filename/
  1025. <p>
  1026. These fields in <tt/Packages/ files give the filename(s) of (the parts
  1027. of) a package in the distribution directories, relative to the root of
  1028. the Debian hierarchy. If the package has been split into several
  1029. parts the parts are all listed in order, separated by spaces.
  1030. <sect1 id="f-Size"><tt/Size/ and <tt/MD5sum/
  1031. <p>
  1032. These fields in <tt/Packages/ files give the size (in bytes, expressed
  1033. in decimal) and MD5 checksum of the file(s) which make(s) up a binary
  1034. package in the distribution. If the package is split into several
  1035. parts the values for the parts are listed in order, separated by
  1036. spaces.
  1037. <sect1 id="f-Status"><tt/Status/
  1038. <p>
  1039. This field in <prgn/dpkg/'s status file records whether the user wants a
  1040. package installed, removed or left alone, whether it is broken
  1041. (requiring reinstallation) or not and what its current state on the
  1042. system is. Each of these pieces of information is a single word.
  1043. <sect1 id="f-Config-Version"><tt/Config-Version/
  1044. <p>
  1045. If a package is not installed or not configured, this field in
  1046. <prgn/dpkg/'s status file records the last version of the package which
  1047. was successfully configured.
  1048. <sect1 id="f-Conffiles"><tt/Conffiles/
  1049. <p>
  1050. This field in <prgn/dpkg/'s status file contains information about the
  1051. automatically-managed configuration files held by a package. This
  1052. field should <em/not/ appear anywhere in a package!
  1053. <sect1>Obsolete fields
  1054. <p>
  1055. These are still recognised by <prgn/dpkg/ but should not appear anywhere
  1056. any more.
  1057. <taglist compact>
  1058. <tag><tt/Revision/
  1059. <tag><tt/Package-Revision/
  1060. <tag><tt/Package_Revision/
  1061. <item>
  1062. The Debian revision part of the package version was at one point in a
  1063. separate control file field. This field went through several names.
  1064. <tag><tt/Recommended/
  1065. <item>Old name for <tt/Recommends/
  1066. <tag><tt/Optional/
  1067. <item>Old name for <tt/Suggests/.
  1068. <tag><tt/Class/
  1069. <item>Old name for <tt/Priority/.
  1070. </taglist>
  1071. <chapt id="versions">Version numbering
  1072. <p>
  1073. Every package has a version number, in its <tt/Version/ control file
  1074. field.
  1075. <p>
  1076. <prgn/dpkg/ imposes an ordering on version numbers, so that it can tell
  1077. whether packages are being up- or downgraded and so that <prgn/dselect/
  1078. can tell whether a package it finds available is newer than the one
  1079. installed on the system. The version number format has the most
  1080. significant parts (as far as comparison is concerned) at the
  1081. beginning.
  1082. <p>
  1083. The version number format is:
  1084. &lsqb<var/epoch/<tt/:/&rsqb;<var/upstream-version/&lsqb;<tt/-/<var/debian-revision/&rsqb;.
  1085. <p>
  1086. The three components here are:
  1087. <taglist>
  1088. <tag><var/epoch/
  1089. <item>
  1090. This is a single unsigned integer, which should usually be small. It
  1091. may be omitted, in which case zero is assumed. If it is omitted then
  1092. the <var/upstream-version/ may not contain any colons.
  1093. <p>
  1094. It is provided to allow mistakes in the version numbers of older
  1095. versions of a package, and also a package's previous version numbering
  1096. schemes, to be left behind.
  1097. <p>
  1098. <prgn/dpkg/ will not usually display the epoch unless it is essential
  1099. (non-zero, or if the <var/upstream-version/ contains a colon);
  1100. <prgn/dselect/ does not display epochs at all in the main part of the
  1101. package selection display.
  1102. <tag><var/upstream-version/
  1103. <item>
  1104. This is the main part of the version. It is usually version number of
  1105. the original (`upstream') package of which the <tt/.deb/ file has been
  1106. made, if this is applicable. Usually this will be in the same format
  1107. as that specified by the upstream author(s); however, it may need to
  1108. be reformatted to fit into <prgn/dpkg/'s format and comparison scheme.
  1109. <p>
  1110. The comparison behaviour of <prgn/dpkg/ with respect to the
  1111. <var/upstream-version/ is described below. The <var/upstream-version/
  1112. portion of the version number is mandatory.
  1113. <p>
  1114. The <var/upstream-version/ may contain only alphanumerics and the
  1115. characters <tt/+/ <tt/./ <tt/-/ <tt/:/ (full stop, plus, hyphen,
  1116. colon) and should start with a digit. If there is no
  1117. <var/debian-revision/ then hyphens are not allowed; if there is no
  1118. <var/epoch/ then colons are not allowed.
  1119. <tag><var/debian-revision/
  1120. <item>
  1121. This part of the version represents the version of the modifications
  1122. that were made to the package to make it a Debian binary package. It
  1123. is in the same format as the <var/upstream-version/ and <prgn/dpkg/
  1124. compares it in the same way.
  1125. <p>
  1126. It is optional; if it isn't present then the <var/upstream-version/
  1127. may not contain a hyphen. This format represents the case where a
  1128. piece of software was written specifically to be turned into a Debian
  1129. binary package, and so there is only one `debianization' of it and
  1130. therefore no revision indication is required.
  1131. <p>
  1132. It is conventional to restart the <var/debian-revision/ at <tt/1/ each
  1133. time the <var/upstream-version/ is increased.
  1134. <p>
  1135. <prgn/dpkg/ will break the <var/upstream-version/ and
  1136. <var/debian-revision/ apart at the last hyphen in the string. The
  1137. absence of a <var/debian-revision/ compares earlier than the presence
  1138. of one (but note that the <var/debian-revision/ is the least
  1139. significant part of the version number).
  1140. <p>
  1141. The <var/debian-revision/ may contain only alphanumerics and the
  1142. characters <tt/+/ and <tt/./ (plus and full stop).
  1143. </taglist>
  1144. The <var/upstream-version/ and <var/debian-revision/ parts are
  1145. compared by <prgn/dpkg/ using the same algorithm:
  1146. <p>
  1147. The strings are compared from left to right.
  1148. <p>
  1149. First the initial part of each string consisting entirely of non-digit
  1150. characters is determined. These two parts (one of which may be empty)
  1151. are compared lexically. If a difference is found it is returned. The
  1152. lexical comparison is a comparison of ASCII values modified so that
  1153. all the letters sort earlier than all the non-letters.
  1154. <p>
  1155. Then the initial part of the remainder of each string which consists
  1156. entirely of digit characters is determined. The numerical values of
  1157. these two parts are compared, and any difference found is returned as
  1158. the result of the comparison. For these purposes an empty string
  1159. (which can only occur at the end of one or both version strings being
  1160. compared) counts as zero.
  1161. <p>
  1162. These two steps are repeated (chopping initial non-digit strings and
  1163. initial digit strings off from the start) until a difference is found
  1164. or both strings are exhausted.
  1165. <p>
  1166. Note that the purpose of epochs is to allow us to leave behind
  1167. mistakes in version numbering, and to cope with situations where the
  1168. version numbering changes. It is <em/not/ there to cope with version
  1169. numbers containing strings of letters which <prgn/dpkg/ cannot interpret
  1170. (such as <tt/ALPHA/ or <tt/pre-/), or with silly orderings (the author
  1171. of this manual has heard of a package whose versions went <tt/1.1/,
  1172. <tt/1.2/, <tt/1.3/, <tt/1/, <tt/2.1/, <tt/2.2/, <tt/2/ and so forth).
  1173. <p>
  1174. If an upstream package has problematic version numbers they should be
  1175. converted to a sane form for use in the <tt/Version/ field.
  1176. <chapt id="maintainerscripts">Package maintainer scripts
  1177. and installation procedure
  1178. <sect>Introduction to package maintainer scripts
  1179. <p>
  1180. It is possible supply scripts as part of a package which <prgn/dpkg/
  1181. will run for you when your package is installed, upgraded or removed.
  1182. <p>
  1183. These scripts should be the files <tt/preinst/, <tt/postinst/,
  1184. <tt/prerm/ and <tt/postrm/ in the control area of the package. They
  1185. must be proper exectuable files; if they are scripts (which is
  1186. recommended) they must start with the usual <tt/#!/ convention. They
  1187. should be readable and executable to anyone, and not world-writeable.
  1188. <p>
  1189. <prgn/dpkg/ looks at the exit status from these scripts. It is
  1190. important that they exit with a non-zero status if there is an error,
  1191. so that <prgn/dpkg/ can stop its processing. For shell scripts this
  1192. means that you <em/almost always/ need to use <tt/set -e/ (this is
  1193. usually true when writing shell scripts, in fact). It is also
  1194. important, of course, that they don't exit with a non-zero status if
  1195. everything went well.
  1196. <p>
  1197. It is necessary for the error recovery procedures that the scripts be
  1198. idempotent: ie, invoking the same script several times in the same
  1199. situation should do no harm. If the first call failed, or aborted
  1200. half way through for some reason, the second call should merely do the
  1201. things that were left undone the first time, if any, and exit with a
  1202. success status.
  1203. <p>
  1204. When a package is upgraded a combination of the scripts from the old
  1205. and new packages is called in amongst the other steps of the upgrade
  1206. procedure. If your scripts are going to be at all complicated you
  1207. need to be aware of this, and may need to check the arguments to your
  1208. scripts.
  1209. <p>
  1210. Broadly speaking the <prgn/preinst/ is called before (a particular
  1211. version of) a package is installed, and the <prgn/postinst/ afterwards;
  1212. the <prgn/prerm/ before (a version of) a package is removed and the
  1213. <prgn/postrm/ afterwards.
  1214. <sect id="mscriptsinstact">Summary of ways maintainer scripts are called
  1215. <p>
  1216. <list compact>
  1217. <item><var/new-preinst/ <tt/install/
  1218. <item><var/new-preinst/ <tt/install/ <var/old-version/
  1219. <item><var/new-preinst/ <tt/upgrade/ <var/old-version/
  1220. <item><var/old-preinst/ <tt/abort-upgrade/ <var/new-version/
  1221. </list>
  1222. <p>
  1223. <list compact>
  1224. <item><var/postinst/ <tt/configure/ <var/most-recently-configured-version/
  1225. <item><var/old-postinst/ <tt/abort-upgrade/ <var/new version/
  1226. <item><var/conflictor's-postinst/ <tt/abort-remove/
  1227. <tt/in-favour/ <var/package/ <var/new-version/
  1228. <item><var/deconfigured's-postinst/ <tt/abort-deconfigure/
  1229. <tt/in-favour/ <var/failed-install-package/ <var/version/
  1230. <tt/removing/ <var/conflicting-package/ <var/version/
  1231. </list>
  1232. <p>
  1233. <list compact>
  1234. <item><var/prerm/ <tt/remove/
  1235. <item><var/old-prerm/ <tt/upgrade/ <var/new-version/
  1236. <item><var/new-prerm/ <tt/failed-upgrade/ <var/old-version/
  1237. <item><var/conflictor's-prerm/ <tt/remove/ <tt/in-favour/
  1238. <var/package/ <var/new-version/
  1239. <item><var/deconfigured's-prerm/ <tt/deconfigure/
  1240. <tt/in-favour/ <var/package-being-installed/ <var/version/
  1241. <tt/removing/ <var/conflicting-package/ <var/version/
  1242. </list>
  1243. <p>
  1244. <list compact>
  1245. <item><var/postrm/ <tt/remove/
  1246. <item><var/postrm/ <tt/purge/
  1247. <item><var/old-postrm/ <tt/upgrade/ <var/new-version/
  1248. <item><var/new-postrm/ <tt/failed-upgrade/ <var/old-version/
  1249. <item><var/new-postrm/ <tt/abort-install/
  1250. <item><var/new-postrm/ <tt/abort-install/ <var/old-version/
  1251. <item><var/new-postrm/ <tt/abort-upgrade/ <var/old-version/
  1252. <item><var/disappearer's-postrm/ <tt/disappear/ <var/overwriter/ <var/new-version/
  1253. </list>
  1254. <sect>Details of unpack phase of installation or upgrade
  1255. <p>
  1256. The procedure on installation/upgrade/overwrite/disappear (ie, when
  1257. running <tt/dpkg --unpack/, or the unpack stage of <tt/dpkg
  1258. --install/) is as follows. In each case if an error occurs the
  1259. actions in are general run backwards - this means that the maintainer
  1260. scripts are run with different arguments in reverse order. These are
  1261. the `error unwind' calls listed below.
  1262. <enumlist>
  1263. <item>
  1264. <enumlist>
  1265. <item>
  1266. If a version the package is already
  1267. installed, call
  1268. <example>
  1269. <var/old-prerm/ upgrade <var/new-version/
  1270. </example>
  1271. <item>
  1272. If this gives an error (ie, a non-zero exit status), dpkg will
  1273. attempt instead:
  1274. <example>
  1275. <var/new-prerm/ failed-upgrade <var/old-version/
  1276. </example>
  1277. Error unwind, for both the above cases:
  1278. <example>
  1279. <var/old-postinst/ abort-upgrade <var/new-version/
  1280. </example>
  1281. </enumlist>
  1282. <item>
  1283. If a `conflicting' package is being removed at the same time:
  1284. <enumlist>
  1285. <item>
  1286. If any packages depended on that conflicting package and
  1287. <tt/--auto-deconfigure/ is specified, call, for each such package:
  1288. <example>
  1289. <var/deconfigured's-prerm/ deconfigure \
  1290. in-favour <var/package-being-installed/ <var/version/ \
  1291. removing <var/conflicting-package/ <var/version/
  1292. </example>
  1293. Error unwind:
  1294. <example>
  1295. <var/deconfigured's-postinst/ abort-deconfigure \
  1296. in-favour <var/package-being-installed-but-failed/ <var/version/ \
  1297. removing <var/conflicting-package/ <var/version/
  1298. </example>
  1299. The deconfigured packages are marked as requiring configuration, so
  1300. that if <tt/--install/ is used they will be configured again if
  1301. possible.
  1302. <item>
  1303. To prepare for removal of the conflicting package, call:
  1304. <example>
  1305. <var/conflictor's-prerm/ remove in-favour <var/package/ <var/new-version/
  1306. </example>
  1307. Error unwind:
  1308. <example>
  1309. <var/conflictor's-postinst/ abort-remove \
  1310. in-favour <var/package/ <var/new-version/
  1311. </example>
  1312. </enumlist>
  1313. <item>
  1314. <enumlist>
  1315. <item>
  1316. If the package is being upgraded, call:
  1317. <example>
  1318. <var/new-preinst/ upgrade <var/old-version/
  1319. </example>
  1320. <item>
  1321. Otherwise, if the package had some configuration files from a previous
  1322. version installed (ie, it is in the `configuration files only' state):
  1323. <example>
  1324. <var/new-preinst/ install <var/old-version/
  1325. </example>
  1326. <item>
  1327. Otherwise (ie, the package was completely purged):
  1328. <example>
  1329. <var/new-preinst/ install
  1330. </example>
  1331. Error unwind versions, respectively:
  1332. <example>
  1333. <var/new-postrm/ abort-upgrade <var/old-version/
  1334. <var/new-postrm/ abort-install <var/old-version/
  1335. <var/new-postrm/ abort-install
  1336. </example>
  1337. </enumlist>
  1338. <item>
  1339. The new package's files are unpacked, overwriting any that may be on
  1340. the system already, for example any from the old version of the same
  1341. package or from another package (backups of the old files are left
  1342. around, and if anything goes wrong dpkg will attempt to put them back
  1343. as part of the error unwind).
  1344. <p>
  1345. It is an error for a package to contains files which are on the system
  1346. in another package, unless <tt/Replaces/ is used (see
  1347. <ref id="replaces">). Currently the <tt/--force-overwrite/ flag is
  1348. enabled, downgrading it to a warning, but this may not always be the
  1349. case.
  1350. <p>
  1351. Packages which overwrite each other's files produce behaviour which
  1352. though deterministic is hard for the system administrator to
  1353. understand. It can easily lead to `missing' programs if, for example,
  1354. a package is installed which overwrites a file from another package,
  1355. and is then removed again.<footnote>Part of the problem is due to what
  1356. is arguably a bug in <prgn/dpkg/.</footnote>
  1357. <item>
  1358. <enumlist>
  1359. <item>
  1360. If the package is being upgraded, call
  1361. <example>
  1362. <var/old-postrm/ upgrade <var/new-version/
  1363. </example>
  1364. <item>
  1365. If this fails, <prgn/dpkg/ will attempt:
  1366. <example>
  1367. <var/new-postrm/ failed-upgrade <var/old-version/
  1368. </example>
  1369. Error unwind, for both cases:
  1370. <example>
  1371. <var/old-preinst/ abort-upgrade <var/new-version/
  1372. </example>
  1373. </enumlist>
  1374. This is the point of no return - if <prgn/dpkg/ gets this far, it won't
  1375. back off past this point if an error occurs. This will leave the
  1376. package in a fairly bad state, which will require a successful
  1377. reinstallation to clear up, but it's when <prgn/dpkg/ starts doing
  1378. things that are irreversible.
  1379. <item>
  1380. Any files which were in the old version of the package but not in the
  1381. new are removed.
  1382. <item>
  1383. The new file list replaces the old.
  1384. <item>
  1385. The new maintainer scripts replace the old.
  1386. <item>
  1387. Any packages all of whose files have been overwritten during the
  1388. installation, and which aren't required for dependencies, are considered
  1389. to have been removed. For each such package,
  1390. <enumlist>
  1391. <item>
  1392. <prgn/dpkg/ calls:
  1393. <example>
  1394. <var/disappearer's-postrm/ disappear \
  1395. <var/overwriter/ <var/overwriter-version/
  1396. </example>
  1397. <item>
  1398. The package's maintainer scripts are removed.
  1399. <item>
  1400. It is noted in the status database as being in a sane state, namely
  1401. not installed (any conffiles it may have are ignored, rather than
  1402. being removed by <prgn/dpkg/). Note that disappearing packages do not
  1403. have their prerm called, because <prgn/dpkg/ doesn't know in advance
  1404. that the package is going to vanish.
  1405. </enumlist>
  1406. <item>
  1407. Any files in the package we're unpacking that are also listed in the
  1408. file lists of other packages are removed from those lists. (This will
  1409. lobotomise the file list of the `conflicting' package if there is one.)
  1410. <item>
  1411. The backup files made during installation, above, are deleted.
  1412. <item>
  1413. The new package's status is now sane, and recorded as `unpacked'. Here
  1414. is another point of no return - if the conflicting package's removal
  1415. fails we do not unwind the rest of the installation; the conflicting
  1416. package is left in a half-removed limbo.
  1417. <item>
  1418. If there was a conflicting package we go and do the removal actions
  1419. (described below), starting with the removal of the conflicting
  1420. package's files (any that are also in the package being installed
  1421. have already been removed from the conflicting package's file list,
  1422. and so do not get removed now).
  1423. </enumlist>
  1424. <sect>Details of configuration
  1425. <p>
  1426. When we configure a package (this happens with <tt/dpkg --install/, or
  1427. with <tt/--configure/), we first update the conffiles and then call:
  1428. <example>
  1429. <var/postinst/ configure <var/most-recently-configured-version/
  1430. </example>
  1431. <p>
  1432. No attempt is made to unwind after errors during configuration.
  1433. <p>
  1434. If there is no most recently configured version <prgn/dpkg/ will pass a
  1435. null argument; older versions of dpkg may pass
  1436. <tt>&lt;unknown&gt;</tt> (including the angle brackets) in this case.
  1437. Even older ones do not pass a second argument at all, under any
  1438. circumstances.
  1439. <sect>Details of removal and/or configuration purging
  1440. <p>
  1441. <enumlist>
  1442. <item>
  1443. <example>
  1444. <var/prerm/ remove
  1445. </example>
  1446. <item>
  1447. The package's files are removed (except conffiles).
  1448. <item>
  1449. <example>
  1450. <var/postrm/ remove
  1451. </example>
  1452. <item>
  1453. All the maintainer scripts except the postrm are removed.
  1454. <p>
  1455. If we aren't purging the package we stop here. Note that packages
  1456. which have no postrm and no conffiles are automatically purged when
  1457. removed, as there is no difference except for the <prgn/dpkg/ status.
  1458. <item>
  1459. The conffiles and any backup files (<tt/~/-files, <tt/#*#/ files,
  1460. <tt/%/-files, <tt/.dpkg-{old,new,tmp}/, etc.) are removed.
  1461. <item>
  1462. <example>
  1463. <var/postrm/ purge
  1464. </example>
  1465. <item>
  1466. The package's file list is removed.
  1467. </enumlist>
  1468. No attempt is made to unwind after errors during removal.
  1469. <chapt id="descriptions">Descriptions of packages - the
  1470. <tt/Description/ field
  1471. <p>
  1472. The <tt/Description/ control file field is used by <prgn/dselect/ when
  1473. the user is selecting which packages to install and by <prgn/dpkg/
  1474. when it displays information about the status of packages and so
  1475. forth. It is included on the FTP site in the <prgn/Packages/ files,
  1476. and may also be used by the Debian WWW pages.
  1477. <p>
  1478. The description is intended to describe the program to a user who has
  1479. never met it before so that they know whether they want to install it.
  1480. It should also give information about the significant dependencies and
  1481. conflicts between this package and others, so that the user knows why
  1482. these dependencies and conflicts have been declared.
  1483. <p>
  1484. The field's format is as follows:
  1485. <example>
  1486. Description: <var/single line synopsis/
  1487. <var/extended description over several lines/
  1488. </example>
  1489. <p>
  1490. The synopsis is often printed in lists of packages and so forth, and
  1491. should be as informative as possible. Every package should also have
  1492. an extended description.
  1493. <p>
  1494. <sect>Types of formatting line in the extended description
  1495. <p>
  1496. <list>
  1497. <item>
  1498. Those starting with a single space are part of a paragraph.
  1499. Successive lines of this form will be word-wrapped when displayed.
  1500. The leading space will usually be stripped off.
  1501. <item>
  1502. Those starting with two or more spaces. These will be displayed
  1503. verbatim. If the display cannot be panned horizontally the
  1504. displaying program will linewrap them `hard' (ie, without taking
  1505. account of word breaks). If it can they will be allowed to trail
  1506. off to the right. None, one or two initial spaces may be deleted,
  1507. but the number of spaces deleted from each line will be the same
  1508. (so that you can have indenting work correctly, for example).
  1509. <item>
  1510. Those containing a single space followed by a single full stop
  1511. character. These are rendered as blank lines. This is the <em/only/
  1512. way to get a blank line - see below.
  1513. <item>
  1514. Those containing a space, a full stop and some more characters. These
  1515. are for future expansion. Do not use them.
  1516. </list>
  1517. <sect>Notes about writing descriptions
  1518. <p>
  1519. <em/Always/ start extended description lines with at least one
  1520. whitespace character. Fields in the control file and in the Packages
  1521. file are separated by field names starting in the first column, just
  1522. as message header fields are in RFC822. Forgetting the whitespace
  1523. will cause <prgn/dpkg-deb/<footnote>Version 0.93.23 or
  1524. later.</footnote> to produce a syntax error when trying to build the
  1525. package. If you force it to build anyway <prgn/dpkg/ will refuse to
  1526. install the resulting mess.
  1527. <p>
  1528. <em/Do not/ include any completely <em/empty/ lines. These separate
  1529. different records in the Packages file and different packages in the
  1530. <tt>debian/control</> file, and are forbidden in package control
  1531. files. See the previous paragraph for what happens if you get this
  1532. wrong.
  1533. <p>
  1534. The single line synopsis should be kept brief - certainly under 80
  1535. characters. <prgn/dselect/ displays between 25 and 49 characters
  1536. without panning if you're using an 80-column terminal, depending on
  1537. what display options are in effect.
  1538. <p>
  1539. Do not include the package name in the synopsis line. The display
  1540. software knows how to display this already, and you do not need to
  1541. state it. Remember that in many situations the user may only see
  1542. the synopsis line - make it as informative as you can.
  1543. <p>
  1544. The extended description should describe what the package does and
  1545. how it relates to the rest of the system (in terms of, for
  1546. example, which subsystem it is which part of).
  1547. <p>
  1548. The blurb that comes with a program in its announcements and/or
  1549. <prgn/README/ files is rarely suitable for use in a description. It
  1550. is usually aimed at people who are already in the community where the
  1551. package is used. The description field needs to make sense to anyone,
  1552. even people who have no idea about any of the
  1553. things the package deals with.
  1554. <p>
  1555. Put important information first, both in the synopis and extended
  1556. description. Sometimes only the first part of the synopsis or of
  1557. the description will be displayed. You can assume that there will
  1558. usually be a way to see the whole extended description.
  1559. <p>
  1560. You may include information about dependencies and so forth in the
  1561. extended description, if you wish.
  1562. <p>
  1563. Do not use tab characters. Their effect is not predictable.
  1564. <p>
  1565. Do not try to linewrap the summary (the part on the same line as the
  1566. field name <tt/Description/) into the extended description. This will
  1567. not work correctly when the full description is displayed, and makes
  1568. no sense where only the summary is available.
  1569. <sect>Example description in control file for Smail
  1570. <p>
  1571. <example>
  1572. Package: smail
  1573. Version: 3.1.29.1-13
  1574. Maintainer: Ian Jackson &lt;iwj10@cus.cam.ac.uk&gt;
  1575. Recommends: pine | mailx | elm | emacs | mail-user-agent
  1576. Suggests: metamail
  1577. Depends: cron, libc5
  1578. Conflicts: sendmail
  1579. Provides: mail-transport-agent
  1580. Description: Electronic mail transport system.
  1581. Smail is the recommended mail transport agent (MTA) for Debian.
  1582. .
  1583. An MTA is the innards of the mail system - it takes messages from
  1584. user-friendly mailer programs and arranges for them to be delivered
  1585. locally or passed on to other systems as required.
  1586. .
  1587. In order to make use of it you must have one or more user level
  1588. mailreader programs such as elm, pine, mailx or Emacs (which has Rmail
  1589. and VM as mailreaders) installed. If you wish to send messages other
  1590. than just to other users of your system you must also have appropriate
  1591. and VM as mailreaders) installed. If you wish to send messages other
  1592. than just to other users of your system you must also have appropriate
  1593. networking support, in the form of IP or UUCP.
  1594. </example>
  1595. <chapt id="relationships">Declaring relationships between packages
  1596. <p>
  1597. Packages can declare in their control file that they have certain
  1598. relationships to other packages - for example, that they may not be
  1599. installed at the same time as certain other packages, and/or that they
  1600. depend on the presence of others, or that they should overwrite files
  1601. in certain other packages if present.
  1602. <p>
  1603. This is done using the <tt/Depends/, <tt/Recommends/, <tt/Suggests/,
  1604. <tt/Conflicts/, <tt/Provides/ and <tt/Replaces/ control file fields.
  1605. <p>
  1606. <sect>Syntax of relationship fields
  1607. <p>
  1608. These fields all have a uniform syntax. They are a list of package
  1609. names separated by commas.
  1610. <p>
  1611. In <tt/Depends/, <tt/Recommends/, <tt/Suggests/ and <tt/Pre-Depends/
  1612. (the fields which declare dependencies of the package in which they
  1613. occur on other packages) these package names may also be lists of
  1614. alternative package names, separated by vertical bar symbols <tt/|/
  1615. (pipe symbols).
  1616. <p>
  1617. All the fields except <tt/Provides/ may restrict their applicability
  1618. to particular versions of each named package. This is done in
  1619. parentheses after each individual package name; the parentheses should
  1620. contain a relation from the list below followed by a version number,
  1621. in the format described in <ref id="versions">.
  1622. <p>
  1623. The relations allowed are
  1624. <tt/&lt;&lt;/,
  1625. <tt/&lt;=/,
  1626. <tt/=/,
  1627. <tt/&gt;=/ and
  1628. <tt/&gt;&gt;/
  1629. for strictly earlier, earlier or equal, exactly equal, later or equal
  1630. and strictly later, respectively. The forms <tt/&lt;/ and <tt/&gt;/
  1631. were used to mean earlier/later or equal, rather than strictly
  1632. earlier/later, so they should not appear in new packages (though
  1633. <prgn/dpkg/ still supports them).
  1634. <p>
  1635. Whitespace may appear at any point in the version specification, and
  1636. must appear where it's necessary to disambiguate; it is not otherwise
  1637. significant. For consistency and in case of future changes to
  1638. <prgn/dpkg/ it is recommended that a single space be used after a
  1639. version relationship and before a version number; it is usual also to
  1640. put a single space after each comma, on either side of each vertical
  1641. bar, and before each open parenthesis.
  1642. <p>
  1643. For example:
  1644. <example>
  1645. Package: metamail
  1646. Version: 2.7-3
  1647. Depends: libc5 (>= 5.2.18-4), mime-support, csh | tcsh
  1648. </example>
  1649. <sect>Dependencies - <tt/Depends/, <tt/Recommends/, <tt/Suggests/, <tt/Pre-Depends/
  1650. <p>
  1651. These four fields are used to declare a dependency by one package on
  1652. another. They appear in the depending package's control file.
  1653. <p>
  1654. All but <tt/Pre-Depends/ (discussed below) take effect <em/only/ when
  1655. a package is to be configured. They do not prevent a package being on
  1656. the system in an unconfigured state while its dependencies are
  1657. unsatisfied, and it is possible to replace a package whose
  1658. dependencies are satisfied and which is properly installed with a
  1659. different version whose dependencies are not and cannot be satisfied;
  1660. when this is done the depending package will be left unconfigured
  1661. (since attempts to configure it will give errors) and will not
  1662. function properly.
  1663. <p>
  1664. For this reason packages in an installation run are usually all
  1665. unpacked first and all configured later; this gives later versions of
  1666. packages with dependencies on later versions of other packages the
  1667. opportunity to have their dependencies satisfied.
  1668. <p>
  1669. Thus <tt/Depends/ allows package maintainers to impose an order in
  1670. which packages should be configured.
  1671. <taglist>
  1672. <tag><tt/Depends/
  1673. <item>
  1674. This declares an absolute dependency.
  1675. <p>
  1676. <prgn/dpkg/ will not configure
  1677. packages whose dependencies aren't satisfied. If it is asked to make
  1678. an installation which would cause an installed package's dependencies
  1679. to become unsatisfied it will complain<footnote>Current versions
  1680. (1.2.4) of <prgn/dpkg/ have a bug in this area which will cause some of
  1681. these problems to be ignored.</footnote>, unless
  1682. <tt/--auto-deconfigure/ is specified, in which case those packages
  1683. will be deconfigured before the installation proceeds.
  1684. <p>
  1685. <prgn/dselect/ makes it hard for the user to select packages for
  1686. installation, removal or upgrade in a way that would mean that
  1687. packages' <prgn/Depends/ fields would be unsatisfied. The user can
  1688. override this if they wish, for example if they know that <prgn/dselect/
  1689. has an out-of-date view of the real package relationships.
  1690. <p>
  1691. The <tt/Depends/ field should be used if the depended-on package is
  1692. required for the depending package to provide a significant amount of
  1693. functionality.
  1694. <tag><tt/Recommends/
  1695. <item>
  1696. This declares a strong, but not absolute, dependency.
  1697. <p>
  1698. <tt/Recommends/ is ignored by <prgn/dpkg/, so that users using the
  1699. command-line (who are presumed to know what they're doing) will not be
  1700. impeded.
  1701. <p>
  1702. It is treated by <prgn/dselect/ exactly as <tt/Depends/ is; this makes
  1703. it hard for the user to select things so as to leave <tt/Recommends/
  1704. fields unsatisfied, but they are able to do so by being persistent.
  1705. <p>
  1706. The <tt/Recommends/ field should list packages that would be found
  1707. together with this one in all but unusual installations.
  1708. <tag><tt/Suggests/
  1709. <item>
  1710. This is used to declare that one package may be more useful with one
  1711. or more others. Using this field tells the packaging system and the
  1712. user that the listed packages are be related to this one and can
  1713. perhaps enhance its usefulness, but that installing this one without
  1714. them is perfectly reasonable.
  1715. <p>
  1716. <prgn/dselect/ will offer suggsted packages to the system administrator
  1717. when they select the suggesting package, but the default is not to
  1718. install the suggested package.
  1719. <tag><tt/Pre-Depends/
  1720. <item>
  1721. This field is like <tt/Depends/, except that it also forces <prgn/dpkg/
  1722. to complete installation of the packages named before even starting
  1723. the installation of the package which declares the predependency.
  1724. <p>
  1725. <prgn/dselect/ checks for predependencies when it is doing an
  1726. installation run, and will attempt to find the packages which are
  1727. required to be installed first and do so in the right order.
  1728. <p>
  1729. However, this process is slow (because it requires repeated
  1730. invocations of <prgn/dpkg/) and troublesome (because it requires
  1731. guessing where to find the appropriate files).
  1732. <p>
  1733. For these reasons, and because this field imposes restrictions on the
  1734. order in which packages may be unpacked (which can be difficult for
  1735. installations from multipart media, for example), <tt/Pre-Depends/
  1736. should be used sparingly, preferably only by packages whose premature
  1737. upgrade or installation would hamper the ability of the system to
  1738. continue with any upgrade that might be in progress.
  1739. <p>
  1740. When the package declaring it is being configured, a
  1741. <tt/Pre-Dependency/ will be considered satisfied only if the depending
  1742. package has been correctly configured, just as if an ordinary
  1743. <tt/Depends/ had been used.
  1744. <p>
  1745. However, when a package declaring a predependency is being unpacked
  1746. the predependency can be satisfied even if the depended-on package(s)
  1747. are only unpacked or half-configured, provided that they have been
  1748. configured correctly at some point in the past (and not removed or
  1749. partially removed since). In this case both the previously-configured
  1750. and currently unpacked or half-configured versions must satisfy any
  1751. version clause in the <tt/Pre-Depends/ field.
  1752. </taglist>
  1753. <sect1>Deconfiguration due to removal during bulk installations
  1754. <p>
  1755. If <prgn/dpkg/ would like to remove a package due to a conflict, as
  1756. described above, but this would violate a dependency of some other
  1757. package on the system, <prgn/dpkg/ will usually not remove the
  1758. conflicting package and halt with an error.
  1759. <p>
  1760. However, if the <tt/--auto-deconfigure/ (<tt/-B/) option is used
  1761. <prgn/dpkg/ will automatically `deconfigure' the package with the
  1762. problematic dependency, so that the conflicting package can be removed
  1763. and the package we're trying to install can be installed. If
  1764. <prgn/dpkg/ is being asked to install packages (rather than just
  1765. unpacking them) it will try to reconfigure the package when it has
  1766. unpacked all its arguments, in the hope that one of the other packages
  1767. it is installing will satisfy the problematic dependency.
  1768. <p>
  1769. <prgn/dselect/ supplies this argument to <prgn/dpkg/ when it invokes it,
  1770. so that bulk installations proceed smoothly.
  1771. <sect id="conflicts">Alternative packages - <tt/Conflicts/ and <tt/Replaces/
  1772. <p>
  1773. When one package declares a conflict with another <prgn/dpkg/ will
  1774. refuse to allow them to be installed on the system at the same time.
  1775. <p>
  1776. If one package is to be installed, the other must be removed first -
  1777. if the package being installed is marked as replacing (<ref
  1778. id="replaces">) the one on the system, or the one on the system is
  1779. marked as deselected, or both packages are marked <tt/Essential/, then
  1780. <prgn/dpkg/ will automatically remove the package which is causing the
  1781. conflict, otherwise it will halt the installation of the new package
  1782. with an error.
  1783. <p>
  1784. <prgn/dselect/ makes it hard to select conflicting packages, though the
  1785. user can override this if they wish. If they do not override it then
  1786. <prgn/dselect/ will select one of the packages for removal, and the user
  1787. must make sure it is the right one. In the future <prgn/dselect/ will
  1788. look for the presence of a <tt/Replaces/ field to help decide which
  1789. package should be installed and which removed.
  1790. <p>
  1791. A package will not cause a conflict merely because its configuration
  1792. files are still installed; it must be at least half-installed.
  1793. <p>
  1794. A special exception is made for packages which declare a conflict with
  1795. their own package name, or with a virtual package which they provide
  1796. (see below): this does not prevent their installation, and allows a
  1797. package to conflict with others providing a replacement for it. You
  1798. use this feature when you want the package in question to be the only
  1799. package providing something.
  1800. <p>
  1801. A <tt/Conflicts/ entry should almost never have an `earlier than'
  1802. version clause. This would prevent <prgn/dpkg/ from upgrading or
  1803. installing the package which declared such a conflict until the
  1804. upgrade or removal of the conflicted-with package had been completed.
  1805. This aspect of installation ordering is not handled by <prgn/dselect/,
  1806. so that the use <tt/Conflicts/ in this way is likely to cause problems
  1807. for `bulk run' upgrades and installations.
  1808. <p>
  1809. <sect id="virtual">Virtual packages - <tt/Provides/
  1810. <p>
  1811. As well as the names of actual (`concrete') packages, the package
  1812. relationship fields <tt/Depends/, <tt/Recommends/, <tt/Suggests/ and
  1813. <tt/Conflicts/ may mention virtual packages.
  1814. <p>
  1815. A virtual package is one which appears in the <tt/Provides/ control
  1816. file field of another package. The effect is as if the package(s)
  1817. which provide a particular virtual package name had been listed by
  1818. name everywhere were the virtual package name appears.
  1819. <p>
  1820. If there are both a real and a virtual package of the same name then
  1821. the dependency may be satisfied (or the conflict caused) by either the
  1822. real package or any of the virtual packages which provide it. This is
  1823. so that, for example, supposing we have
  1824. <example>
  1825. Package: vm
  1826. Depends: emacs
  1827. </example>
  1828. and someone else releases an xemacs package they can say
  1829. <example>
  1830. Package: xemacs
  1831. Provides: emacs
  1832. </example>
  1833. and all will work in the interim (until a purely virtual package name
  1834. is decided on and the <tt/emacs/ and <tt/vm/ packages are changed to
  1835. use it).
  1836. <p>
  1837. If a dependency or a conflict has a version number attached then only
  1838. real packages will be considered to see whether the relationship is
  1839. satisfied (or the prohibition violated, for a conflict) - it is
  1840. assumed that a real package which provides virtual package is not of
  1841. the `right' version. So, a <tt/Provides/ field may not contain
  1842. version numbers, and the version number of the concrete package which
  1843. provides a particular virtual package will not be looked at when
  1844. considering a dependency on or conflict with the virtual package name.
  1845. <p>
  1846. If you want to specify which of a set of real packages should be the
  1847. default to satisfy a particular dependency on a virtual package, you
  1848. should list the real package as alternative before the virtual.
  1849. <p>
  1850. <sect id="replaces"><tt/Replaces/ - overwriting files and replacing packages
  1851. <p>
  1852. The <tt/Replaces/ control file field has two purposes, which come into
  1853. play in different situations.
  1854. <p>
  1855. Virtual packages (<ref id="virtual">) are not considered when looking
  1856. at a <tt/Replaces/ field - the packages declared as being replaced
  1857. must be mentioned by their real names.
  1858. <sect1>Overwriting files in other packages
  1859. <p>
  1860. Firstly, as mentioned before, it is usually an error for a package to
  1861. contains files which are on the system in another package, though
  1862. currently the <tt/--force-overwrite/ flag is enabled by default,
  1863. downgrading the error to a warning,
  1864. <p>
  1865. If the overwriting package declares that it replaces the one
  1866. containing the file being overwritten then <prgn/dpkg/ will proceed, and
  1867. replace the file from the old package with that from the new. The
  1868. file will no longer be listed as `owned' by the old package.
  1869. <p>
  1870. If a package is completely replaced in this way, so that <prgn/dpkg/
  1871. does not know of any files it still contains, it is considered to have
  1872. disappeared. It will be marked as not wanted on the system (selected
  1873. for removal) and not installed. Any conffiles details noted in the
  1874. package will be ignored, as they will have been taken over by the
  1875. replacing package(s). The package's <prgn/postrm/ script will be run to
  1876. allow the package to do any final cleanup required.
  1877. See <ref id="mscriptsinstact">.
  1878. <p>
  1879. In the future <prgn/dpkg/ will discard files which overwrite those from
  1880. another package which declares that it replaces the one being
  1881. installed (so that you can install an older version of a package
  1882. without problems).
  1883. <p>
  1884. This usage of <tt/Replaces/ only takes effect when both packages are
  1885. at least partially on the system at once, so that it can only happen
  1886. if they do not conflict or if the conflict has been overridden.
  1887. <sect1>Replacing whole packages, forcing their removal
  1888. <p>
  1889. Secondly, <tt/Replaces/ allows <prgn/dpkg/ and <prgn/dselect/ to resolve
  1890. which package should be removed when a conflict - see
  1891. <ref id="conflicts">. This usage only takes effect when the two
  1892. packages <em/do/ conflict, so that the two effects do not interfere
  1893. with each other.
  1894. <p>
  1895. <sect>Defaults for satisfying dependencies - ordering
  1896. <p>
  1897. Ordering is significant in dependency fields.
  1898. <p>
  1899. Usually dselect will suggest to the user that they select the package
  1900. with the most `fundamental' class (eg, it will prefer Base packages to
  1901. Optional ones), or the one that they `most wanted' to select in some
  1902. sense.
  1903. <p>
  1904. In the absence of other information <prgn/dselect/ will offer a
  1905. default selection of the first named package in a list of
  1906. alternatives.
  1907. <p>
  1908. However, there is no way to specify the `order' of several packages
  1909. which all provide the same thing, when that thing is listed as a
  1910. dependency.
  1911. <p>
  1912. Therefore a dependency on a virtual package should contain a concrete
  1913. package name as the first alternative, so that this is the default.
  1914. <p>
  1915. For example, consider the set of packages:
  1916. <example>
  1917. Package: glibcdoc
  1918. Recommends: info-browser
  1919. Package: info
  1920. Provides: info-browser
  1921. Package: emacs
  1922. Provides: info-browser
  1923. </example>
  1924. <p>
  1925. If <prgn/emacs/ and <prgn/info/ both have the same priority then
  1926. <prgn/dselect/'s choice is essentially random. Better would be
  1927. <example>
  1928. Package: glibcdoc
  1929. Recommends: info | info-browser
  1930. </example>
  1931. so that <prgn/dselect/ defaults to selecting the lightweight standalone
  1932. info browser.
  1933. <chapt id="conffiles">Configuration file handling
  1934. <p>
  1935. <prgn/dpkg/ can do a certain amount of automatic handling of package
  1936. configuration files.
  1937. <p>
  1938. Whether this mechanism is appropriate depends on a number of factors,
  1939. but basically there are two approaches to any particular configuration
  1940. file.
  1941. <p>
  1942. The easy method is to ship a best-effort configuration in the package,
  1943. and use <prgn/dpkg/'s conffile mechanism to handle updates. If the user
  1944. is unlikely to want to edit the file, but you need them to be able to
  1945. without losing their changes, and a new package with a changed version
  1946. of the file is only released infrequently, this is a good approach.
  1947. <p>
  1948. The hard method is to build the configuration file from scratch in the
  1949. <prgn/postinst/ script, and to take the responsibility for fixing any
  1950. mistakes made in earlier versions of the package automatically. This
  1951. will be appropriate if the file is likely to need to be different on
  1952. each system.
  1953. <sect>Automatic handling of configuration files by <prgn/dpkg/
  1954. <p>
  1955. A package may contain a control area file called <tt/conffiles/. This
  1956. file should be a list of filenames of configuration files needing
  1957. automatic handling, separated by newlines. The filenames should be
  1958. absolute pathnames, and the files referred to should actually exist in
  1959. the package.
  1960. <p>
  1961. When a package is upgraded <prgn/dpkg/ will process the configuration
  1962. files during the configuration stage, shortly before it runs the
  1963. package's <prgn/postinst/ script,
  1964. <p>
  1965. For each file it checks to see whether the version of the file
  1966. included in the package is the same as the one that was included in
  1967. the last version of the package (the one that is being upgraded
  1968. from); it also compares the version currently installed on the system
  1969. with the one shipped with the last version.
  1970. <p>
  1971. If neither the user nor the package maintainer has changed the file,
  1972. it is left alone. If one or the other has changed their version, then
  1973. the changed version is preferred - ie, if the user edits their file,
  1974. but the package maintainer doesn't ship a different version, the
  1975. user's changes will stay, silently, but if the maintainer ships a new
  1976. version and the user hasn't edited it the new version will be
  1977. installed (with an informative message). If both have changed their
  1978. version the user is prompted about the problem and must resolve the
  1979. differences themselves.
  1980. <p>
  1981. The comparisons are done by calculating the MD5 message digests of the
  1982. files, and storing the MD5 of the file as it was included in the most
  1983. recent version of the package.
  1984. <p>
  1985. When a package is installed for the first time <prgn/dpkg/ will install
  1986. the file that comes with it, unless that would mean overwriting a file
  1987. already on the filesystem.
  1988. <p>
  1989. However, note that <prgn/dpkg/ will <em/not/ replace a conffile that
  1990. was removed by the user (or by a script). This is necessary because
  1991. with some programs a missing file produces an effect hard or
  1992. impossible to achieve in another way, so that a missing file needs to
  1993. be kept that way if the user did it.
  1994. <p>
  1995. Note that a package should <em/not/ modify a <prgn/dpkg/-handled
  1996. conffile in its maintainer scripts. Doing this will lead to
  1997. <prgn/dpkg/ giving the user confusing and possibly dangerous options
  1998. for conffile update when the package is upgraded.
  1999. <sect>Fully-featured maintainer script configuration handling
  2000. <p>
  2001. For files which contain site-specific information such as the hostname
  2002. and networking details and so forth, it is better to create the file
  2003. in the package's <prgn/postinst/ script.
  2004. <p>
  2005. This will typically involve examining the state of the rest of the
  2006. system to determine values and other information, and may involve
  2007. prompting the user for some information which can't be obtained some
  2008. other way.
  2009. <p>
  2010. When using this method there are a couple of important issues which
  2011. should be considered:
  2012. <p>
  2013. If you discover a bug in the program which generates the configuration
  2014. file, or if the format of the file changes from one version to the
  2015. next, you will have to arrange for the postinst script to do something
  2016. sensible - usually this will mean editing the installed configuration
  2017. file to remove the problem or change the syntax. You will have to do
  2018. this very carefully, since the user may have changed the file, perhaps
  2019. to fix the very problem that your script is trying to deal with - you
  2020. will have to detect these situations and deal with them correctly.
  2021. <p>
  2022. If you do go down this route it's probably a good idea to make the
  2023. program that generates the configuration file(s) a separate program in
  2024. <tt>/usr/sbin</>, by convention called <tt/<var/package/config/ and
  2025. then run that if appropriate from the post-installation script. The
  2026. <tt/<var/package/config/ program should not unquestioningly overwrite
  2027. an existing configuration - if its mode of operation is geared towards
  2028. setting up a package for the first time (rather than any arbitrary
  2029. reconfiguration later) you should have it check whether the
  2030. configuration already exists, and require a <tt/--force/ flag to
  2031. overwrite it.
  2032. <chapt id="alternatives">Alternative versions of an interface -
  2033. <prgn/update-alternatives/
  2034. <p>
  2035. When several packages all provide different versions of the same
  2036. program or file it is useful to have the system select a default, but
  2037. to allow the system administrator to change it and have their
  2038. decisions respected.
  2039. <p>
  2040. For example, there are several versions of the <prgn/vi/ editor, and
  2041. there is no reason to prevent all of them from being installed at
  2042. once, each under their own name (<prgn/nvi/, <prgn/vim/ or whatever).
  2043. Nevertheless it is desirable to have the name <tt/vi/ refer to
  2044. something, at least by default.
  2045. <p>
  2046. If all the packages involved cooperate, this can be done with
  2047. <prgn/update-alternatives/.
  2048. <p>
  2049. Each package provides its own version under its own name, and calls
  2050. <prgn/update-alternatives/ in its postinst to register its version
  2051. (and again in its prerm to deregister it).
  2052. <p>
  2053. See the manpage <manref name=update-alternatives section=8> for
  2054. details.
  2055. <p>
  2056. If <prgn/update-alternatives/ does not seem appropriate you may wish
  2057. to consider using diversions instead.
  2058. <chapt id="diversions">Diversions - overriding a package's version of a file
  2059. <p>
  2060. It is possible to have <prgn/dpkg/ not overwrite a file when it
  2061. reinstalls the package it belongs to, and to have it put the file from
  2062. the package somewhere else instead.
  2063. <p>
  2064. This can be used locally to override a package's version of a file, or
  2065. by one package to override another's version (or provide a wrapper for
  2066. it).
  2067. <p>
  2068. Before deciding to use a diversion, read <ref id="alternatives"> to
  2069. see if you really want a diversion rather than several alternative
  2070. versions of a program.
  2071. <p>
  2072. There is a diversion list, which is read by <prgn/dpkg/, and updated
  2073. by a special program <prgn/dpkg-divert/. Please see <manref
  2074. name=dpkg-divert section=8> for full details of its operation.
  2075. <p>
  2076. When a package wishes to divert a file from another, it should call
  2077. <prgn/dpkg-divert/ in its preinst to add the diversion and rename the
  2078. existing file. For example, supposing that a <prgn/smailwrapper/
  2079. package wishes to install a wrapper around <tt>/usr/sbin/smail</>:
  2080. <example>
  2081. if [ install = "$1" ]; then
  2082. dpkg-divert --package smailwrapper --add --rename \
  2083. --divert /usr/sbin/smail.real /usr/sbin/smail
  2084. fi
  2085. </example>
  2086. Testing <tt/$1/ is necessary so that the script doesn't try to add the
  2087. diversion again when <prgn/smailwrapper/ is upgraded. The
  2088. <tt/--package smailwrapper/ ensures that <prgn/smailwrapper/'s copy of
  2089. <tt>/usr/sbin/smail</> can bypass the diversion and get installed as
  2090. the true version.
  2091. <p>
  2092. The postrm has to do the reverse:
  2093. <example>
  2094. if [ remove = "$1" ]; then
  2095. dpkg-divert --package smailwrapper --remove --rename \
  2096. --divert /usr/sbin/smail.real /usr/sbin/smail
  2097. fi
  2098. </example>
  2099. <p>
  2100. Do not attempt to divert a file which is vitally important for the
  2101. system's operation - when using <prgn/dpkg-divert/ there is a time,
  2102. after it has been diverted but before <prgn/dpkg/ has installed the
  2103. new version, when the file does not exist.
  2104. <chapt id="sharedlibs">Shared libraries
  2105. <p>
  2106. Packages containing shared libraries must be constructed with a little
  2107. care to make sure that the shared library is always available. This
  2108. is especially important for packages whose shared libraries are
  2109. vitally important, such as the libc.
  2110. <p>
  2111. Firstly, your package should install the shared libraries under their
  2112. normal names. For example, the <prgn/libgdbm1/ package should install
  2113. <tt/libgdbm.so.1.7.3/ as <tt>/usr/lib/libgdbm.so.1.7.3</tt>. The
  2114. files should not be renamed or relinked by any prerm or postrm
  2115. scripts; <prgn/dpkg/ will take care of renaming things safely without
  2116. affecting running programs, and attempts to interfere with this are
  2117. likely to lead to problems.
  2118. <p>
  2119. Secondly, your package should include the symlink that <prgn/ldconfig/
  2120. would create for the shared libraries. For example, the <prgn/libgdbm1/
  2121. package should include a symlink from <tt>/usr/lib/libgdbm.so.1</tt>
  2122. to <tt/libgdbm.so.1.7.3/. This is needed so that <prgn/ld.so/ can find
  2123. the library in between the time <prgn/dpkg/ installs it and
  2124. <prgn/ldconfig/ is run in the <prgn/postinst/ script. Futhermore, and <em/this
  2125. is very important/, the symlink must be placed before the library it
  2126. points to in the <tt/.deb/ file. Currently the way to ensure the
  2127. ordering is done properly is to create the symlink in the appropriate
  2128. <tt>debian/tmp/.../lib</tt> directory before installing the library
  2129. when you build the package.
  2130. <p>
  2131. If you do the above your package does not need to call <prgn/ldconfig/
  2132. in its maintainer scripts. It is especially important not to call
  2133. <prgn/ldconfig/ in the postrm or preinst scripts in the case where the
  2134. package is being upgraded (see the programmer's manual), as
  2135. <prgn/ldconfig/ will see the temporary names that <prgn/dpkg/ uses for the
  2136. files while it is installing them and will make the shared library
  2137. links point to them, just before <prgn/dpkg/ continues the installation
  2138. and removes the links!
  2139. <chapt id="sysvinit">Configuration of <prgn/init/
  2140. <p>
  2141. <sect>Introduction to the <tt/init.d/ scheme
  2142. <p>
  2143. The <tt>/etc/init.d</> directory contains the scripts executed by
  2144. <prgn/init/ when init state (or `runlevel') is changed (see <manref
  2145. name=init section=8>).
  2146. <p>
  2147. These scripts are be referenced by symbolic links in the
  2148. <tt>/etc/rc<var/n/.d</> directories. When changing runlevels, init
  2149. looks in the directory <tt>/etc/rc<var/n/.d</> for the scripts it
  2150. should execute, where <var/n/ is the runlevel that is being changed
  2151. to.
  2152. <p>
  2153. The names of the links all have the form <tt/S<var/mm/<var/script// or
  2154. <tt/K<var/mm/<var/script// where <var/mm/ is a two-digit number and
  2155. <var/script/ is the name of the script (this should be the same as the
  2156. name of the actual script in <tt>/etc/init.d</>.
  2157. When <prgn/init/ changes runlevel first the targets of the links whose
  2158. names starting with a <tt/K/ are executed, each with the single
  2159. argument <tt/stop/, followed by the scripts prefixed with an <tt/S/,
  2160. each with the single argument <tt/start/. The <tt/K/ links are
  2161. responsible for killing services and the <tt/S/ link for starting
  2162. services upon entering the runlevel.
  2163. <p>
  2164. For example, if we are changing from runlevel 2 to runlevel 3, init
  2165. will first execute all of the <tt/K/ prefixed scripts it finds in
  2166. <tt>/etc/rc3.d</>, and then all of the <tt/S/ prefixed scripts. The
  2167. links starting with <tt/K/ will cause the referred-to file to be
  2168. executed with an argument of <tt/stop/, and the <tt/S/ links with an
  2169. argument of <tt/start/.
  2170. <p>
  2171. The two-digit number <var/mm/ is used to decide which order to start
  2172. and stop things in - low-numbered links have their scripts run first.
  2173. For example, the <tt/K20/ scripts will be executed before the <tt/K30/
  2174. scripts. This is used when a certain service must be started before
  2175. another. For example, the name server <prgn/bind/ might need to be
  2176. started before the news server <prgn/inn/ so that <prgn/inn/ can set
  2177. up its access lists. In this case, the script that starts <prgn/bind/
  2178. should have a lower number than the script that starts <prgn/inn/ so
  2179. that it runs first:
  2180. <example>
  2181. /etc/rc2.d/S17bind
  2182. /etc/rc2.d/S70inn
  2183. </example>
  2184. <sect>Writing <tt/init.d/ scripts
  2185. <p>
  2186. Packages can and should place scripts in <tt>/etc/init.d</> to start
  2187. or stop services at boot time or during a change of runlevel. These
  2188. scripts should be named <tt>/etc/init.d/<var/package/</>, and they
  2189. should accept one argument, saying what to do: <tt/start/, meaning to
  2190. starts the service, or <tt/stop/, to stop the service. Optionally
  2191. they can support <tt/reload/ which causes the configuration to be
  2192. reloaded.
  2193. <p>
  2194. The <tt/init.d/ scripts should ensure that they will behave sensibly
  2195. if invoked with <tt/start/ when the service is already running, or
  2196. with <tt/stop/ when it isn't, and that they don't kill
  2197. unfortunately-named user processes. The best way to achieve this is
  2198. usually to use <prgn/start-stop-daemon/.
  2199. <p>
  2200. These scripts should not fail obscurely when the configuration files
  2201. remain but the package has been removed, as the default in <prgn/dpkg/
  2202. is to leave configuration files on the system after the package has
  2203. been removed. Only when it is executed with the <tt/--purge/ option
  2204. will dpkg remove configuration files. Therefore, you should include a
  2205. <tt/test/ statement at the top of the script, like this:
  2206. <example>
  2207. test -f <var/program-executed-later-in-script/ || exit 0
  2208. </example>
  2209. <sect>Managing the <tt/rc<var/n/.d/ links - <prgn/update-rc.d/
  2210. <p>
  2211. A program is provided, <prgn/update-rc.d/, to make it easier for
  2212. package maintainers to arrange for the proper creation and removal of
  2213. <tt>/etc/rc<var/n/.d</> symbolic links from their postinst and postrm
  2214. scripts.
  2215. <p>
  2216. You should use this script to make changes to <tt>/etc/rc<var/n/.d</>
  2217. and <em/never/ include any <tt>/etc/rc<var/n/.d</> symbolic links in
  2218. the actual archive.
  2219. <p>
  2220. By default <prgn/update-rc.d/ will start services in each of the
  2221. multi-user state runlevels (2, 3, 4, and 5) and stop them in the halt
  2222. runlevel (0), the single-user runlevel (1) and the reboot runlevel
  2223. (6). The system administrator will have the opportunity to customize
  2224. runlevels by simply adding, moving, or removing the symbolic links in
  2225. <tt>/etc/rc<var/n/.d</>.
  2226. <p>
  2227. To get the default behaviour for your package, put in your postinst
  2228. script
  2229. <example>
  2230. update-rc.d <var/package/ default &gt;/dev/null
  2231. </example>
  2232. and in your postrm
  2233. <example>
  2234. if [ purge = "$1" ]; then
  2235. update-rc.d <var/package/ remove &gt;/dev/null
  2236. fi
  2237. </example>
  2238. <p>
  2239. This will use a default sequence number of 20. If it does not matter
  2240. when or in which order the script is run, use this default. If it
  2241. does, then you should talk to the maintainer of the <prgn/sysvinit/
  2242. package or post to <tt>debian-devel</>, and they will help you choose
  2243. a number.
  2244. <p>
  2245. For more information about using <tt/update-rc.d/, please consult its
  2246. manpage <manref name=update-rc.d section=8>.
  2247. <sect>Boot-time initialisation - <tt/rc.boot/
  2248. <p>
  2249. There is another directory, <tt>/etc/rc.boot</>, which contains
  2250. scripts which are run once per machine boot. This facility is
  2251. provided for initialisation of hardware devices, cleaning up of
  2252. leftover files, and so forth.
  2253. <p>
  2254. For example, the <prgn/kbd/ package provides a script here for
  2255. initialising the keyboard layout and console font and mode.
  2256. <p>
  2257. The files in <tt>/etc/rc.boot</> should <em/not/ be links into
  2258. <tt>/etc/init.d</> - they should be the scripts themselves.
  2259. <p>
  2260. <tt/rc.boot/ should <em/not/ be used for starting general-purpose
  2261. daemons and similar activities. This should be done using the
  2262. <tt/rc<var/n/.d/ scheme, above, so that the services can be started
  2263. and stopped cleanly when the runlevel changes or the machine is to be
  2264. shut down or rebooted.
  2265. <sect>Notes
  2266. <p>
  2267. <em/Do not/ include the <tt>/etc/rc<var/n/.d/*</> symbolic links in
  2268. the <tt/.deb/ filesystem archive! <em/This will cause problems!/
  2269. You should create them with <prgn/update-rc.d/, as above.
  2270. <p>
  2271. <em/Do not/ include the <tt>/etc/rc<var/n/.d/*</> symbolic links in
  2272. <prgn/dpkg/'s conffiles list! <em/This will cause problems!/
  2273. <em/Do/, however, include the <tt>/etc/init.d</> scripts in conffiles.
  2274. <sect>Example
  2275. <p>
  2276. The <prgn/bind/ DNS (nameserver) package wants to make sure that the
  2277. nameserver is running in multiuser runlevels, and is properly shut
  2278. down with the system. It puts a script in <tt>/etc/init.d</>, naming
  2279. the script appropriately <tt/bind/. As you can see, the script
  2280. interprets the argument <tt/reload/ to send the nameserver a <tt/HUP/
  2281. signal (causing it to reload its configuration); this way the user can
  2282. say <tt>/etc/init.d/bind reload</> to reload the nameserver.
  2283. <p>
  2284. <example>
  2285. #!/bin/sh
  2286. # Original version by Robert Leslie &lt;rob@mars.org&gt;, edited by iwj
  2287. test -x /usr/sbin/named || exit 0
  2288. case "$1" in
  2289. start)
  2290. test -f /etc/named.boot -a -f /var/named/boot.options || exit 0
  2291. start-stop-daemon --start --verbose --exec /usr/sbin/named
  2292. ;;
  2293. stop)
  2294. start-stop-daemon --stop --verbose \
  2295. --pidfile /var/run/named.pid --exec /usr/sbin/named
  2296. ;;
  2297. reload)
  2298. start-stop-daemon --stop --signal 1 --verbose \
  2299. --pidfile /var/run/named.pid --exec /usr/sbin/named
  2300. ;;
  2301. *)
  2302. echo "Usage: /etc/init.d/bind {start|stop|reload}" >&2
  2303. exit 1
  2304. ;;
  2305. esac
  2306. exit 0
  2307. </example>
  2308. <p>
  2309. Another example on which to base your <tt>/etc/init.d</> scripts is in
  2310. <tt>/etc/init.d/skeleton</>.
  2311. <p>
  2312. If this package is happy with the default setup from
  2313. <prgn/update-rc.d/, namely an ordering number of 20 and having named
  2314. running in all runlevels, it can say in its postinst:
  2315. <example>
  2316. update-rc.d bind default >/dev/null
  2317. </example>
  2318. And in its postrm, to remove the links when the package is purged:
  2319. <example>
  2320. if [ purge = "$1" ]; then
  2321. update-rc.d acct remove >/dev/null
  2322. fi
  2323. </example>
  2324. <chapt id="methif"><prgn/dselect/'s interface to its installation methods
  2325. <p>
  2326. <prgn/dselect/ calls scripts from its installation methods when it
  2327. needs to actually access data from the distribution. The core program
  2328. <prgn/dselect/ itself just calls these scripts and provides the
  2329. package and access method selection interfaces. The installation
  2330. methods are responsible for invoking <prgn/dpkg/ as appropriate.
  2331. <p>
  2332. Each installation method has three scripts:
  2333. <list compact>
  2334. <item>Setup installation parameters.
  2335. <item>Update list of available packages.
  2336. <item>Install.
  2337. </list>
  2338. <p>
  2339. <prgn/dselect/ searches for methods in <tt>/usr/lib/dpkg/methods</>
  2340. and <tt>/usr/local/lib/dpkg/methods</>.
  2341. <sect>Functions of the method scripts
  2342. <p>
  2343. The setup script is run just after the user has chosen an installation
  2344. method. It should prompt the user for parameters like the site to
  2345. NFS-mount or FTP from, the directory to use, or the directory or
  2346. filesystem where the <tt/.deb/ files can be found, or the tape or
  2347. floppy device to install from. It should store the responses under
  2348. <tt>/var/lib/dpkg/methods</> - see below. If no available
  2349. packages list is available it should perhaps offer to scan the
  2350. available packages.
  2351. <p>
  2352. The update script should obtain a list of available packages if
  2353. possible, and run <tt/dpkg --update-avail/, <tt/dpkg --merge-avail/
  2354. and/or <tt/dpkg --forget-old-unavail/ to load it into <prgn/dpkg/ and
  2355. <prgn/dselect/'s database of available packages. If no packages list
  2356. was available and the user was offered and accepted the option of
  2357. scanning the actual files available this scan should be done here,
  2358. using <tt/dpkg --record-avail/.
  2359. <p>
  2360. The install script should feed all the available <tt/.deb/ files to
  2361. <tt/dpkg --iGOEB/ (this is equivalent to <tt/dpkg --install
  2362. --refuse-downgrade --selected-only --skip-same-version
  2363. --auto-deconfigure/). The <tt/-R/ (<tt/--recursive/) option for
  2364. traversing subdirectories may also be useful here).
  2365. <p>
  2366. If any of these scripts needs to display a message for the user, it
  2367. should wait for the user to hit `return' before exiting so that
  2368. dselect doesn't immediately rewrite the screen.
  2369. <p>
  2370. If a method script succeeds (returns a zero exit status)
  2371. <prgn/dselect/ will return immediately to the main menu, with the
  2372. `next' option highlighted ready for the user to select it. If it
  2373. fails <prgn/dselect/ will display a message and wait for the user to
  2374. hit return.
  2375. <sect>Location and arguments of the method scripts
  2376. <p>
  2377. A set of scripts (henceforth known as a group) may provide several
  2378. methods on the `main menu' with different behaviour. For example,
  2379. there might be a generic get-packages-by-FTP group which might provide
  2380. methods in the main menu for installation directly from one of the
  2381. Debian mirror sites as well as for installation from a user-specified
  2382. site.
  2383. <p>
  2384. Each group of methods implemented by the same set of scripts should
  2385. have a subdirectory <tt>/usr/lib/dpkg/methods/<var/group/</> or
  2386. <tt>/usr/local/lib/dpkg/methods/<var/group/</>, containing:
  2387. <taglist compact>
  2388. <tag><tt/names/
  2389. <item>a list of user-visible methods provided by these scripts.
  2390. <tag><tt/setup/
  2391. <tag><tt/update/
  2392. <tag><tt/install/
  2393. <item>executable programs, the scripts themselves.
  2394. <tag><tt/desc.<var/option//
  2395. <item>description file.
  2396. </taglist>
  2397. <p>
  2398. <tt/names/ will be formatted as a list of lines, each containing:
  2399. <example>
  2400. <var/sequence/ <var/method/ <var/summary/
  2401. </example>
  2402. <p>
  2403. <var/sequence/ is a two-digit number that will be used much like
  2404. <tt/rc.d/ prefixes to control the order in the main menu. If in doubt
  2405. use 50.
  2406. <p>
  2407. <var/method/ is a name which is displayed by <prgn/dselect/ as the
  2408. name of the method, and which will be passed to <tt/setup/,
  2409. <tt/update/ and <tt/unpack/ as their first argument.
  2410. <p>
  2411. <var/summary/ is the brief description string for <prgn/dselect/'s menu.
  2412. <p>
  2413. Each of the three scripts gets the same three arguments: <var/vardir/,
  2414. <var/group/ and <var/method/. <var/vardir/ is the base directory for
  2415. storing <prgn/dpkg/ and <prgn/dselect/'s state, usually
  2416. <tt>/var/lib/dpkg</>; this is passed in so that the <tt/--admindir/
  2417. option to <prgn/dselect/ is honoured).
  2418. <p>
  2419. Each option may have an extended description in
  2420. <tt/desc.<var/option//. This should be formatted like the extended
  2421. description part of a <tt/Description/ field entry <em/shifted one
  2422. character to the left/.
  2423. <p>
  2424. <tt><var/vardir//methods</> will exist, and a method group may use a
  2425. <tt><var/vardir//methods/<var/group/</> directory to store its state.
  2426. <p>
  2427. The group name and method name must follow the rules for C identifiers.
  2428. </book>