deb-substvars(5)

๐Ÿ’… deb-substvars โ€” Debian source substitution variables

okay bestie, buckle up ๐Ÿ’– this is the manual page for deb-substvars from the dpkg suite โ€” yes, that dpkg. It's all about those cute little ${variable} thingies that get swapped out before your control files get written. No cap, it's lowkey iconic.


โœจ NAME โœจ

deb-substvars โ€” Debian source substitution variables ๐ŸŽ€


โœจ SYNOPSIS โœจ

debian/substvars, debian/binary-package.substvars, variables

โœจ DESCRIPTION โœจ

So here's the vibe: before dpkg-source, dpkg-gencontrol and dpkg-genchanges write out their control info โ€” that's the source control file .dsc for dpkg-source, and standard output for dpkg-gencontrol and dpkg-genchanges โ€” they do some variable substitutions on the output file. Like a little glow-up pass before it goes out the door. โœจ

๐ŸŒธ Variable Syntax ๐ŸŒธ

A variable substitution has the form ${variable-name}. Variable names are made of alphanumerics (a-zA-Z0-9), hyphens (-) and colons (:), and they start with an alphanumeric. They're case-sensitive, even though they might refer to other entities which are case-preserving. (Yes, the drama of it. ๐Ÿ’…)

Substitutions get performed repeatedly until none are left โ€” the full text of the field after the substitution is rescanned to look for more substitutions. It's giving recursive, it's giving thorough. ๐Ÿ”ฅ

๐Ÿฆ‹ File Syntax ๐Ÿฆ‹

Substitution variables can be specified in a file. These files consist of lines with variable assignments that start with the variable name, immediately followed by an assignment operator, and then the value. Each operator gives the variable specific attributes. Trailing whitespace on each line, blank lines, and lines starting with a # symbol (comments) are ignored. ๐Ÿซถ

The following operators are supported:

  • = โ€” Assigns a normal substitution variable.
  • ?= โ€” Assigns an optional substitution variable which will emit no warnings even if unused. Supported since dpkg 1.21.8.
  • != โ€” Assigns a required substitution variable which will error out if unused. Supported since dpkg 1.22.7.
  • $= โ€” Assigns an implicit substitution variable which will get automatically instantiated as a field, if that field is not defined for .dsc and .deb control files.

The variable name needs to be formed as a namespace followed by a colon (:) and then the field name, such as tool:Depends. All implicit variables for any namespace matching the same field will get concatenated using a known field separator, or a space if the field separator is unknown.

Supported since dpkg 1.23.0.

For example:

some-package:Depends?=other-package (= 1.0), the-package

๐Ÿงš Substitution ๐Ÿงš

Variables can be set using the -V common option. They can also be specified in the file debian/substvars (or whatever other file is specified using the -T common option).

After all the substitutions have been done, each occurrence of the string ${} (which is not an actual substitution variable) is replaced with a $ sign. This can be used as an escape sequence, such as ${}{VARIABLE}, which will end up as ${VARIABLE} on the output. Sneaky but slay. ๐Ÿ˜Œ

If a variable is referred to but not defined, it generates a warning and an empty value is assumed. (Rude, but okay. ๐Ÿ’€)

While variable substitution is done on all control fields, some of those fields are used and needed during the build when the substitution did not yet occur. That's why you can't use variables in the Package, Source and Architecture fields. Periodt.

Variable substitution happens on the content of the fields after they have been parsed, so if you want a variable to expand over multiple lines you do not have to include a space after the newline. This is done implicitly when the field is output. For example, if the variable ${Description} is set to foo is bar.${Newline}foo is great. and you have the following field:

 Description: foo application
  ${Description}
  .
  More text.

It will result in:

 Description: foo application
  foo is bar.
  foo is great.
  .
  More text.

๐Ÿ‘‘ Built-in Variable ๐Ÿ‘‘

Additionally, the following standard variables are always available. Always. ๐Ÿ’–

  • Arch โ€” The current host architecture (i.e. the architecture the package is being built for, the equivalent of DEB_HOST_ARCH).
  • vendor:Name โ€” The current vendor name. This value comes from the Vendor field for the current vendor's origin file, as dpkg-vendor(1) would retrieve it. Supported since dpkg 1.20.0.
  • vendor:Id โ€” The current vendor ID. This is just the lowercase variant of vendor:Name. Supported since dpkg 1.20.0.
  • source:Version โ€” The source package version. Supported since dpkg 1.13.19.
  • source:Upstream-Version โ€” The upstream source package version, including the Debian version epoch if any. Supported since dpkg 1.13.19.
  • binary:Version โ€” The binary package version (which may differ from source:Version in a binNMU for example). Supported since dpkg 1.13.19.
  • Source-Version โ€” The source package version (from the changelog file). This variable is now obsolete and emits an error when used, as its meaning is different from its function โ€” use the source:Version or binary:Version as appropriate. > ๐Ÿšจ bestie this one is deprecated, don't use it, it literally errors out.
  • source:Synopsis โ€” The source package synopsis, extracted from the source stanza Description field, if it exists. Supported since dpkg 1.19.0.
  • source:Extended-Description โ€” The source package extended description, extracted from the source stanza Description field, if it exists. Supported since dpkg 1.19.0.
  • Installed-Size โ€” The approximate total size of the package's installed files. This value is copied into the corresponding control file field; setting it will modify the value of that field. If this variable is not set, dpkg-gencontrol will compute the default value by accumulating the size of each regular file and symlink rounded to 1 KiB used units, and a baseline of 1 KiB for any other filesystem object type. With hardlinks only being counted once as a regular file.
๐Ÿ’ญ Note: take into account that this can only ever be an approximation, as the actual size used on the installed system will depend greatly on the filesystem used and its parameters, which might end up using either more or less space than the specified in this field. So likeโ€ฆ it's a vibe, not a promise. ๐Ÿ™ˆ
  • Extra-Size โ€” Additional disk space used when the package is installed. If this variable is set, its value is added to that of the Installed-Size variable (whether set explicitly or using the default value) before it is copied into the Installed-Size control file field.
  • S:field-name โ€” The value of the source stanza field field-name (which must be given in the canonical capitalization). Setting these variables has no effect other than on places where they are expanded explicitly. These variables are only available when generating binary control files. Supported since dpkg 1.18.11.
  • F:field-name โ€” The value of the output field field-name (which must be given in the canonical capitalization). Setting these variables has no effect other than on places where they are expanded explicitly.
  • Format โ€” The .changes file format version generated by this version of the source packaging scripts. If you set this variable, the contents of the Format field in the .changes file will change too. Careful, she's got main character energy. โญ
  • Newline, Space, Tab โ€” These variables each hold the corresponding character.
  • shlibs:dependencyfield โ€” Variable settings with names of this form are generated by dpkg-shlibdeps.
  • dpkg:Upstream-Version โ€” The upstream version of dpkg. Supported since dpkg 1.13.19.
  • dpkg:Version โ€” The full version of dpkg. Supported since dpkg 1.13.19.

โœจ FILES โœจ

  • debian/substvars โ€” List of substitution variables and values. ๐Ÿ“

โœจ SEE ALSO โœจ

dpkg(1), dpkg-vendor(1), dpkg-genchanges(1), dpkg-gencontrol(1), dpkg-shlibdeps(1), dpkg-source(1).


and that's the whole page bestie, you ate that ๐Ÿ’…โœจ

this masterpiece is from the dpkg suite, version 1.23.11-dirty, dated 2026-09-09 โ€” go forth and substitute responsibly, ily ๐Ÿซถ๐ŸŽ€

๐Ÿ“ฆ where this page comes from