apt-ftparchive
Create APT repository index files
SYNOPSIS
apt-ftparchive [options] command
apt-ftparchive generate configfile
apt-ftparchive release configfile
apt-ftparchive contents path
apt-ftparchive packages path [override-file [path-prefix]]
apt-ftparchive sources path [override-file [path-prefix]]
apt-ftparchive print-structure [type]
apt-ftparchive dump configfile section
apt-ftparchive help
PARAMETERS
generate configfile
Generates Packages and Sources index files for components and architectures defined in the specified configuration file.
release configfile
Generates a Release file for the archive, often including cryptographic checksums of the index files and potentially signing it with a GPG key as defined in the configuration.
contents path
Generates a Contents file from the packages located under the specified path, listing files contained within each package.
packages path [override-file [path-prefix]]
Generates a Packages file from .deb files found recursively under the given path. An optional override file can be used to modify package information like priorities and sections.
sources path [override-file [path-prefix]]
Generates a Sources file from source packages (.dsc files) found recursively under the given path. An optional override file can be provided for source package information.
print-structure [type]
Prints the internal structure of the archive. An optional type can filter the output to specific components or architectures.
dump configfile section
Dumps a specific section of the configuration file to standard output, useful for debugging.
help
Shows a summary of commands and common options.
--help, -h
Shows the program's detailed help text.
--config-file file, -c=file
Specifies an alternative configuration file to be used instead of the default ones.
--option APT::Key=Value, -o=APT::Key=Value
Sets a configuration option directly. Can be used multiple times to set different options, overriding values from configuration files.
--version, -v
Shows the program's version information.
--quiet, -q
Suppresses output, showing only error messages.
--force-architecture
Forces the inclusion of packages regardless of their declared architecture, useful for building repositories for multiple architectures or cross-building.
--md5
Generates MD5 checksums for files. This is often included by default for Packages and Sources files.
--sha1
Generates SHA1 checksums for files.
--sha256
Generates SHA256 checksums for files.
--sha512
Generates SHA512 checksums for files.
--no-compression
Prevents compression of generated index files (e.g., Packages, Sources). By default, they are compressed with gzip and/or xz if available.
DESCRIPTION
apt-ftparchive is a utility for generating index files (e.g., Packages, Sources, Release, Release.gpg) for a Debian archive. These files are crucial for APT clients to browse and download packages from a repository. It's typically used by repository maintainers to build and update the metadata necessary for APT to function correctly. It can generate Packages and Sources files from a directory tree of .deb and .dsc (Debian Source Control) files, respectively. Furthermore, it can generate and sign Release files, which provide cryptographic integrity checks for the entire archive. This command is a foundational tool for anyone hosting their own Debian package repository, enabling clients to use apt update and apt install against it effectively.
CAVEATS
apt-ftparchive requires a well-structured directory layout adhering to Debian repository standards and a comprehensive configuration file for complex repositories. Errors in the configuration can lead to malformed archives that APT clients cannot properly process or trust. GPG signing of the Release file requires proper key setup and management on the system. It is important to note that this command does not create packages; it only indexes existing .deb and source packages and generates metadata for them.
CONFIGURATION FILES
apt-ftparchive heavily relies on configuration files (e.g., /etc/apt/ftparchive.conf or a custom one specified with -c) to define repository paths, package filters, architecture mapping, and signing options. This makes it highly flexible but also requires careful setup and understanding of its directives and the APT configuration syntax.
REPOSITORY STRUCTURE
It expects and is designed to work with a standard Debian repository structure, typically following the layout of dists/suite/component/architecture/ where package files reside. Proper adherence to this structure is essential for correct indexing and for APT clients to locate packages.
SIGNING ARCHIVES
The release command, when properly configured, can sign the Release file with a GPG key. This cryptographic signature is critical for apt clients to verify the integrity and authenticity of the repository, ensuring that packages have not been tampered with and originate from a trusted source. Without a valid signature, APT clients will typically refuse to use the repository.
HISTORY
Part of the apt package suite, apt-ftparchive was developed as a robust and integrated tool for managing Debian repository metadata. It emerged to provide a more comprehensive and configurable solution compared to earlier, simpler scanning utilities like dpkg-scanpackages and dpkg-scansources, which primarily focused on single index file generation. Its introduction allowed for complete archive management, including Release file generation and GPG signing, which are vital for repository integrity and authenticity in modern APT environments. Its development has paralleled the growth and sophistication of the Debian package ecosystem, becoming an indispensable tool for anyone maintaining a Debian-based package repository.