You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

572 lines
22 KiB

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