LinuxCommandLibrary

apt-ftparchive

Create APT repository index files

SYNOPSIS

apt-ftparchive [options] <command> [<cmd-options>]
Commands: packages, sources, contents, release, generate, write, sign

PARAMETERS

-c file, --config file
    Read configuration from file instead of /etc/apt/ftparchive.conf.

-d dir, --db dir
    Root directory for package database (default: current dir).

-h, --help
    Display help summary.

-q, --quiet
    Quiet mode, no progress indicator.

-v, --verbose
    Verbose output.

--explain
    Explain actions instead of executing.

-o name=<value>, --option name=<value>
    Override configuration option.

--no-run
    Don't execute, show what would be done.

DESCRIPTION

apt-ftparchive is a command-line utility in the APT suite for Debian and derivatives, designed to generate essential index files for package repositories. It processes directories of .deb packages, source .dsc files, and other archive contents to produce files like Packages, Packages.gz, Sources, Contents, and Release files.

These indexes enable apt clients to efficiently discover, download, and install packages from custom or mirrored repositories. Unlike simpler tools like dpkg-scanpackages, apt-ftparchive supports advanced features such as multi-architecture handling, compression (gzip, xz, zstd), override files for customizing package metadata, and Release file generation with checksums and signatures.

Usage typically involves specifying a database directory with package trees (e.g., dists/, pool/), a configuration file defining paths and options, and a subcommand like packages or release. It's commonly used in repository mirroring scripts, local package servers, or tools like reprepro and aptly. Configuration files use a simple key-value syntax for tree definitions, making it flexible for complex archives.

The tool ensures cryptographic integrity by calculating MD5, SHA1/256, and size checksums, crucial for secure repositories. Output can be directed to files or stdout, supporting automated workflows.

CAVEATS

Requires properly structured package directories (e.g., pool/, dists/). Database dir must contain uncompressed packages for scanning. Not suitable for very large repos without optimization; consider reprepro for management.

COMMON EXAMPLE

apt-ftparchive packages /path/to/pool > Packages
apt-ftparchive release dists/stable > dists/stable/Release

CONFIG TREE

Config files define trees like:
TreeDefault {"directory" "pool/%c/%s/%s/%s";}
TreeStateDir "db/";

HISTORY

Introduced in APT 0.3 (1999) by Debian developers as apt-ftparchive to replace manual index generation. Evolved with APT versions for new compressions (xz in 0.8+, zstd recent) and multi-arch support (APT 0.9+). Remains maintained in modern Debian (e.g., 12 Bookworm).

SEE ALSO

dpkg-scanpackages(1), dpkg-scansources(1), apt-get(8), reprepro(1)

Copied to clipboard