dh_gencontrol - Linux


Overview

dh_gencontrol processes header files and generates the information for the control field of a Debian package. It is typically used during the packaging process to ensure the generated Debian control file reflects the project’s metadata and dependencies.

Syntax

dh_gencontrol [--help] [-a] [-c] [-q] [-s] [-S] [-P] [-u] [-v] [-x] [-C controlfile] [-F debian/control.deb-file] [-N package] [-X extra-field]

Options/Flags

  • -a or –all: Generate control fields for all headers.
  • -c or –custom: Custom field.
  • -q or –quiet: Quieter output.
  • -s or –sourced: Only the name of the sourced package is put in the control field.
  • -S or –no-sourced: No file sourced is put in the control field.
  • -P or –pattern: Pattern of header names to output.
  • -u or –update-control: Update/Add fields to control file instead of creating a new one.
  • -v or –verbose: Verbose output.
  • -x or –allow-overrides: Allow user overrides.
  • -C controlfile: Name of control file.
  • -F debian/control.deb-file: Name of debian/control file of the package.
  • -N package: Name of package.
  • -X extra-field: Put extra field in control file.

Examples

Generate control fields for all headers:

dh_gencontrol

Update the existing control file:

dh_gencontrol -u

Append extra field to the control file:

dh_gencontrol -X fields::runtime-apt=perl

Common Issues

Error: No such file or directory

Ensure the header files you are referencing exist in the expected location.

Integration

With debhelper:

dh_gencontrol is commonly used within debhelper, a comprehensive suite of tools for building Debian packages. It can be invoked as part of the dh command, which automates many aspects of the packaging process.

Example:

dh --with auto-build configure

Related Commands

  • dpkg-deb: Manages Debian packages.
  • dh_make: Creates a Debian source package.
  • dh_install: Installs a Debian package.