deb-substvars.man 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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
  24. deb\-substvars \- Debian source substitution variables
  25. .
  26. .SH SYNOPSIS
  27. substvars
  28. .
  29. .SH DESCRIPTION
  30. Before
  31. .BR dpkg\-source ", " dpkg\-gencontrol " and " dpkg\-genchanges
  32. write their control information (to the source control file
  33. .B .dsc
  34. for
  35. .B dpkg\-source
  36. and to standard output for
  37. .BR dpkg\-gencontrol " and " dpkg\-genchanges )
  38. they perform some variable substitutions on the output file.
  39. A variable substitution has the form
  40. .BI ${ variable-name }\fR.
  41. Variable names consist of alphanumerics, hyphens and colons and start
  42. with an alphanumeric. Variable substitutions are performed repeatedly
  43. until none are left; the full text of the field after the substitution
  44. is rescanned to look for more substitutions.
  45. After all the substitutions have been done each occurrence of the
  46. string
  47. .B ${}
  48. (which is not a legal substitution) is replaced with a
  49. .B $
  50. sign.
  51. While variable substitution is done on all control fields, some of those
  52. fields are used and needed during the build when the substitution did not
  53. yet occur. That's why you can't use variables in the \fBPackage\fP,
  54. \fBSource\fP and \fBArchitecture\fP fields.
  55. Variable substitution happens on the content of the fields after they have
  56. been parsed, thus if you want a variable to expand over multiple lines you
  57. do not have to include a space after the newline. This is done implicitly
  58. when the field is output. For example, if the variable
  59. \fB${Description}\fP is set to "foo is bar.${Newline}foo is
  60. great." and if you have the following field:
  61. Description: foo application
  62. ${Description}
  63. .
  64. More text.
  65. It will result in:
  66. Description: foo application
  67. foo is bar.
  68. foo is great.
  69. .
  70. More text.
  71. Variables can be set using the
  72. .B \-V
  73. common option. They can be also specified in the file
  74. .B debian/substvars
  75. (or whatever other file is specified using the
  76. .B \-T
  77. option). This file consists of lines of the form
  78. .IB name = value\fR.
  79. Trailing whitespace on each line, blank lines, and
  80. lines starting with a
  81. .B #
  82. symbol (comments) are ignored.
  83. Additionally, the following standard variables are available:
  84. .TP
  85. .BI Arch
  86. The current host architecture (i.e. the architecture the package is being
  87. built for, the equivalent of \fBDEB_HOST_ARCH\fP).
  88. .TP
  89. .B source:Version
  90. The source package version (since dpkg 1.13.19).
  91. .TP
  92. .B source:Upstream\-Version
  93. The upstream source package version, including the Debian version epoch if
  94. any (since dpkg 1.13.19).
  95. .TP
  96. .B binary:Version
  97. The binary package version (which may differ from source:Version in a binNMU
  98. for example; since dpkg 1.13.19).
  99. .TP
  100. .B Source\-Version
  101. The source package version (from the changelog file). This variable is now
  102. \fBobsolete\fP and emits an error when used as its meaning is different from
  103. its function, please use the \fBsource:Version\fP or \fBbinary:Version\fP as
  104. appropriate.
  105. .TP
  106. .B Installed\-Size
  107. The approximate total size of the package's installed files. This value is
  108. copied into the corresponding control file field; setting it will modify
  109. the value of that field. If this variable is not set
  110. .B dpkg\-gencontrol
  111. will compute the default value by accumulating the size of each regular
  112. file and symlink rounded to 1 KiB used units, and a baseline of 1 KiB for
  113. any other filesystem object type.
  114. \fBNote:\fP Take into account that this can only ever be an approximation,
  115. as the actual size used on the installed system will depend greatly on the
  116. filesystem used and its parameters, which might end up using either more
  117. or less space than the specified in this field.
  118. .TP
  119. .B Extra\-Size
  120. Additional disk space used when the package is installed. If this
  121. variable is set its value is added to that of the
  122. .B Installed\-Size
  123. variable (whether set explicitly or using the default value) before it
  124. is copied into the
  125. .B Installed\-Size
  126. control file field.
  127. .TP
  128. .BI S: fieldname
  129. The value of the source stanza field
  130. .I fieldname
  131. (which must be given in the canonical capitalisation; since dpkg 1.18.11).
  132. Setting these variables has no effect other than on places where they
  133. are expanded explicitly.
  134. These variables are only available when generating binary control files.
  135. .TP
  136. .BI F: fieldname
  137. The value of the output field
  138. .IR fieldname
  139. (which must be given in the canonical capitalisation). Setting these
  140. variables has no effect other than on places where they are expanded
  141. explicitly.
  142. .TP
  143. .B Format
  144. The
  145. .B .changes
  146. file format version generated by this version of the source packaging
  147. scripts. If you set this variable the contents of the
  148. .B Format
  149. field in the
  150. .B .changes
  151. file will change too.
  152. .TP
  153. .BR Newline ", " Space ", " Tab
  154. These variables each hold the corresponding character.
  155. .TP
  156. .BI shlibs: dependencyfield
  157. Variable settings with names of this form are generated by
  158. .BR dpkg\-shlibdeps .
  159. .TP
  160. .B dpkg:Upstream\-Version
  161. The upstream version of dpkg (since dpkg 1.13.19).
  162. .TP
  163. .B dpkg:Version
  164. The full version of dpkg (since dpkg 1.13.19).
  165. .LP
  166. If a variable is referred to but not defined it generates a warning
  167. and an empty value is assumed.
  168. .
  169. .SH FILES
  170. .TP
  171. .B debian/substvars
  172. List of substitution variables and values.
  173. .
  174. .SH SEE ALSO
  175. .ad l
  176. .BR dpkg (1),
  177. .BR dpkg\-genchanges (1),
  178. .BR dpkg\-gencontrol (1),
  179. .BR dpkg\-shlibdeps (1),
  180. .BR dpkg\-source (1).