dpkg (1.18.25) stretch; urgency=medium
[dpkg] / man / deb-substvars.man
CommitLineData
1479465f
GJ
1.\" dpkg manual page - deb-substvars(5)
2.\"
3.\" Copyright © 1995-1996 Ian Jackson <ijackson@chiark.greenend.org.uk>
4.\" Copyright © 2000 Wichert Akkerman <wakkerma@debian.org>
5.\" Copyright © 2006-2009,2012-2015 Guillem Jover <guillem@debian.org>
6.\" Copyright © 2009-2010 Raphaël Hertzog <hertzog@debian.org>
7.\"
8.\" This is free software; you can redistribute it and/or modify
9.\" it under the terms of the GNU General Public License as published by
10.\" the Free Software Foundation; either version 2 of the License, or
11.\" (at your option) any later version.
12.\"
13.\" This is distributed in the hope that it will be useful,
14.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.\" GNU General Public License for more details.
17.\"
18.\" You should have received a copy of the GNU General Public License
19.\" along with this program. If not, see <https://www.gnu.org/licenses/>.
20.
21.TH deb\-substvars 5 "%RELEASE_DATE%" "%VERSION%" "dpkg suite"
22.nh
23.SH NAME
24deb\-substvars \- Debian source substitution variables
25.
26.SH SYNOPSIS
27substvars
28.
29.SH DESCRIPTION
30Before
31.BR dpkg\-source ", " dpkg\-gencontrol " and " dpkg\-genchanges
32write their control information (to the source control file
33.B .dsc
34for
35.B dpkg\-source
36and to standard output for
37.BR dpkg\-gencontrol " and " dpkg\-genchanges )
38they perform some variable substitutions on the output file.
39
40A variable substitution has the form
41.BI ${ variable-name }\fR.
42Variable names consist of alphanumerics, hyphens and colons and start
43with an alphanumeric. Variable substitutions are performed repeatedly
44until none are left; the full text of the field after the substitution
45is rescanned to look for more substitutions.
46
47After all the substitutions have been done each occurrence of the
48string
49.B ${}
50(which is not a legal substitution) is replaced with a
51.B $
52sign.
53
54While variable substitution is done on all control fields, some of those
55fields are used and needed during the build when the substitution did not
56yet occur. That's why you can't use variables in the \fBPackage\fP,
57\fBSource\fP and \fBArchitecture\fP fields.
58
59Variable substitution happens on the content of the fields after they have
60been parsed, thus if you want a variable to expand over multiple lines you
61do not have to include a space after the newline. This is done implicitly
62when the field is output. For example, if the variable
63\fB${Description}\fP is set to "foo is bar.${Newline}foo is
64great." and if you have the following field:
65
66 Description: foo application
67 ${Description}
68 .
69 More text.
70
71It will result in:
72
73 Description: foo application
74 foo is bar.
75 foo is great.
76 .
77 More text.
78
79Variables can be set using the
80.B \-V
81common option. They can be also specified in the file
82.B debian/substvars
83(or whatever other file is specified using the
84.B \-T
85option). This file consists of lines of the form
86.IB name = value\fR.
87Trailing whitespace on each line, blank lines, and
88lines starting with a
89.B #
90symbol (comments) are ignored.
91
92Additionally, the following standard variables are available:
93.TP
94.BI Arch
95The current host architecture (i.e. the architecture the package is being
96built for, the equivalent of \fBDEB_HOST_ARCH\fP).
97.TP
98.B source:Version
99The source package version (since dpkg 1.13.19).
100.TP
101.B source:Upstream\-Version
102The upstream source package version, including the Debian version epoch if
103any (since dpkg 1.13.19).
104.TP
105.B binary:Version
106The binary package version (which may differ from source:Version in a binNMU
107for example; since dpkg 1.13.19).
108.TP
109.B Source\-Version
110The source package version (from the changelog file). This variable is now
111\fBobsolete\fP and emits an error when used as its meaning is different from
112its function, please use the \fBsource:Version\fP or \fBbinary:Version\fP as
113appropriate.
114.TP
115.B Installed\-Size
116The approximate total size of the package's installed files. This value is
117copied into the corresponding control file field; setting it will modify
118the value of that field. If this variable is not set
119.B dpkg\-gencontrol
120will compute the default value by accumulating the size of each regular
121file and symlink rounded to 1 KiB used units, and a baseline of 1 KiB for
122any other filesystem object type.
123
124\fBNote:\fP Take into account that this can only ever be an approximation,
125as the actual size used on the installed system will depend greatly on the
126filesystem used and its parameters, which might end up using either more
127or less space than the specified in this field.
128.TP
129.B Extra\-Size
130Additional disk space used when the package is installed. If this
131variable is set its value is added to that of the
132.B Installed\-Size
133variable (whether set explicitly or using the default value) before it
134is copied into the
135.B Installed\-Size
136control file field.
137.TP
138.BI S: fieldname
139The value of the source stanza field
140.I fieldname
141(which must be given in the canonical capitalisation; since dpkg 1.18.11).
142Setting these variables has no effect other than on places where they
143are expanded explicitly.
144These variables are only available when generating binary control files.
145.TP
146.BI F: fieldname
147The value of the output field
148.IR fieldname
149(which must be given in the canonical capitalisation). Setting these
150variables has no effect other than on places where they are expanded
151explicitly.
152.TP
153.B Format
154The
155.B .changes
156file format version generated by this version of the source packaging
157scripts. If you set this variable the contents of the
158.B Format
159field in the
160.B .changes
161file will change too.
162.TP
163.BR Newline ", " Space ", " Tab
164These variables each hold the corresponding character.
165.TP
166.BI shlibs: dependencyfield
167Variable settings with names of this form are generated by
168.BR dpkg\-shlibdeps .
169.TP
170.B dpkg:Upstream\-Version
171The upstream version of dpkg (since dpkg 1.13.19).
172.TP
173.B dpkg:Version
174The full version of dpkg (since dpkg 1.13.19).
175.LP
176If a variable is referred to but not defined it generates a warning
177and an empty value is assumed.
178.
179.SH FILES
180.TP
181.B debian/substvars
182List of substitution variables and values.
183.
184.SH SEE ALSO
185.ad l
186.BR dpkg (1),
187.BR dpkg\-genchanges (1),
188.BR dpkg\-gencontrol (1),
189.BR dpkg\-shlibdeps (1),
190.BR dpkg\-source (1).