apt-ftparchive.1.xml 24 KB

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