| 1 | = The control file = |
| 2 | |
| 3 | The control file contains metadata necessary for building the package. Some of the metadata ends up in the `.dsc` file, some ends up in the binary package, some in the `.changes` file, and some is only used at build time. |
| 4 | |
| 5 | The canonical information about control fields and their meaning can be found at http://www.debian.org/doc/debian-policy/ch-controlfields.html |
| 6 | |
| 7 | == Sample `control` file == |
| 8 | |
| 9 | {{{ |
| 10 | Source: rpncalc |
| 11 | Section: utils |
| 12 | Priority: extra |
| 13 | Maintainer: Jonathan Reed <jdreed@mit.edu> |
| 14 | Build-Depends: debhelper (>= 8.0.0) |
| 15 | Standards-Version: 3.9.3 |
| 16 | |
| 17 | Package: rpncalc |
| 18 | Architecture: any |
| 19 | Depends: ${shlibs:Depends}, ${misc:Depends} |
| 20 | Description: Simple RPN calculator in bash |
| 21 | A simple RPN calculator, implemented in bash. |
| 22 | Not legal for trade. |
| 23 | This was taken from the O'Reilly bash cookbook. |
| 24 | }}} |
| 25 | |
| 26 | As you may notice, the file is divided into 2 sections. The `Source:` section and the `Package:` section, which correspond to the source and binary packages, respectively. As noted earlier, a single source package can build multiple binary packages, and so `control` files may have multiple `Package:` sections. Section breaks are indicated by a blank line. |
| 27 | |
| 28 | * `Priority`: Used by package managers to decide what to keep when there are conflicts. This is general `optional` or `extra`. You may also see `required`, or `essential` which will make it harder for package managers to resolve conflicts, and is generally reserved for things that are truly required, like the kernel, or libc. |
| 29 | * `Section`: The Section is mostly irrelevant; copy it from a package similar to yours. This field has a special format, section/subsection. The section part determines what component of a Debian repository (i.e. the things after the name of the distro in the /etc/apt/sources.list line) to upload the package to (in standard Debian, main, contrib, or non-free; in Debathena, debathena, debathena-standard, debathena-system, or openafs); if it is not specified the section is assumed to be main. The subsection field is simply used for organizing graphical user interfaces to the Debian archive. |
| 30 | * `Standards-Version`: Indicates what version of the Debian Policy Manual the package is compatible with. Should generally be the current version you're running. Used by Lintian. Get it using apt-cache show debian-policy | grep Version. |
| 31 | * `Maintainer`: Your contact information, e.g. Tim Abbott <tabbott@mit.edu> |
| 32 | * `Build-Depends`: List packages needed to build your package. You don’t need to include any Priority: essential packages or anything depended on by build-essential. |
| 33 | * `Architecture`: If your package is architecture-independent (e.g. a shell script), you want “all”. If your package only works on some architectures, list those architectures. Otherwise, you want “any”. In Debathena, we generally use 'any' or 'all'. |
| 34 | * `Depends`: A hard dependency; the package will not be installed unless the packages it depends on are installed. Necessary |
| 35 | shared libraries should be automatically added if you include “${shlibs:Depends}”. Other useful dependencies may be added |
| 36 | by debhelper if you include “${misc:Depends}”. You don’t need to include any Priority: essential packages. |
| 37 | * `Recommends:` A soft dependency; aptitude and recent apt-get will prompt you to install the recommended packages along with your |
| 38 | package, but they will let you install your package without its recommended packages. |
| 39 | * `Suggests:` A dependency that doesn’t do anything. Modern package managers may tell the user that some packages are suggested, but will never automatically install them. |
| 40 | * `Conflicts`: A dependency that prevents both packages from being installed simultaneously. |
| 41 | * `Provides`: Assign virtual names to the package. Debian uses this for defining alternatives (e.g. mail-transport-agent is anything providing sendmail), but Provides is useful for many other applications. |
| 42 | * `Replaces`: When one package replaces or is a renaming of another, you want to specify Replaces: and Conflicts: against that package. Files from the named packages will be overwritten with the files from your package and it’ll make aptitude happier about the upgrade. |
| 43 | * `Pre-Depends`, `Breaks`: These are stronger versions of Depends and Conflicts, and should only be used in very specific situations. |
| 44 | * `Description`: A description of the package. This is a multi-line field. The first line is a short synopsis of the package, and the remaining lines (indented by a single space) is a longer description. Read Debian Policy for more information, as Lintian can be very pedantic about grammar and syntax in this field. |
| 45 | |