policy.sgml 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526
  1. <!doctype debiandoc system [
  2. <!entity % manuals-version-def system "manuals-version">
  3. %manuals-version-def;
  4. ]>
  5. <!--
  6. Debian Linux package policy manual.
  7. Copyright (C)1996 Ian Jackson; released under the terms of the GNU
  8. General Public License, version 2 or (at your option) any later.
  9. -->
  10. <book>
  11. <title>Debian policy manual
  12. <author>Ian Jackson <email/ijackson@gnu.ai.mit.edu/
  13. <version>version &manuals-version; (dpkg &dpkg-version;), <date>
  14. <abstract>
  15. This manual describes the policy requirements which must be satisfied
  16. for a package to be included in the Debian distribution. This
  17. includes details of the permissions and ownerships of files in
  18. packages and other technical requirements as well as information like
  19. the upload procedure.
  20. </abstract>
  21. <copyright>Copyright &copy;1996 Ian Jackson.
  22. <p>
  23. This manual is free software; you may redistribute it and/or modify it
  24. under the terms of the GNU General Public License as published by the
  25. Free Software Foundation; either version 2, or (at your option) any
  26. later version.
  27. <p>
  28. This is distributed in the hope that it will be useful, but
  29. <em>without any warranty</em>; without even the implied warranty of
  30. merchantability or fitness for a particular purpose. See the GNU
  31. General Public License for more details.
  32. <p>
  33. You should have received a copy of the GNU General Public License with
  34. your Debian GNU/Linux system, in <tt>/usr/doc/copyright/GPL</tt>, or
  35. with the <prgn/dpkg/ source package as the file <tt>COPYING</tt>. If
  36. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  37. Cambridge, MA 02139, USA.
  38. <toc sect>
  39. <chapt id="scope">Introduction and scope of this manual
  40. <p>
  41. This manual describes the criteria that a Debian-format package must
  42. satisfy to be included in the Debian distribution.
  43. <p>
  44. Much of this information will be useful even when building a package
  45. which is to be distributed in some other way or is for local use.
  46. <p>
  47. This manual does <em/not/ describe the technical mechanisms involved
  48. in package creation, installation and removal. This information can
  49. be found in the <prgn/dpkg/ programmers' manual and the <prgn/dpkg/ system
  50. administrators' manual.
  51. <p>
  52. This document assumes familiarity with these other two manuals.
  53. Unfortunately the system administrators' manual does not exist yet.
  54. <p>
  55. The Debian version of the FSF's GNU <prgn/hello/ program is provided
  56. as an example for people wishing to create Debian packages.
  57. <p>
  58. <em>Note that this document is still a draft!</em>
  59. <chapt id="pkgcopyright">Package copyright
  60. <p>
  61. Please study the copyright of your submission <em/carefully/ and
  62. understand it before proceeding. If you have doubts or questions,
  63. please ask.
  64. <p>
  65. The aims of the policy detailed below are:
  66. <list compact>
  67. <item>
  68. That any user be able to rebuild any package in the official Debian
  69. distribution from the original source plus our patches.
  70. <item>
  71. That we make available in our packaging formats as much software as we
  72. can.
  73. <item>
  74. That it be easy for people to make CDROMs of our distribution without
  75. violating copyrights.
  76. </list>
  77. <p>
  78. All packages in the Debian distribution proper must be freely useable,
  79. modifiable and redistributable in both source and binary
  80. form.<footnote>It is OK for there to be a requirement that modified
  81. versions carry a warning, or that they be released with a different
  82. name or version number, or something similar, because we can comply
  83. with this requirement if necessary.</footnote>
  84. It must be possible for anyone to distribute and use modified source
  85. code and their own compiled binaries, at least when they do so as part
  86. of a Debian distribution.
  87. <p>
  88. Packages
  89. <list compact>
  90. <item>
  91. whose copyright permission notices (or patent problems) do not allow
  92. distribution and copying for profit, without restriction on the amount
  93. charged, or
  94. <item>
  95. where distribution is restricted according to the medium used, or
  96. <item>
  97. where the distributor must ask any kind of special permission of the
  98. authors, or
  99. <item>
  100. with other onerous conditions,
  101. </list>
  102. may only be placed in the semi-supported non-free section of the
  103. Debian FTP archives. This is important so that CDROM manufacturers
  104. can distribute Debian without having to check the copyright of each
  105. package individually, simply by leaving out the contents of the
  106. non-free area; CDROM distributors are encouraged, though, to check the
  107. copyrights on programs in non-free individually and include as many as
  108. they can.
  109. <p>
  110. Packages
  111. <list compact>
  112. <item>
  113. whose copyright permission notices (or patent problems) allow only
  114. distribution of compiled binaries (and thus of which only binaries are
  115. available), or
  116. <item>
  117. where the source code which may be
  118. distributed is not the complete source code required to compile the
  119. program (ie, the program cannot be compiled using only packages in the
  120. main Debian distribution), or
  121. <item>
  122. which depend for their use on non-free or contrib packages, or
  123. <item>
  124. allow free use only for a trial period (shareware), or
  125. <item>
  126. are demonstration programs lacking vital functionality (crippleware),
  127. or
  128. <item>
  129. are only installer-packages which require the user to supply a
  130. separate file to be installed, or
  131. <item>
  132. which fail to meet some other policy requirements,
  133. </list>
  134. may only be placed in the semi-supported contrib section of the Debian
  135. FTP archives (unless they need to be in non-free - see above).
  136. <p>
  137. Programs whose authors encourage the user to make donations are fine
  138. for the main distribution, provided that the authors do not claim that
  139. not donating is immoral, unethical, illegal or something similar;
  140. otherwise they must go in contrib (or non-free, if even distribution
  141. is restricted by such statements).
  142. <p>
  143. Packages whose copyright permission notices (or patent problems) do
  144. not allow redistribution even of only binaries, and where no special
  145. permission has been obtained, cannot placed on the Debian FTP site and
  146. its mirrors at all.
  147. <p>
  148. Note that under international copyright law<footnote>This applies in
  149. the United States, too.</footnote> <em/no/ distribution or modification
  150. of a work is allowed without an explicit notice saying so. Therefore
  151. a program without a copyright notice <em/is/ copyrighted and you may
  152. not do anything to it without risking being sued! Likewise if a
  153. program has a copyright notice but no statement saying what is
  154. permitted then nothing is permitted.
  155. <p>
  156. Many authors are unaware of the problems that restrictive copyrights
  157. (or lack of copyright notices) can cause for the users of their
  158. supposedly-free software. It is often worthwhile contacting such
  159. authors diplomatically to ask them to modify their terms generally, or
  160. specially for Debian. However, this is a politically difficult thing
  161. to do and you should ask for advice on <prgn/debian-devel/ first.
  162. <p>
  163. When in doubt, send mail to <email/debian-devel@lists.debian.org/. Be
  164. prepared to provide us with the copyright statement. Software covered
  165. by the GPL, public domain software and BSD-like copyrights are safe;
  166. be wary of the phrases `commercial use prohibited' and `distribution
  167. restricted'.
  168. <p>
  169. Every package submission <em/must/ be accompanied by verbatim copy of
  170. its copyright (with the exceptions of public domain packages and those
  171. covered by the UCB BSD licence or the GNU GPL or LGPL; in these cases
  172. simply indicate which is appropriate). This information must be
  173. included in a file installed by the binary package - see <ref
  174. id="copyrightfile">.
  175. <chapt id="binarypkg">Contents of the binary package
  176. <sect>Control file requirements
  177. <sect1><tt/Maintainer/ information
  178. <p>
  179. All packages must have a <tt/Maintainer/ field with the correct name
  180. and a working email address for the Debian maintainer of the package.
  181. If one person maintains several packages they should try to avoid
  182. having different forms of their name and address in different
  183. <tt/Maintainer/ fields.
  184. <sect1>Dependencies and virtual packages
  185. <p>
  186. Add a dependency for any shared libraries required by
  187. dynamically-linked executable binaries in your package. Almost every
  188. package containing compiled C code should therefore include a
  189. <tt/Depends/ field which mentions the shared C library required for
  190. the program to run. For ELF binaries linked against <tt/libc.so.5/
  191. the relevant package name is <tt/libc5/.
  192. <p>
  193. All packages must use virtual package names where appropriate, and
  194. arrange to create new ones if necessary. They must not use virtual
  195. package names (except privately, amongst a cooperating group of
  196. packages) unless they have been agreed upon and appear in the list of
  197. virtual package names.
  198. <p>
  199. The latest version of the authoritative list of virtual package names
  200. can be found on <ftpsite>ftp.debian.org</> in
  201. <ftppath>/debian/doc/package-developer/virtual-package-names-list.text</>
  202. or your local mirror. The procedure for updating it is described at
  203. the top of the file.
  204. <sect1><tt/Section/ and <tt/Priority/
  205. <p>
  206. Decide whether your package can go in <tt/non-free/, <tt/contrib/ or
  207. the main distribution - see <ref id="pkgcopyright">, and put
  208. an appropriate value for the distribution in the
  209. <tt>debian/changelog</> file.
  210. <p>
  211. The <tt/Priority/ and <tt/Section/ control file fields give
  212. information for classifying the package in <prgn/dselect/ and say
  213. which directory to place it in the FTP archive.
  214. <p>
  215. They are ultimately the responsibility of the distribution
  216. maintainers; however, you should suggest values for them in your
  217. <tt/.changes/ information when you upload a package. You do this by
  218. including appropriate information in the <tt>debian/control</tt> file
  219. before building the packages.
  220. <p>
  221. For a list of the currently in-use sections, please see the FTP
  222. archive. Packages in the non-free and contrib areas should have
  223. section <tt/non-free/ and <tt/contrib/, respectively.
  224. <sect2><tt/Priority/ values
  225. <p>
  226. <taglist>
  227. <tag><tt/required/
  228. <item>
  229. <tt/required/ packages are necessary for the proper functioning of the
  230. system. You must not remove these packages or your system may become
  231. totally broken and you may probably not even be able to use
  232. <prgn/dpkg/ to put things back. Systems with only the <tt/required/
  233. packages are probably unuseable, but they do have enough functionality
  234. to allow the sysadmin to boot and install more software.
  235. <tag><tt/important/
  236. <item>
  237. Important programs, including those which one would expect to find on
  238. any Unix-like system. If the expectation is that an experienced Unix
  239. person who found it missing would go `What the F*!@&lt;+ is going on,
  240. where is <prgn/foo/', it should be in <tt/important/. This is an
  241. important criterion because we are trying to produce, amongst other
  242. things, a free Unix. Other packages without which the system will not
  243. run well or be useable should also be here. This does <em/not/
  244. include Emacs or X11 or TeX or any other large applications. The
  245. <tt/important/ packages are just a bare minimum of commonly-expected
  246. and necessary tools.
  247. <tag><tt/standard/
  248. <item>
  249. These packages provide a reasonably small but not too limited
  250. character-mode system. This is what will install by default if the
  251. user doesn't select anything else. It doesn't include many large
  252. applications, but it does include Emacs (this is more of a piece of
  253. infrastructure than an application) and a reasonable subset of TeX and
  254. LaTeX (if this is possible without X).
  255. <tag><tt/optional/<footnote>In a sense everything is optional that
  256. isn't required, but that's not what is meant here.</footnote>
  257. <item>
  258. This is all the software that you might reasonably want to install if
  259. you didn't know what it was or don't have specialised requirements.
  260. This is a much larger system and includes X11, a full TeX
  261. distribution, and lots of applications.
  262. <tag><tt/extra/
  263. <item>
  264. This contains packages that conflict with others with higher
  265. priorities, or are only likely to be useful if you already know what
  266. they are or have specialised requirements.
  267. </taglist>
  268. <p>
  269. Priority values are not case-sensitive.
  270. <sect2>Base packages
  271. <p>
  272. Some packages have <tt/Section: base/ and are in the <tt/base/
  273. subdirectory on the FTP archives. These are the packages that are
  274. supplied on the base disks. They are the minimum sensible set for
  275. installing new packages (perhaps via a network).
  276. <p>
  277. Most of these packages should have <tt/Priority: required/ or at least
  278. <tt/Priority: important/.
  279. <sect1>The <tt/Essential/ flag
  280. <p>
  281. The <tt/Essential: yes/ control file field should not be used unless
  282. removing a package really will completely hose the system; nor should
  283. it be used for a shared library package - the dependencies will
  284. prevent its premature removal, and we need to be able to remove it
  285. when it has been superseded.
  286. <sect1>Including <tt/Priority/ and <tt/Section/ in the <tt/.deb/
  287. control file
  288. <p>
  289. If a user installs a package which is not part of the standard
  290. distribution, or without downloading and updating from a new
  291. <prgn/Packages/ file, the information about the priority and section
  292. of a package will be absent, and the <prgn/dselect/ package listing
  293. will have the package listed under `unclassified'. In order to
  294. improve this it is permissible to use the <tt/-is/, <tt/-isp/ or
  295. <tt/-ip/ option to <prgn/dpkg-gencontrol/, so that the <tt/Section/
  296. and/or <tt/Priority/ is copied into the actual control information in
  297. the <tt/.deb/ file. However, if you do this you should make sure you
  298. keep the information up to date so that users are not shown
  299. conflicting information.
  300. <sect1>Formatting of the <tt/Description/ control file field
  301. <p>
  302. Every Debian package should have an extended description.
  303. <p>
  304. The description should be written so that it tells the user what they
  305. need to know to decide whether to install the package. This
  306. description should not just be copied from the blurb for the program.
  307. Instructions for configuring or using the package should not be
  308. included - that is what installation scripts, manpages, Info files and
  309. <tt>/usr/doc/<var/package/</> are for. Copyright statements and other
  310. administrivia should not be included - that is what
  311. <tt>/usr/doc/<var/package//copyright</> is for.
  312. <p>
  313. If you wish to include a list in your extended with entries which are
  314. a line or more each you must indent each entry by one space to make
  315. sure that it doesn't get wordwrapped. The start of each list entry
  316. should be marked with an asterisk, followed by a single space. You
  317. must wrap the list entries yourself to 75 columns, and should start
  318. continuation lines indented by three spaces so that they line up with
  319. the start of the text on the first line of each list entry.
  320. <p>
  321. See the programmers' manual for further requirements and pitfalls.
  322. <sect>Locations of files
  323. <p>
  324. The location of all installed files and directories must comply fully
  325. with the Linux File System Standard (FSSTND). The latest version of
  326. this document can be found alongside this manual or on
  327. <ftpsite/tsx-11.mit.edu/ in
  328. <ftppath>/pub/linux/docs/linux-standards/fsstnd/</>. Specific questions
  329. about following the standard may be asked on <prgn/debian-devel/, or
  330. referred to Daniel Quinlan, the FSSTND coordinator, at
  331. <email/quinlan@yggdrasil.com/.
  332. <p>
  333. <sect1>Manpages
  334. <p>
  335. You must install manpages in <prgn/nroff/ source form, in appropriate
  336. places under <tt>/usr/man</tt>. You should only use sections 1 to 9
  337. (see the FSSTND for more details). You must <em/not/ install a
  338. preformatted `cat page'.
  339. <p>
  340. If no manual page is available for a particular program, utility or
  341. function and this is reported as a bug on debian-bugs, a symbolic link
  342. from the requested manual page to the <manref name=undocumented
  343. section=7> manual page should be provided. This symbolic link can be
  344. created from <tt>debian/rules</> like this:
  345. <example>
  346. ln -s ../man7/undocumented.7 \
  347. debian/tmp/usr/man/man[1-9]/the_requested_manpage.[1-9]
  348. </example>
  349. This manpage claims that the lack of a manpage has been reported as a
  350. bug, so you may only do this if it really has (you can report it
  351. yourself, if you like). Do not close the bug report until a proper
  352. manpage is available.
  353. <p>
  354. You may forward a complaint about a missing manpage to the upstream
  355. authors, and mark the bug as forwarded in the Debian bug tracking
  356. system. Even though the GNU Project do not in general consider the
  357. lack of a manpage to be a bug, we do - if they tell you that they
  358. don't consider it a bug you should leave the bug in our bug tracking
  359. system open anyway.
  360. <p>
  361. Manpages should be installed compressed using <tt/gzip -9/.
  362. <p>
  363. If one manpage needs to be accesssible via several names it is better
  364. to use a symbolic link than the <tt/.so/ feature, but there is no need
  365. to fiddle with the relevant parts of the upstream source to change
  366. from <tt/.so/ to symlinks - don't do it unless it's easy. Do not
  367. create hard links in the manual page directories, and do not put
  368. absolute filenames in <tt/.so/ directives. The filename in a
  369. <tt/.so/ in a manpage should be relative to the base of the manpage
  370. tree (usually <tt>/usr/man</tt>).
  371. <sect1>Info documents
  372. <p>
  373. Info documents should be installed in <tt>/usr/info</tt>. They should
  374. be compressed with <tt/gzip -9/.
  375. <p>
  376. Your package must call <prgn/install-info/ to update the Info <tt/dir/
  377. file, in its post-installation script:
  378. <example>
  379. install-info --quiet --section Development Development \
  380. /usr/info/foobar.info
  381. </example>
  382. <p>
  383. It is a good idea to specify a section for the location of your
  384. program; this is done with the <tt/--section/ switch. To determine
  385. which section to use, you should use look at <tt>/usr/info/dir</> on
  386. your system and choose the most relevant (or create a new section if
  387. none of the current sections are relevant). Note that the
  388. <tt/--section/ flag takes two arguments; the first is a regular
  389. expression to match (case-insensitively) against an existing section,
  390. the second is used when creating a new one.
  391. <p>
  392. You must remove the entries in the pre-removal script:
  393. <example>
  394. install-info --quiet --remove /usr/info/foobar.info
  395. </example>
  396. <p>
  397. If <prgn/install-info/ cannot find a description entry in the Info file
  398. you will have to supply one. See <manref name=install-info section=8>
  399. for details.
  400. <sect1>Additional documentation
  401. <p>
  402. Any additional documentation that comes with the package can be
  403. installed at the discretion of the package maintainer. Text
  404. documentation should be installed in a directory
  405. <tt>/usr/doc/<var/package/</tt><footnote>Where <var/package/ is the
  406. name of the package.</footnote> and compressed with <tt/gzip -9/
  407. unless it is small.
  408. <p>
  409. If a package comes with large amounts of documentation which many
  410. users of the package will not require you should create a separate
  411. binary package to contain it, so that it does not take up disk space
  412. on the machines of users who do not need or want it installed.
  413. <p>
  414. It is often a good idea to put text information files (<tt/README/s,
  415. changelogs, and so forth) that come with the source package in
  416. <tt>/usr/doc/<var/package/</> in the binary package. However, don't
  417. install the instructions for building and installing the package, of
  418. course!
  419. <sect1>Preferred documentation formats
  420. <p>
  421. The unification of Debian documentation is being carried out via HTML.
  422. <p>
  423. If your package comes with extensive documentation in a markup format
  424. that can be converted to various other formats you should if possible
  425. ship HTML versions in the binary package, in the directory
  426. <tt>/usr/doc/<var/package/</> or its subdirectories.
  427. <p>
  428. Other formats such as PostScript may be provided at your option.
  429. <sect2>Examples
  430. <p>
  431. Any examples (configurations, source files, whatever), should be
  432. installed in a directory <tt>/usr/doc/<var/package//examples</tt>.
  433. These files should not be referenced by any program - they're there
  434. for the benefit of the system administrator and users, as
  435. documentation only.
  436. <sect1 id="instchangelog"><tt>/usr/doc/<var/package//changelog.Debian.gz</tt>
  437. <p>
  438. This installed file must contain a copy of the <tt>debian/changelog</>
  439. file from your Debian source tree.
  440. <p>
  441. It should be installed compressed using <tt/gzip -9/, as it will
  442. become large with time even if it starts out small.
  443. <p>
  444. If the package has only one changelog which is used both as the Debian
  445. changelog and the upstream one because there is no separate upstream
  446. maintainer then the changelog should usually be installed as
  447. <tt>/usr/doc/<var/package//changelog.gz</> instead.
  448. <sect1 id="copyrightfile"><tt>/usr/doc/<var/package//copyright</tt>
  449. <p>
  450. This file must contain details of the authorship and copyright of the
  451. package. It must say where the upstream sources (if any) were
  452. obtained, and explain briefly what modifications were made in the
  453. Debian version of the package compared to the upstream one. It must
  454. name the original authors of the package and the Debian maintainer(s)
  455. who were involved with its creation.
  456. <p>
  457. It must contain the full text of the copyright notice and any
  458. acknowledgements for the program and the licence terms under which the
  459. program is distributed. If the package is distributed under the GNU
  460. General Public Licence, the GNU Library General Public Licence, the
  461. Regents of the University of California at Berkeley (BSD) licence or
  462. Larry Wall's Artistic Licence please say so instead of including a
  463. copy of the licence. The files <tt/BSD/, <tt/GPL/, <tt/LGPL/ and
  464. <tt/Artistic/ are be available in <tt>/usr/doc/copyright</tt> for you
  465. to refer to.
  466. <p>
  467. The copyright file should not be compressed unless it is very large.
  468. <p>
  469. Do not use the copyright file as a general <tt/README/ file. If your
  470. package has such a file it should be installed in
  471. <tt>/usr/doc/<var/package//README</> or <tt/README.Debian/ or some
  472. other appropriate place.
  473. <sect1>Symbolic links
  474. <p>
  475. Most symbolic links should be relative, not absolute. Absolute links,
  476. in general, cause problems when a file system is not mounted where it
  477. "normally" resides (for example, when mounted via NFS).
  478. <p>
  479. In particular, symlinks from one part of <tt>/usr</tt> to another
  480. should be relative.
  481. <p>
  482. In certain cases, however, relative links may cause more problems.
  483. For example, links into <tt>/etc</tt> and <tt>/var</tt> should be
  484. absolute.
  485. <p>
  486. Note that when creating a relative link using <prgn/ln/ it is not
  487. necessary for the target of the link to exist relative to the working
  488. directory you're running <prgn/ln/ from; nor is it necessary to change
  489. directory to the directory where the link is to be made. Simply
  490. include the string that should appear as the target of the link (this
  491. will be a pathname relative to the directory in which the link
  492. resides) as the first argument to <prgn/ln/.
  493. <p>
  494. For example, in your <prgn/Makefile/ or <tt>debian/rules</>, do things
  495. like:
  496. <example>
  497. ln -fs gcc $(prefix)/bin/cc
  498. ln -fs gcc debian/tmp/usr/bin/cc
  499. ln -fs ../sbin/sendmail $(prefix)/bin/runq
  500. ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq
  501. </example>
  502. <sect1>Logfiles
  503. <p>
  504. Logfiles should usually be named
  505. <tt>/var/log/<var/package/.log</tt>. If you have many logfiles,
  506. or need a separate directory for permissions reasons
  507. (<tt>/var/log</tt> is writeable only by <tt/root/), you should usually
  508. create a directory named <tt>/var/log/<var/package/</tt>.
  509. <p>
  510. Make sure that any logfiles are rotated occasionally using so that
  511. they don't grow indefinitely; the best way to do this is to use
  512. <prgn/savelog/ program in an <tt>/etc/cron.daily</>,
  513. <tt>/etc/cron.weekly</> or <tt>/etc/cron.monthly</> script.
  514. <p>
  515. Make sure that any logfiles are removed when the package is purged
  516. (but not when it is only removed), by checking the argument to the
  517. postrm script (see the programmer's manual for details).
  518. <sect1><tt>/usr/local</> - for the use of the system administrator
  519. <p>
  520. As mandated by the FSSTND no package should place any files in
  521. <tt>/usr/local</>, either by putting them in the filesystem archive to
  522. be unpacked by <prgn/dpkg/ or by manipulating them in their maintainer
  523. scripts.
  524. <p>
  525. Every package that searches a number of directories or files for
  526. something (for example, looking for shared libraries in <tt>/lib</> or
  527. <tt>/usr/lib</>) should search an appropriate directory in
  528. <tt>/usr/local</> too.
  529. <p>
  530. In order that the system administrator may know where to place
  531. additional files a package should create an empty directory in the
  532. appropriate place in <tt>/usr/local</> by supplying it in the
  533. filesystem archive for unpacking by <prgn/dpkg/. The
  534. <tt>/usr/local</> directory itself and all the subdirectories created
  535. by the package should have permissions 2775 (group-writeable and
  536. set-group-id) and be owned by <tt/root.staff/.
  537. <p>
  538. In the future it will be possible to tell <prgn/dpkg/ not to unpack
  539. files matching certain patterns, so that system administrators who do
  540. not wish these directories in <tt>/usr/local</> do not need to have
  541. them.
  542. <sect>Permissions and ownerships
  543. <p>
  544. The rules in this section are guidelines for general use. If
  545. necessary you may deviate from the details below. However, if you do
  546. so you must make sure that what is done is secure and you must try to
  547. be as consistent as possible with the rest of the system. You should
  548. probably also discuss it on <prgn/debian-devel/ first.
  549. <p>
  550. Files should be owned by <tt/root.root/, and made writeable only by
  551. the owner and universally readable (and executable, if appropriate).
  552. <p>
  553. Directories should be mode 755 or (for group-writability) mode 2775.
  554. The ownership of the directory should be consistent with its mode -
  555. if a directory is mode 2775, it should be owned by the group that
  556. needs write access to it.
  557. <p>
  558. Setuid and setgid executables should be mode 4755 or 2755
  559. respectively, and owned by the appropriate user or group. They should
  560. not be made unreadable (modes like 4711 or 2711 or even 4111); doing
  561. so achieves no extra security, because anyone can find the binary in
  562. the freely available Debian package - it is merely inconvenient. For
  563. the same reason you should not restrict read or execute permissions on
  564. non-set-id executables.
  565. <p>
  566. Some setuid programs need to be restricted to particular sets of
  567. users, using file permissions. In this case they should be owned by
  568. the uid to which they are set-id, and by the group which should be
  569. allowed to execute them. They should have mode 4754; there is no
  570. point in making them unreadable to those users who must not be allowed
  571. to execute them.
  572. <p>
  573. Do not arrange that the system administrator can only reconfigure the
  574. package to correspond to their local security policy by changing the
  575. permissions on a binary. Ordinary files installed by <prgn/dpkg/ (as
  576. opposed to conffiles and other similar objects) have their permissions
  577. reset to the distributed permissions when the package is reinstalled.
  578. Instead you should consider (for example) creating a group for people
  579. allowed to use the program(s) and making any setuid executables
  580. executable only by that group.
  581. <p>
  582. Shared libraries should be installed executable.
  583. <sect>Configuration files
  584. <p>
  585. Any configuration files created or used by your package should reside
  586. in <tt>/etc</tt>. If there are several you should consider creating a
  587. subdirectory named after your package.
  588. <p>
  589. It is almost certain that any file in <tt>/etc</tt> that is in your
  590. package's filesystem archive should be listed in <prgn/dpkg/'s
  591. <tt/conffiles/ control area file. (See the <prgn/dpkg/ programmers'
  592. manual).
  593. <sect>Maintainer scripts
  594. <p>
  595. The package installation scripts should avoid producing output which
  596. it is unnecessary for the user to see and should rely on <prgn/dpkg/ to
  597. stave off boredom on the part of a user installing many packages.
  598. This means, amongst other things, using the <tt/--quiet/ option on
  599. <prgn/install-info/.
  600. <p>
  601. Packages should try to minimise the amount of prompting they need to
  602. do, and they should ensure that the user will only every be asked each
  603. question once. This means that packages should try to use appropriate
  604. shared configuration files (such as <tt>/etc/papersize</> and
  605. <tt>/etc/news/server</>, rather than each prompting for their own
  606. list of required pieces of information.
  607. <p>
  608. It also means that an upgrade should not ask the same questions again,
  609. unless the user has used <tt/dpkg --purge/ to remove the package's
  610. configuration. The answers to configuration questions should be
  611. stored in an appropriate place in <tt>/etc</> so that the user can
  612. modify them, and how this has been done should be documented.
  613. <p>
  614. If a package has a vitally important piece of information to pass to
  615. the user (such as "don't run me as I am, you must edit the following
  616. configuration files first or you risk your system emitting
  617. badly-formatted messages"), it should display this in the
  618. <prgn/postinst/ script and prompt the user to hit return to
  619. acknowledge the message. Copyright messages do not count as vitally
  620. important (they belong in <tt>/usr/doc/copyright</>); neither do
  621. instructions on how to use a program (these should be in on line
  622. documentation, where all the users can see them).
  623. <p>
  624. Any necessary prompting should almost always be confined to the
  625. post-installation script, and should be protected with a conditional
  626. so that unnecssary prompting doesn't happen if a package's
  627. installation fails and the <prgn/postinst/ is called with
  628. <tt/abort-upgrade/, <tt/abort-remove/ or <tt/abort-deconfigure/.
  629. <p>
  630. Errors which occur during the execution of an installation script
  631. <em/must/ be checked and the installation <em/must not/ continue after
  632. an error.
  633. <p>
  634. The section below on scripts in general applies to package maintainer
  635. scripts too.
  636. <sect>Scripts in general
  637. <p>
  638. All command scripts, including the package maintainer scripts inside
  639. the package and used by <prgn/dpkg/, should have a <tt/#!/ line naming
  640. the shell to be used to interpret them.
  641. <p>
  642. In the case of Perl scripts this should be <tt>#!/usr/bin/perl</tt>.
  643. <p>
  644. Shell scripts (<prgn/sh/ and <prgn/bash/) should almost certainly
  645. start with <tt>set -e</> so that errors are detected. Every script
  646. <em/must/ use <tt/set -e/ or check the exit status of <em/every/
  647. command.
  648. <p>
  649. Perl scripts should check for errors when making any system calls,
  650. including <tt/open/, <tt/print/, <tt/close/, <tt/rename/ and
  651. <tt/system/.
  652. <p>
  653. <prgn/csh/ and <prgn/tcsh/ should be avoided as scripting languages. See
  654. Csh Programming Considered Harmful, one of the <tt/comp.unix.*/ FAQs.
  655. If an upstream package comes with <prgn/csh/ scripts then you must make
  656. sure that they start with <tt>#!/bin/csh</tt> and make your package
  657. depend on <prgn/csh/.
  658. <p>
  659. <sect>Compilation options
  660. <p>
  661. Generally the following compilation parameters should be used:
  662. <example>
  663. CC = gcc
  664. CFLAGS = -O2 -g -Wall # sane warning options vary between programs
  665. LDFLAGS = # none
  666. install -s # (or use strip on the files in debian/tmp)
  667. </example>
  668. <p>
  669. Note that all installed binaries should be stripped, either by using
  670. the <tt/-s/ flag to <prgn/install/, or by calling <prgn/strip/ on the
  671. binaries after they have been copied into <tt>debian/tmp</> but
  672. before the tree is made into a package.
  673. <p>
  674. Make sure that you do not link with <tt/-g/, as this makes a.out
  675. compilers produce huge statically linked binaries. The <tt/-g/ flag
  676. is useful on compilation so that you have available a full set of
  677. debugging symbols in your built source tree, in case anyone should
  678. file a bug report involving (for example) a core dump.
  679. <p>
  680. The <tt/-N/ flag should not be used. On a.out systems it may have
  681. been useful for some very small binaries, but for ELF it has no good
  682. effect.
  683. <p>
  684. It is up to the package maintainer to decide what compilation options
  685. are best for the package. Certain binaries (such as
  686. computationally-intensive programs) may function better with certain
  687. flags (<tt/-O3/, for example); feel free to use them. Please use good
  688. judgment here. Don't use flags for the sake of it; only use them if
  689. there is good reason to do so. Feel free to override the upstream
  690. author's ideas about which compilation options are best - they are
  691. often inappropriate for our environment.
  692. <p>
  693. Please make sure that you use only released versions of shared
  694. libraries to build your packages; otherwise other users will not be
  695. able to run your binaries properly. Producing source packages that
  696. depend on unreleased compilers is also usually a bad idea.
  697. <sect>Shared library packages
  698. <p>
  699. Packages involving shared libraries should be split up into several
  700. binary packages.
  701. <p>
  702. For a straightforward library which has a development environment and
  703. a runtime kit including just shared libraries you need to create two
  704. packages: <tt/<var/libraryname/<var/soname//<footnote><var/soname/ is
  705. the shared object name of the shared library - it's the thing that has
  706. to match exactly between building an executable and running it for the
  707. dynamic linker to be able run the program. Usually the <var/soname/
  708. is the major number of the library.</footnote> and
  709. <tt/<var/libraryname/<var/soname/-dev/.
  710. <p>
  711. If you prefer only to support one development version time you may
  712. name the development package <tt/<var/libraryname/-dev/; otherwise you
  713. may wish to use <prgn/dpkg/'s conflicts mechanism to ensure that the
  714. user only installs one development version at a time (after all,
  715. different development versions are likely to have the same header
  716. files in them, causing a filename clash if both are installed).
  717. Typically the development version will also need an exact version
  718. dependency on the runtime library, to make sure that compilation and
  719. linking happens correctly.
  720. <p>
  721. Packages which use the shared library should have a dependency on the
  722. name of the shared library package,
  723. <tt/<var/libraryname/<var/soname//. When the <var/soname/ changes you
  724. can have both versions of the library installed while moving from the
  725. old library to the new.
  726. <p>
  727. If your package has some run-time support programs which use the
  728. shared library you must <em/not/ put them in the shared library
  729. package. If you do that then you won't be able to install several
  730. versions of the shared library without getting filename clashes.
  731. Instead, either create a third package for the runtime binaries (this
  732. package might typically be named <tt/<var/libraryname/-runtime/ - note
  733. the absence of the <var/soname/ in the package name) or if the
  734. development package is small include them in there.
  735. <p>
  736. If you have several shared libraries built from the same source tree
  737. you can lump them all togther into a single shared library package,
  738. provided that you change all their <var/soname/s at once (so that you
  739. don't get filename clashes if you try to install different versions of
  740. the combined shared libraries package).
  741. <p>
  742. Follow the directions in the <prgn/dpkg/ programmers' manual for
  743. putting the shared library in its package, and make sure you include a
  744. <tt/shlibs/ control area file with details of the dependencies for
  745. packages which use the library.
  746. <sect>Application configuration files, dotfiles and <tt>/etc/skel</>
  747. <p>
  748. Files in <tt>/etc/skel</> will automatically be copied into new user
  749. accounts by <prgn/adduser/. They should not be referenced there by
  750. any program.
  751. <p>
  752. Therefore, if a program needs a dotfile to exist in advance in
  753. <tt/$HOME/ to work sensibly that dotfile should be installed in
  754. <tt>/etc/skel</> (and listed in conffiles, if it is not generated and
  755. modified dynamically by the package's installation scripts).
  756. <p>
  757. However, programs that require dotfiles in order to operate sensibly
  758. (dotfiles that they do not create themselves automatically, that is)
  759. are a bad thing, and programs should be configured by the Debian
  760. default installation as close to normal as possible.
  761. <p>
  762. Therefore, if a program in a Debian package needs to be configured in
  763. some way in order to operate sensibly that configuration should be
  764. done in a site-wide global configuration file elsewhere in
  765. <tt>/etc</>. Only if the program doesn't support a site-wide default
  766. configuration and the package maintainer doesn't have time to add it
  767. should a default per-user file be placed in <tt>/etc/skel</>.
  768. <p>
  769. <tt>/etc/skel</> should be as empty as we can make it. This is
  770. particularly true because there is no easy mechanism for ensuring that
  771. the appropriate dotfiles are copied into the accounts of existing
  772. users when a package is installed.
  773. <p>
  774. Ideally the sysadmin should ideally not have to do any configuration
  775. other than that done (semi-)automatically by the postinst script.
  776. <sect id="mail">Mail processing on Debian systems
  777. <p>
  778. Debian packages which process electronic mail, whether
  779. mail-user-agents (MUAs) or mail-transport-agents (MTAs), <em/must/
  780. make sure that they are compatible with the configuration decisions
  781. below. Failure to do this may result in lost mail, broken <tt/From:/
  782. lines, and other serious brain damage!
  783. <p>
  784. The mail spool is <tt>/var/spool/mail</> and the interface to send a
  785. mail message is <tt>/usr/sbin/sendmail</> (as per the FSSTND). The
  786. mail spool is part of the base system and not part of the MTA package.
  787. <p>
  788. Mailboxes are locked using the <tt/<var/username/.lock/ lockfile
  789. convention, rather than <prgn/fcntl/, <prgn/flock/ or <prgn/lockf/.
  790. <p>
  791. Mailboxes are generally 660 <tt/<var/user/.mail/ unless the user has
  792. chosen otherwise. A MUA may remove a mailbox (unless it has
  793. nonstandard permissions) in which case the MTA or another MUA must
  794. recreate it if needed. Mailboxes must be writeable by group mail.
  795. <p>
  796. The mail spool is 2775 <tt/mail.mail/, and MUA's need to be setgid
  797. mail to do the locking mentioned above (and obviously need to avoid
  798. accessing other users' mailboxes using this privilege).
  799. <p>
  800. <tt>/etc/aliases</> is the source file for the system mail aliases
  801. (e.g. postmaster, usenet, etc.) - it is the one which the sysadmin
  802. and postinst scripts may edit. After <tt>/etc/aliases</> is edited
  803. the program or human editing it must call <prgn/newaliases/. All MTA
  804. packages should come with a <prgn/newaliases/ program, even if it does
  805. nothing, but older MTA packages do not do this so programs should not
  806. fail if <prgn/newaliases/ cannot be found.
  807. <p>
  808. The convention of writing <tt/forward to <var/address// in the mailbox
  809. itself is not supported. Use a <tt/.forward/ file instead.
  810. <p>
  811. The location for the <prgn/rmail/ program used by UUCP for incoming
  812. mail is <tt>/usr/sbin/rmail</>, as per the FSSTND. Likewise,
  813. <prgn/rsmtp/, for receiving batch-SMTP-over-UUCP, is in
  814. <tt>/usr/sbin/rsmtp</> if it is supported.
  815. <p>
  816. If you need to know what name to use (for example) on outgoing news
  817. and mail messages which are generated locally, you should use the file
  818. <tt>/etc/mailname</>. It will contain the portion after the username
  819. and <tt/@/ (at) sign for email addresses of users on the machine
  820. (followed by a newline).
  821. <p>
  822. A package should check for the existence of this file. If it exists
  823. it should use it without comment.<footnote>An MTA's prompting
  824. configuration script may wish to prompt the user even if it finds this
  825. file exists.</footnote> If it does not exist it should prompt the user
  826. for the value and store it in <tt>/etc/mailname</> as well as using it
  827. in the package's configuration. The prompt should make it clear that
  828. the name will not just be used by that package. E.g., in this
  829. situation the INN package says:
  830. <example>
  831. Please enter the `mail name' of your system. This is the hostname
  832. portion of the address to be shown on outgoing news and mail messages.
  833. The default is <var/syshostname/, your system's host name.
  834. Mail name [`<var/syshostname/']:
  835. </example>
  836. where <var/syshostname/ is the output of <tt/hostname -fqdn/.
  837. <sect>Packages which can use the X shared libraries
  838. <p>
  839. Some programs can be configured with or without support for X Windows.
  840. Typically these binaries produced when configured for X will need the
  841. X shared libraries to run.
  842. <p>
  843. Such programs should be configured <em/with/ X support, and should
  844. declare a dependency on <tt/elf-x11r6lib/ (for the X11R6 libraries).
  845. Users who wish to use the program can install just the relatively
  846. small <tt/xlib/ package, and do not need to install the whole of X.
  847. <p>
  848. Do not create two versions (one with X support and one without) of
  849. your package.
  850. <sect>Games
  851. <p>
  852. The permissions on /var/lib/games are 755 <tt/root.root/.
  853. <p>
  854. Each game decides on its own security policy.
  855. <p>
  856. Games which require protected, privileged access to high-score files,
  857. savegames, &amp;c, must be made set-<em/group/-id (mode 2755) and
  858. owned by <tt/root.games/, and use files and directories with
  859. appropriate permissions (770 <tt/root.games/, for example). They must
  860. <em/not/ be made set-<em/user/-id, as this causes security
  861. problems.<footnote>If an attacker can subvert any set-user-id game
  862. they can overwrite the executable of any other, causing other players
  863. of these cames to run a trojan. With a set-group-id game the attacker
  864. only gets access to less important game data, and if they can get at
  865. the other players' accounts at all it will take considerably more
  866. effort.</footnote>
  867. <p>
  868. Some packages, for example some fortune cookie programs, are
  869. configured by the upstream authors to install with their data files or
  870. other static information made unreadable so that they can only be
  871. accessed through set-id programs provided. Do not do this in a Debian
  872. package: anyone can download the <tt/.deb/ file and read the data from
  873. it, so there is no point making the files unreadable. Not making the
  874. files unreadable also means that you don't have to make so many
  875. programs set-id, which reduces the risk of a security hole.
  876. <sect>Allocating package-specific users and groups
  877. <p>
  878. If you need to create a new user or group for your package there are
  879. two possibilities. Firstly, you may need to make some files in the
  880. binary package be owned by this user or group, or you may need to
  881. compile the user or group id (rather than just the name) into the
  882. binary (though this latter should be avoided if possible). In this
  883. case you need a statically allocated id.
  884. <p>
  885. You must ask for a user or group id from the base system maintainer,
  886. and must not release the package until you have been allocated one.
  887. Once you have been allocated one you must make the package depend
  888. on a version of the base system with the id present in
  889. <tt>/etc/passwd</tt> or <tt>/etc/group</tt>, or alternatively arrange
  890. for your package to create the user or group itself with the correct
  891. id (using <tt/adduser/) in its pre- or post-installation script (the
  892. latter is to be preferred if it is possible).
  893. <p>
  894. On the other hand, the program may able to determine the uid or gid
  895. from the group name at runtime, so that a dynamic id can be used. In
  896. this case you must choose an appropriate user or group name,
  897. discussing this on <prgn/debian-devel/ and checking with the base system
  898. maintainer that it is unique and that they do not wish you to use a
  899. statically allocated id instead. When this has been checked you must
  900. arrange for your package to create the user or group if necessary
  901. using <prgn/adduser/ in the pre- or post-installation script (again, the
  902. latter is to be preferred if it is possible).
  903. <p>
  904. Note that changing the numeric value of an id associated with a name
  905. is very difficult, and involves searching the filesystem for all
  906. appropriate files. You need to think carefully whether a static or
  907. dynamic id is required, since changing your mind later will cause
  908. problems.
  909. <chapt id="sourcepkg">Source package
  910. <sect>Releases of packages by other than the usual Debian maintainer
  911. <p>
  912. Under certain circumstances it is necessary for someone other than the
  913. usual package maintainer to make a release of a package. For example,
  914. a porter for another architecture may have to make some small changes
  915. to the source package and does not wish to wait with uploading their
  916. release until the main maintainer has incorporated the patch, or a
  917. serious security problem may have come to light requiring immediate
  918. attention.
  919. <p>
  920. Maintainers other than the usual package maintainer should make as few
  921. changes to the package as possible, and they should always send a
  922. unified context diff (<tt/diff -u/) detailing their changes to the bug
  923. tracking system properly flagged with the correct package so that the
  924. usual maintainer is kept aware of the situation.
  925. <p>
  926. When someone other than the usual maintainer releases a package they
  927. should add a new component to the <var/debian-revision/ component of
  928. the version number - that is, the portion after the (last) hyphen.
  929. This extra component will start at <tt/1/. This is to avoid
  930. `stealing' one of the usual maintainer's version numbers, possibly
  931. disrupting their work. If there is no <var/debian-revision/ component
  932. in the version number then one should be created, starting at <tt/1/.
  933. <p>
  934. If it is absolutely necessary for someone other than the usual
  935. maintainer to make a release based on a new upstream version then the
  936. person making the release should start with the <var/debian-revision/
  937. value <tt/0.1/. The usual maintainer of a package should start their
  938. <var/debian-revision/ numbering at <tt/1/.
  939. <sect>Standards conformance and <tt/Standards-Version/
  940. <p>
  941. You should specify the most recent version of the packaging standards
  942. with which your package complies in the source package's
  943. <tt/Standards-Version/ field.
  944. <p>
  945. This value will be used to file bug reports automatically if your
  946. package becomes too much out of date.
  947. <p>
  948. The value corresponds to a version of the Debian manuals, as can be
  949. found on the title page or page headers and footers (depending on the
  950. format). The value for this version of the manuals and packaging
  951. standards is <tt/&manuals-version;/.
  952. <p>
  953. The version number has four components - major and minor number and
  954. major and minor patchlevel. When the standards change in a way that
  955. requires every package to change the major number will be changed.
  956. Significant changes that will require work in many packages will be
  957. signaled by a change to the minor number. The major patchlevel will
  958. be changed for any change to the meaning of the standards, however
  959. small; the minor patchlevel will be changed when only cosmetic,
  960. typographical or other edits which do not change the meaning are made,
  961. or changes which do not affect the contents of packages.
  962. <p>
  963. You should regularly, and especially if your package has become out of
  964. date, install the most recent version of dpkg and read
  965. <tt>/usr/doc/dpkg/changelog-manuals</> to see which changes, if any,
  966. are relevant. If any are relevant you should look up the relevant
  967. section in the policy or programmers' manuals and update your package.
  968. When your package complies with the new standards you may update the
  969. <tt/Standards-Version/ source package field and release it.
  970. <sect>Documentation and the <tt/changelog/
  971. <p>
  972. Document your changes and updates to the source package properly in
  973. the <tt>debian/changelog</tt> file.
  974. <p>
  975. A copy of the file which will be installed in
  976. <tt>/usr/doc/<var/package//copyright</tt> should be in
  977. <tt>debian/copyright</tt>.
  978. <p>
  979. In non-experimental packages you may only use a format for
  980. <tt>debian/changelog</> which is supported by the most recent released
  981. version of <prgn/dpkg/. If your format is not supported and there is
  982. general support for it you should contact the <prgn/dpkg/ maintainer
  983. to have the parser script for your format included in the <prgn/dpkg/
  984. package.<footnote>You will need to agree that the parser and its
  985. manpage may be distributed under the GNU GPL, just as the rest of
  986. <prgn/dpkg/ is.</footnote>
  987. <sect>Changes to the upstream sources
  988. <p>
  989. If you need to edit a <prgn/Makefile/ where GNU-style <prgn/configure/
  990. scripts are used, you should edit the <tt/.in/ files rather than
  991. editing the <prgn/Makefile/ directly. This allows the user to
  992. reconfigure the package if necessary. You should <em/not/ configure
  993. the package and edit the generated <prgn/Makefile/! This makes it
  994. impossible for someone else to later reconfigure the package.
  995. <p>
  996. If changes to the source code are made that are generally applicable
  997. please try to get them included in the upstream version of the package
  998. by supplying the upstream authors with the changes in whatever form
  999. they prefer.
  1000. <p>
  1001. If you need to configure the package differently for Debian or for
  1002. Linux, and the upstream source doesn't provide a way to configure it
  1003. the way you need to, please add such configuration facilities (for
  1004. example, a new <prgn/autoconf/ test or <tt/#define/) and send the
  1005. patch to the upstream authors, with the default set to the way they
  1006. originally had it. You can then easily override the default in your
  1007. <tt>debian/rules</tt> or wherever is appropriate.
  1008. <sect>Error trapping in makefiles
  1009. <p>
  1010. When <prgn/make/ invokes a command in a makefile (including your
  1011. package's upstream makefiles and the <tt>debian/rules</>) it does so
  1012. using <tt/sh/. This means that <tt/sh/'s usual bad error handling
  1013. properties apply: if you include a miniature script as one of the
  1014. commands in your makefile you'll find that if you don't do anything
  1015. about it then errors are not detected and <prgn/make/ will blithely
  1016. continue after problems.
  1017. <p>
  1018. Every time you put more than one shell command (this includes using a
  1019. loop) in a makefile command you <em/must/ make sure that errors are
  1020. trapped. For simple compound commands, such as changing directory and
  1021. then running a program, using <tt/&amp;&amp;/ rather than semicolon as
  1022. a command separator is sufficient. For more complex commands
  1023. including most loops and conditionals you must include a separate
  1024. <tt/set -e/ command at the start of every makefile command that's
  1025. actually one of these miniature shellscripts.
  1026. <chapt id="developer">Procedure - how to participate in the Debian project
  1027. <sect>Before you start work on a package
  1028. <p>
  1029. So, you've read all the documentation, you understand what everything
  1030. in the <prgn/hello/ example package is for, and you're about to
  1031. Debianise your favourite package. How do you actually become a Debian
  1032. developer so that your work can be incorporated into the Project?
  1033. <p>
  1034. Firstly, subscribe to <prgn/debian-devel/ if you haven't already.
  1035. Send the word <tt/subscribe/ in the <em/Subject/ of a mail to
  1036. <email/debian-devel-REQUEST@lists.debian.org/. In case of problems
  1037. contact the list administrator, Anders Chrigstrom <email/ac@netg.se/.
  1038. <p>
  1039. You should to subscribe and lurk for a bit before doing any coding,
  1040. and you should post about your intentions to work on something to
  1041. avoid duplicated effort.
  1042. <p>
  1043. If you do not have a PGP key yet generate one. You should probably
  1044. read the PGP manual, as it has much important information which is
  1045. critical to its security. Many more security failures are due to
  1046. human error than to software failure or high-powered spy techniques.
  1047. <p>
  1048. If you live in a country where use of cryptography even for signing is
  1049. forbidden then please contact us so we can make special arrangements.
  1050. This does not apply in France, where I believe only encryption and not
  1051. signing is forbidden.
  1052. <sect>When you have a package to upload
  1053. <p>
  1054. When you have your package ready to be uploaded you must send a
  1055. message to the project leader, Bruce Perens <email/bruce@pixar.com/,
  1056. the administrator of <tt/master.debian.org/, Simon Shapiro
  1057. <email/shimon@i-connect.net/, the mailing list administrator, Anders
  1058. Chrigstrom <email/ac@netg.se/ and the <prgn/dpkg/ maintainer, Ian
  1059. Jackson <email/ijackson@gnu.ai.mit.edu/.
  1060. <p>
  1061. The message should say what you've done and who you are, and should
  1062. ask for an account on <prgn/master/ and to be subscribed to
  1063. <prgn/debian-private/ (the developers-only mailing list). It should
  1064. contain your PGP key (extracted using <tt/pgp -kxa/) for the database
  1065. of keys which is shipped with <prgn/dpkg/.
  1066. When you have your personal account on <prgn/master/ log in and
  1067. transfer the files to
  1068. <tt>/home/Debian/ftp/private/project/Incoming</>. You cannot upload
  1069. to <prgn/Incoming/ on <prgn/master/ using anonymous FTP.
  1070. <p>
  1071. You can also upload files to <prgn/Incoming/ via a <prgn/cron/-driven
  1072. upload queue in Europe on <ftpsite/chiark.chu.cam.ac.uk/. For details
  1073. connect to <prgn/chiark/ using anonymous FTP and read
  1074. <ftppath>/pub/debian/private/project/README.how-to-upload</ftppath>.
  1075. <sect id="changesfiles">Upload handling - <tt/.changes/ files
  1076. <p>
  1077. When a package is uploaded to the Debian FTP archive, it must be
  1078. accompanied by a <tt/.changes/ file which gives directions for its
  1079. handling. This is usually generated by <prgn/dpkg-genchanges/.
  1080. <p>
  1081. This file is a control file with the following fields:
  1082. <list compact>
  1083. <item><tt/Format/
  1084. <item><tt/Date/
  1085. <item><tt/Source/
  1086. <item><tt/Binary/
  1087. <item><tt/Architecture/
  1088. <item><tt/Version/
  1089. <item><tt/Distribution/
  1090. <item><tt/Urgency/
  1091. <item><tt/Maintainer/
  1092. <item><tt/Description/
  1093. <item><tt/Changes/
  1094. <item><tt/Files/
  1095. </list>
  1096. <p>
  1097. All of them are mandatory for a Debian upload. See the list of
  1098. control fields in the <prgn/dpkg/ programmers' manual for the contents
  1099. of these fields.
  1100. <p>
  1101. The first time a version is uploaded which corresponds to a particular
  1102. upstream version the original source tarfile should be uploaded and
  1103. included in the <tt/.changes/ file; subsequent times the very same
  1104. tarfile should be used to build the new diffs and <tt/.dsc/ files, and
  1105. it need not then be uploaded.
  1106. <p>
  1107. By default <prgn/dpkg-genchanges/ and <prgn/dpkg-buildpackage/ will
  1108. include the original source tarfile if and only if the Debian revision
  1109. part of the source version number is <tt/0/ or <tt/1/, indicating a
  1110. new upstream version. This behaviour may be modified by using
  1111. <tt/-sa/ to always include it or <tt/-sd/ to always leave it out.
  1112. <p>
  1113. If no original source is included in the upload then the original
  1114. source tarfile used by <prgn/dpkg-source/ when constructing the
  1115. <tt/.dsc/ file and diff to be uploaded <em/must/ be byte-for-byte
  1116. identical with the one already in the archive. If there is some
  1117. reason why this is not the case then the new version of the original
  1118. source should be uploaded, possibly by using the <tt/-sa/ flag.
  1119. <sect id="mailinglists">The Debian mailing lists
  1120. <p>
  1121. The mailing list server is at <tt/lists.debian.org/. Mail
  1122. <tt/debian-<var/foo/-REQUEST@lists.debian.org/<footnote>where
  1123. <tt/debian-<var/foo// is the name of the list</footnote> with the word
  1124. <tt/subscribe/ in the Subject to subscribe or <tt/unsubscribe/ to
  1125. unsubscribe.
  1126. <p>
  1127. When replying to messages on the mailing list, please do not send a
  1128. carbon copy (<tt/CC/ - this does not mean `courtesy copy') to the
  1129. original poster. Anyone who posts to a mailing list should read it to
  1130. see the responses.
  1131. <p>
  1132. As ever on the net, please trim down the quoting of articles you're
  1133. replying to. In general, please adhere to the usual conventions for
  1134. posting messages.
  1135. <chapt id="conversion">Conversion procedure from old source packages
  1136. <p>
  1137. This is a brief summary of the procedure for converting a
  1138. pre-2.0.0.0-format source package into the new format.
  1139. <p>
  1140. You are strongly advised to download and examine the <prgn/hello/
  1141. package, and to read the section in the <prgn/dpkg/ programmers'
  1142. manual describing the source packaging tools. More detail about the
  1143. exact functionality of these tools is available in <manref
  1144. name=dpkg-source section=1>.
  1145. <p>
  1146. <list>
  1147. <item>
  1148. Download the original source code from wherever it can be found and do
  1149. any rearrangement required to make it look like the original tree of
  1150. the Debian source. Put it in
  1151. <tt><var/package/-<var/upstream-version/.orig/</> or
  1152. <tt/<var/package/_<var/upstream-version/.orig.tar.gz/.
  1153. <item>
  1154. Rename all files <tt/debian.*/ to <tt>debian/*</>. There may be some
  1155. exceptions to this, but this is a good start.
  1156. <item>
  1157. Edit the <tt>debian/changelog</> - create or rename it if necessary.
  1158. Add a new revision to the top with the appropriate details, and a
  1159. local variables entry to the bottom to set Emacs to the right mode:
  1160. <example>
  1161. Local variables:
  1162. mode: debian-changelog
  1163. End:
  1164. </example>
  1165. <item>
  1166. Edit/create <tt>debian/control</>:
  1167. <list compact>
  1168. <item>
  1169. Remove the <tt/Version/ field. If it is generated unusually (not
  1170. equal to the source version) you must use the -v option to
  1171. dpkg-gencontrol (see below). <tt/Section/, <tt/Priority/,
  1172. <tt/Maintainer/ go above the first blank line, most of the rest below.
  1173. <item>
  1174. Reorder the fields and add a blank line at an appropriate point,
  1175. separating the source package fields from the binary package
  1176. fields.
  1177. <item>
  1178. Add the <tt/Source/ field.
  1179. <item>
  1180. Add the <tt/Standards-Version/ field. The current value is
  1181. <tt/&manuals-version;/.
  1182. <item>
  1183. Change the <tt/Architecture/ field for each package to <tt/any/,
  1184. <tt/all/ or whatever. If there isn't an <tt/Architecture/ field add
  1185. one.
  1186. <item>
  1187. If any other seddery or things used to happen to make the binary
  1188. control files use <prgn/dpkg-gencontrol/'s variable substitution
  1189. features to achieve the same effect. Use <tt>debian/substvars</> if
  1190. you need to put unusally-generated information (apart from details of
  1191. <tt/.deb/ files) in the <tt/.changes/ file too.
  1192. </list>
  1193. <item>
  1194. Edit the <tt>debian/rules</>:
  1195. <list compact>
  1196. <item>
  1197. Remove the <prgn/source/ and <prgn/diff/ and any <prgn/changes/ and
  1198. <prgn/dist/ targets. These things now happen in a package-independent
  1199. way and are not done by <tt>debian/rules</>.
  1200. <item>
  1201. Split the <prgn/binary/ target into <prgn/binary-arch/ and
  1202. <prgn/binary-indep/; in many cases all of <prgn/binary/ should go into
  1203. <prgn/binary-arch/. Create the <prgn/binary/ target and the unused of
  1204. the two other <prgn/binary-*/ targets if there is one - you can copy
  1205. the ones from the <prgn/hello/ package.
  1206. <item>
  1207. Change the <prgn/binary/ target to use <prgn/dpkg-gencontrol/ to make
  1208. the package control file(s). Move it to after all the files have been
  1209. installed but just before the last <prgn/chown/ and <prgn/chmod/ in
  1210. the target.
  1211. <item>
  1212. Change occurrences of <tt/debian-tmp/ to <tt>debian/tmp</>.
  1213. <item>
  1214. Change occurrences of <tt/debian.{post,pre}{inst,rm}/ to
  1215. <tt>debian/*</>.
  1216. <item>
  1217. Remove the version number setting at the top, if there is one.
  1218. <item>
  1219. Ensure that the package's Debian-specific and upstream changelogs are
  1220. installed.
  1221. </list>
  1222. <item>
  1223. Check that the <tt>debian/README</> is really the copyright file, and
  1224. if so rename it to <tt>debian/copyright</> and edit
  1225. <tt>debian/rules</> to cope with this and to change the installation
  1226. of the copyright file from <tt>/usr/doc/<var/package//copyright</>
  1227. instead of <tt>/usr/doc/copyright/<var/package/</>. If it isn't then
  1228. find <tt>debian/copyright</> and decide what to do with the
  1229. <tt>README</>.
  1230. <item>
  1231. Check for various other anachronisms and problems:
  1232. <list compact>
  1233. <item>
  1234. Remove any <tt/Package_Revision/, <tt/Package-Revision/ or
  1235. <tt/Revision/ fields.
  1236. <item>
  1237. Rename <tt/Optional/ to <tt/Suggests/, <tt/Recommended/ to
  1238. <tt/Recommends/.
  1239. <item>
  1240. Change <tt>/usr/doc/examples/<var/package/</> to
  1241. <tt>/usr/doc/<var/package//examples</>.
  1242. <item>
  1243. Make sure that manpages are installed compressed.
  1244. <item>
  1245. Check that the description has an extended description, is
  1246. well-formatted and meaningful and helpful to people wanting to know
  1247. whether to install a package.
  1248. </list>
  1249. <item>
  1250. Look everything over.
  1251. <item>
  1252. Do a test build using <tt/dpkg-buildpackage -ur -uc -sa
  1253. -r<var/whatever//. Check the permissions and locations of files in
  1254. the resulting package by eyeballing the output of <tt/dpkg-deb
  1255. --contents/, and check that the source build happened OK. Test
  1256. install the binary package(s) and test extract the source package(s).
  1257. <item>
  1258. Sign the release: either rebuild everything with <tt/dpkg-buildpackage
  1259. -sa/, or PGP-sign the <tt/.dsc/, rebuild the <tt/.changes/ using
  1260. <tt/dpkg-genchanges -sa/, and then PGP-sign the <tt/.changes/.
  1261. </list>
  1262. <p>
  1263. The use of <tt/-sa/ on <prgn/dpkg-buildpackage/ and
  1264. <prgn/dpkg-genchanges/ is important when doing the first
  1265. build/uploading of a new-format source package. Unless this happens
  1266. to be Debian revision <tt/0/ or <tt/1/ by default the original source
  1267. tarfile will not be included in the uploaded files listed in the
  1268. <tt/.changes/ file, and so it won't be installed on the FTP site.
  1269. <tt/-sa/ requests that the original source be included regardless.
  1270. </book>