apt-ftparchive.1.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY % aptent SYSTEM "apt.ent">
  5. %aptent;
  6. ]>
  7. <refentry>
  8. &apt-docinfo;
  9. <refmeta>
  10. <refentrytitle>apt-ftparchive</refentrytitle>
  11. <manvolnum>1</manvolnum>
  12. </refmeta>
  13. <!-- Man page title -->
  14. <refnamediv>
  15. <refname>apt-ftparchive</refname>
  16. <refpurpose>Utility to generate index files</refpurpose>
  17. </refnamediv>
  18. <!-- Arguments -->
  19. <refsynopsisdiv>
  20. <cmdsynopsis>
  21. <command>apt-ftparchive</command>
  22. <arg><option>-hvdsq</option></arg>
  23. <arg><option>--md5</option></arg>
  24. <arg><option>--delink</option></arg>
  25. <arg><option>--readonly</option></arg>
  26. <arg><option>--contents</option></arg>
  27. <arg><option>-o=<replaceable>config string</replaceable></option></arg>
  28. <arg><option>-c=<replaceable>file</replaceable></option></arg>
  29. <group choice="req">
  30. <arg>packages<arg choice="plain" rep="repeat"><replaceable>path</replaceable></arg><arg><replaceable>override</replaceable><arg><replaceable>pathprefix</replaceable></arg></arg></arg>
  31. <arg>sources<arg choice="plain" rep="repeat"><replaceable>path</replaceable></arg><arg><replaceable>override</replaceable><arg><replaceable>pathprefix</replaceable></arg></arg></arg>
  32. <arg>contents <arg choice="plain"><replaceable>path</replaceable></arg></arg>
  33. <arg>release <arg choice="plain"><replaceable>path</replaceable></arg></arg>
  34. <arg>generate <arg choice="plain"><replaceable>config-file</replaceable></arg> <arg choice="plain" rep="repeat"><replaceable>section</replaceable></arg></arg>
  35. <arg>clean <arg choice="plain"><replaceable>config-file</replaceable></arg></arg>
  36. </group>
  37. </cmdsynopsis>
  38. </refsynopsisdiv>
  39. <refsect1><title>Description</title>
  40. <para><command>apt-ftparchive</command> is the command line tool that generates the index
  41. files that APT uses to access a distribution source. The index files should
  42. be generated on the origin site based on the content of that site.</para>
  43. <para><command>apt-ftparchive</command> is a superset of the &dpkg-scanpackages; program,
  44. incorporating its entire functionality via the <literal>packages</literal> command.
  45. It also contains a contents file generator, <literal>contents</literal>, and an
  46. elaborate means to 'script' the generation process for a complete
  47. archive.</para>
  48. <para>Internally <command>apt-ftparchive</command> can make use of binary databases to
  49. cache the contents of a .deb file and it does not rely on any external
  50. programs aside from &gzip;. When doing a full generate it automatically
  51. performs file-change checks and builds the desired compressed output files.</para>
  52. <para>Unless the <option>-h</option>, or <option>--help</option> option is given one of the
  53. commands below must be present.</para>
  54. <variablelist>
  55. <varlistentry><term>packages</term>
  56. <listitem><para>
  57. The packages command generates a package file from a directory tree. It
  58. takes the given directory and recursively searches it for .deb files,
  59. emitting a package record to stdout for each. This command is
  60. approximately equivalent to &dpkg-scanpackages;.</para>
  61. <para>The option <option>--db</option> can be used to specify a binary caching DB.</para></listitem>
  62. </varlistentry>
  63. <varlistentry><term>sources</term>
  64. <listitem><para>
  65. The <literal>sources</literal> command generates a source index file from a directory tree.
  66. It takes the given directory and recursively searches it for .dsc files,
  67. emitting a source record to stdout for each. This command is approximately
  68. equivalent to &dpkg-scansources;.</para>
  69. <para>
  70. If an override file is specified then a source override file will be
  71. looked for with an extension of .src. The --source-override option can be
  72. used to change the source override file that will be used.</para></listitem>
  73. </varlistentry>
  74. <varlistentry><term>contents</term>
  75. <listitem><para>
  76. The <literal>contents</literal> command generates a contents file from a directory tree. It
  77. takes the given directory and recursively searches it for .deb files,
  78. and reads the file list from each file. It then sorts and writes to stdout
  79. the list of files matched to packages. Directories are not written to
  80. the output. If multiple packages own the same file then each package is
  81. separated by a comma in the output.</para>
  82. <para>
  83. The option <option>--db</option> can be used to specify a binary caching DB.</para></listitem>
  84. </varlistentry>
  85. <varlistentry><term>release</term>
  86. <listitem><para>
  87. The <literal>release</literal> command generates a Release file from a
  88. directory tree. It recursively searches the given directory for
  89. Packages, Packages.gz, Packages.bz2, Sources, Sources.gz,
  90. Sources.bz2, Release and md5sum.txt files. It then writes to
  91. stdout a Release file containing an MD5 digest and SHA1 digest
  92. for each file.</para>
  93. <para>
  94. Values for the additional metadata fields in the Release file are
  95. taken from the corresponding variables under
  96. <literal>APT::FTPArchive::Release</literal>,
  97. e.g. <literal>APT::FTPArchive::Release::Origin</literal>. The supported fields
  98. are: <literal>Origin</literal>, <literal>Label</literal>, <literal>Suite</literal>,
  99. <literal>Version</literal>, <literal>Codename</literal>, <literal>Date</literal>,
  100. <literal>Architectures</literal>, <literal>Components</literal>, <literal>Description</literal>.</para></listitem>
  101. </varlistentry>
  102. <varlistentry><term>generate</term>
  103. <listitem><para>
  104. The <literal>generate</literal> command is designed to be runnable from a cron script and
  105. builds indexes according to the given config file. The config language
  106. provides a flexible means of specifying which index files are built from
  107. which directories, as well as providing a simple means of maintaining the
  108. required settings.</para></listitem>
  109. </varlistentry>
  110. <varlistentry><term>clean</term>
  111. <listitem><para>
  112. The <literal>clean</literal> command tidies the databases used by the given
  113. configuration file by removing any records that are no longer necessary.</para></listitem>
  114. </varlistentry>
  115. </variablelist>
  116. </refsect1>
  117. <refsect1><title>The Generate Configuration</title>
  118. <para>
  119. The <literal>generate</literal> command uses a configuration file to describe the
  120. archives that are going to be generated. It follows the typical ISC
  121. configuration format as seen in ISC tools like bind 8 and dhcpd.
  122. &apt-conf; contains a description of the syntax. Note that the generate
  123. configuration is parsed in sectional manner, but &apt-conf; is parsed in a
  124. tree manner. This only effects how the scope tag is handled.</para>
  125. <para>
  126. The generate configuration has 4 separate sections, each described below.</para>
  127. <refsect2><title>Dir Section</title>
  128. <para>
  129. The <literal>Dir</literal> section defines the standard directories needed to
  130. locate the files required during the generation process. These
  131. directories are prepended to certain relative paths defined in later
  132. sections to produce a complete an absolute path.</para>
  133. <variablelist>
  134. <varlistentry><term>ArchiveDir</term>
  135. <listitem><para>
  136. Specifies the root of the FTP archive, in a standard
  137. Debian configuration this is the directory that contains the
  138. <filename>ls-LR</filename> and dist nodes.</para></listitem>
  139. </varlistentry>
  140. <varlistentry><term>OverrideDir</term>
  141. <listitem><para>
  142. Specifies the location of the override files.</para></listitem>
  143. </varlistentry>
  144. <varlistentry><term>CacheDir</term>
  145. <listitem><para>
  146. Specifies the location of the cache files</para></listitem>
  147. </varlistentry>
  148. <varlistentry><term>FileListDir</term>
  149. <listitem><para>
  150. Specifies the location of the file list files,
  151. if the <literal>FileList</literal> setting is used below.</para></listitem>
  152. </varlistentry>
  153. </variablelist>
  154. </refsect2>
  155. <refsect2><title>Default Section</title>
  156. <para>
  157. The <literal>Default</literal> section specifies default values, and settings
  158. that control the operation of the generator. Other sections may override
  159. these defaults with a per-section setting.</para>
  160. <variablelist>
  161. <varlistentry><term>Packages::Compress</term>
  162. <listitem><para>
  163. Sets the default compression schemes to use
  164. for the Package index files. It is a string that contains a space
  165. separated list of at least one of: '.' (no compression), 'gzip' and
  166. 'bzip2'. The default for all compression schemes is '. gzip'.</para></listitem>
  167. </varlistentry>
  168. <varlistentry><term>Packages::Extensions</term>
  169. <listitem><para>
  170. Sets the default list of file extensions that are package files.
  171. This defaults to '.deb'.</para></listitem>
  172. </varlistentry>
  173. <varlistentry><term>Sources::Compress</term>
  174. <listitem><para>
  175. This is similar to <literal>Packages::Compress</literal>
  176. except that it controls the compression for the Sources files.</para></listitem>
  177. </varlistentry>
  178. <varlistentry><term>Sources::Extensions</term>
  179. <listitem><para>
  180. Sets the default list of file extensions that are source files.
  181. This defaults to '.dsc'.</para></listitem>
  182. </varlistentry>
  183. <varlistentry><term>Contents::Compress</term>
  184. <listitem><para>
  185. This is similar to <literal>Packages::Compress</literal>
  186. except that it controls the compression for the Contents files.</para></listitem>
  187. </varlistentry>
  188. <varlistentry><term>DeLinkLimit</term>
  189. <listitem><para>
  190. Specifies the number of kilobytes to delink (and
  191. replace with hard links) per run. This is used in conjunction with the
  192. per-section <literal>External-Links</literal> setting.</para></listitem>
  193. </varlistentry>
  194. <varlistentry><term>FileMode</term>
  195. <listitem><para>
  196. Specifies the mode of all created index files. It
  197. defaults to 0644. All index files are set to this mode with no regard
  198. to the umask.</para></listitem>
  199. </varlistentry>
  200. </variablelist>
  201. </refsect2>
  202. <refsect2><title>TreeDefault Section</title>
  203. <para>
  204. Sets defaults specific to <literal>Tree</literal> sections. All of these
  205. variables are substitution variables and have the strings $(DIST),
  206. $(SECTION) and $(ARCH) replaced with their respective values.</para>
  207. <variablelist>
  208. <varlistentry><term>MaxContentsChange</term>
  209. <listitem><para>
  210. Sets the number of kilobytes of contents
  211. files that are generated each day. The contents files are round-robined
  212. so that over several days they will all be rebuilt.</para></listitem>
  213. </varlistentry>
  214. <varlistentry><term>ContentsAge</term>
  215. <listitem><para>
  216. Controls the number of days a contents file is allowed
  217. to be checked without changing. If this limit is passed the mtime of the
  218. contents file is updated. This case can occur if the package file is
  219. changed in such a way that does not result in a new contents file
  220. [override edit for instance]. A hold off is allowed in hopes that new
  221. .debs will be installed, requiring a new file anyhow. The default is 10,
  222. the units are in days.</para></listitem>
  223. </varlistentry>
  224. <varlistentry><term>Directory</term>
  225. <listitem><para>
  226. Sets the top of the .deb directory tree. Defaults to
  227. <filename>$(DIST)/$(SECTION)/binary-$(ARCH)/</filename></para></listitem>
  228. </varlistentry>
  229. <varlistentry><term>SrcDirectory</term>
  230. <listitem><para>
  231. Sets the top of the source package directory tree. Defaults to
  232. <filename>$(DIST)/$(SECTION)/source/</filename></para></listitem>
  233. </varlistentry>
  234. <varlistentry><term>Packages</term>
  235. <listitem><para>
  236. Sets the output Packages file. Defaults to
  237. <filename>$(DIST)/$(SECTION)/binary-$(ARCH)/Packages</filename></para></listitem>
  238. </varlistentry>
  239. <varlistentry><term>Sources</term>
  240. <listitem><para>
  241. Sets the output Packages file. Defaults to
  242. <filename>$(DIST)/$(SECTION)/source/Sources</filename></para></listitem>
  243. </varlistentry>
  244. <varlistentry><term>InternalPrefix</term>
  245. <listitem><para>
  246. Sets the path prefix that causes a symlink to be
  247. considered an internal link instead of an external link. Defaults to
  248. <filename>$(DIST)/$(SECTION)/</filename></para></listitem>
  249. </varlistentry>
  250. <varlistentry><term>Contents</term>
  251. <listitem><para>
  252. Sets the output Contents file. Defaults to
  253. <filename>$(DIST)/Contents-$(ARCH)</filename>. If this setting causes multiple
  254. Packages files to map onto a single Contents file (such as the default)
  255. then <command>apt-ftparchive</command> will integrate those package files
  256. together automatically.</para></listitem>
  257. </varlistentry>
  258. <varlistentry><term>Contents::Header</term>
  259. <listitem><para>
  260. Sets header file to prepend to the contents output.</para></listitem>
  261. </varlistentry>
  262. <varlistentry><term>BinCacheDB</term>
  263. <listitem><para>
  264. Sets the binary cache database to use for this
  265. section. Multiple sections can share the same database.</para></listitem>
  266. </varlistentry>
  267. <varlistentry><term>FileList</term>
  268. <listitem><para>
  269. Specifies that instead of walking the directory tree,
  270. <command>apt-ftparchive</command> should read the list of files from the given
  271. file. Relative files names are prefixed with the archive directory.</para></listitem>
  272. </varlistentry>
  273. <varlistentry><term>SourceFileList</term>
  274. <listitem><para>
  275. Specifies that instead of walking the directory tree,
  276. <command>apt-ftparchive</command> should read the list of files from the given
  277. file. Relative files names are prefixed with the archive directory.
  278. This is used when processing source indexs.</para></listitem>
  279. </varlistentry>
  280. </variablelist>
  281. </refsect2>
  282. <refsect2><title>Tree Section</title>
  283. <para>
  284. The <literal>Tree</literal> section defines a standard Debian file tree which
  285. consists of a base directory, then multiple sections in that base
  286. directory and finally multiple Architectures in each section. The exact
  287. pathing used is defined by the <literal>Directory</literal> substitution variable.</para>
  288. <para>
  289. The <literal>Tree</literal> section takes a scope tag which sets the
  290. <literal>$(DIST)</literal> variable and defines the root of the tree
  291. (the path is prefixed by <literal>ArchiveDir</literal>).
  292. Typically this is a setting such as <filename>dists/woody</filename>.</para>
  293. <para>
  294. All of the settings defined in the <literal>TreeDefault</literal> section can be
  295. use in a <literal>Tree</literal> section as well as three new variables.</para>
  296. <para>
  297. When processing a <literal>Tree</literal> section <command>apt-ftparchive</command>
  298. performs an operation similar to:
  299. <informalexample><programlisting>
  300. for i in Sections do
  301. for j in Architectures do
  302. Generate for DIST=scope SECTION=i ARCH=j
  303. </programlisting></informalexample></para>
  304. <variablelist>
  305. <varlistentry><term>Sections</term>
  306. <listitem><para>
  307. This is a space separated list of sections which appear
  308. under the distribution, typically this is something like
  309. <literal>main contrib non-free</literal></para></listitem>
  310. </varlistentry>
  311. <varlistentry><term>Architectures</term>
  312. <listitem><para>
  313. This is a space separated list of all the
  314. architectures that appear under search section. The special architecture
  315. 'source' is used to indicate that this tree has a source archive.</para></listitem>
  316. </varlistentry>
  317. <varlistentry><term>BinOverride</term>
  318. <listitem><para>
  319. Sets the binary override file. The override file
  320. contains section, priority and maintainer address information.</para></listitem>
  321. </varlistentry>
  322. <varlistentry><term>SrcOverride</term>
  323. <listitem><para>
  324. Sets the source override file. The override file
  325. contains section information.</para></listitem>
  326. </varlistentry>
  327. <varlistentry><term>ExtraOverride</term>
  328. <listitem><para>
  329. Sets the binary extra override file.</para></listitem>
  330. </varlistentry>
  331. <varlistentry><term>SrcExtraOverride</term>
  332. <listitem><para>
  333. Sets the source extra override file.</para></listitem>
  334. </varlistentry>
  335. </variablelist>
  336. </refsect2>
  337. <refsect2><title>BinDirectory Section</title>
  338. <para>
  339. The <literal>bindirectory</literal> section defines a binary directory tree
  340. with no special structure. The scope tag specifies the location of
  341. the binary directory and the settings are similar to the <literal>Tree</literal>
  342. section with no substitution variables or
  343. <literal>Section</literal><literal>Architecture</literal> settings.</para>
  344. <variablelist>
  345. <varlistentry><term>Packages</term>
  346. <listitem><para>
  347. Sets the Packages file output.</para></listitem>
  348. </varlistentry>
  349. <varlistentry><term>SrcPackages</term>
  350. <listitem><para>
  351. Sets the Sources file output. At least one of
  352. <literal>Packages</literal> or <literal>SrcPackages</literal> is required.</para></listitem>
  353. </varlistentry>
  354. <varlistentry><term>Contents</term>
  355. <listitem><para>
  356. Sets the Contents file output. (optional)</para></listitem>
  357. </varlistentry>
  358. <varlistentry><term>BinOverride</term>
  359. <listitem><para>
  360. Sets the binary override file.</para></listitem>
  361. </varlistentry>
  362. <varlistentry><term>SrcOverride</term>
  363. <listitem><para>
  364. Sets the source override file.</para></listitem>
  365. </varlistentry>
  366. <varlistentry><term>ExtraOverride</term>
  367. <listitem><para>
  368. Sets the binary extra override file.</para></listitem>
  369. </varlistentry>
  370. <varlistentry><term>SrcExtraOverride</term>
  371. <listitem><para>
  372. Sets the source extra override file.</para></listitem>
  373. </varlistentry>
  374. <varlistentry><term>BinCacheDB</term>
  375. <listitem><para>
  376. Sets the cache DB.</para></listitem>
  377. </varlistentry>
  378. <varlistentry><term>PathPrefix</term>
  379. <listitem><para>
  380. Appends a path to all the output paths.</para></listitem>
  381. </varlistentry>
  382. <varlistentry><term>FileList, SourceFileList</term>
  383. <listitem><para>
  384. Specifies the file list file.</para></listitem>
  385. </varlistentry>
  386. </variablelist>
  387. </refsect2>
  388. </refsect1>
  389. <refsect1><title>The Binary Override File</title>
  390. <para>The binary override file is fully compatible with &dpkg-scanpackages;. It
  391. contains 4 fields separated by spaces. The first field is the package name,
  392. the second is the priority to force that package to, the third is the
  393. the section to force that package to and the final field is the maintainer
  394. permutation field.</para>
  395. <para>The general form of the maintainer field is:
  396. <literallayout>old [// oldn]* => new</literallayout>
  397. or simply,
  398. <literallayout>new</literallayout>
  399. The first form allows a double-slash separated list of old email addresses
  400. to be specified. If any of those are found then new is substituted for the
  401. maintainer field. The second form unconditionally substitutes the
  402. maintainer field.</para>
  403. </refsect1>
  404. <refsect1><title>The Source Override File</title>
  405. <para>
  406. The source override file is fully compatible with &dpkg-scansources;. It
  407. contains 2 fields separated by spaces. The first fields is the source
  408. package name, the second is the section to assign it.</para>
  409. </refsect1>
  410. <refsect1><title>The Extra Override File</title>
  411. <para>
  412. The extra override file allows any arbitrary tag to be added or replaced
  413. in the output. It has 3 columns, the first is the package, the second is
  414. the tag and the remainder of the line is the new value.</para>
  415. </refsect1>
  416. <refsect1><title>options</title>
  417. &apt-cmdblurb;
  418. <variablelist>
  419. <varlistentry><term><option>--md5</option></term>
  420. <listitem><para>
  421. Generate MD5 sums. This defaults to on, when turned off the generated
  422. index files will not have MD5Sum fields where possible.
  423. Configuration Item: <literal>APT::FTPArchive::MD5</literal></para></listitem>
  424. </varlistentry>
  425. <varlistentry><term><option>-d</option></term><term><option>--db</option></term>
  426. <listitem><para>
  427. Use a binary caching DB. This has no effect on the generate command.
  428. Configuration Item: <literal>APT::FTPArchive::DB</literal>.</para></listitem>
  429. </varlistentry>
  430. <varlistentry><term><option>-q</option></term><term><option>--quiet</option></term>
  431. <listitem><para>
  432. Quiet; produces output suitable for logging, omitting progress indicators.
  433. More q's will produce more quiet up to a maximum of 2. You can also use
  434. <option>-q=#</option> to set the quiet level, overriding the configuration file.
  435. Configuration Item: <literal>quiet</literal>.</para></listitem>
  436. </varlistentry>
  437. <varlistentry><term><option>--delink</option></term>
  438. <listitem><para>
  439. Perform Delinking. If the <literal>External-Links</literal> setting is used then
  440. this option actually enables delinking of the files. It defaults to on and
  441. can be turned off with <option>--no-delink</option>.
  442. Configuration Item: <literal>APT::FTPArchive::DeLinkAct</literal>.</para></listitem>
  443. </varlistentry>
  444. <varlistentry><term><option>--contents</option></term>
  445. <listitem><para>
  446. Perform contents generation. When this option is set and package indexes
  447. are being generated with a cache DB then the file listing will also be
  448. extracted and stored in the DB for later use. When using the generate
  449. command this option also allows the creation of any Contents files. The
  450. default is on.
  451. Configuration Item: <literal>APT::FTPArchive::Contents</literal>.</para></listitem>
  452. </varlistentry>
  453. <varlistentry><term><option>-s</option></term><term><option>--source-override</option></term>
  454. <listitem><para>
  455. Select the source override file to use with the <literal>sources</literal> command.
  456. Configuration Item: <literal>APT::FTPArchive::SourceOverride</literal>.</para></listitem>
  457. </varlistentry>
  458. <varlistentry><term><option>--readonly</option></term>
  459. <listitem><para>
  460. Make the caching databases read only.
  461. Configuration Item: <literal>APT::FTPArchive::ReadOnlyDB</literal>.</para></listitem>
  462. </varlistentry>
  463. &apt-commonoptions;
  464. </variablelist>
  465. </refsect1>
  466. <refsect1><title>Examples</title>
  467. <para>To create a compressed Packages file for a directory containing
  468. binary packages (.deb):
  469. <programlisting>
  470. <command>apt-ftparchive</command> packages <replaceable>directory</replaceable> | <command>gzip</command> > <filename>Packages.gz</filename>
  471. </programlisting></para>
  472. </refsect1>
  473. <refsect1><title>See Also</title>
  474. <para>&apt-conf;</para>
  475. </refsect1>
  476. <refsect1><title>Diagnostics</title>
  477. <para><command>apt-ftparchive</command> returns zero on normal operation, decimal 100 on error.</para>
  478. </refsect1>
  479. &manbugs;
  480. &manauthor;
  481. </refentry>