deb-substvars.man 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 utilities"
  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. \fBdeprecated\fP as its meaning is different from its function, please use
  103. the \fBsource:Version\fP or \fBbinary:Version\fP as appropriate.
  104. .TP
  105. .B Installed\-Size
  106. The approximate total size of the package's installed files. This value is
  107. copied into the corresponding control file field; setting it will modify
  108. the value of that field. If this variable is not set
  109. .B dpkg\-gencontrol
  110. will compute the default value by accumulating the size of each regular
  111. file and symlink rounded to 1 KiB used units, and a baseline of 1 KiB for
  112. any other filesystem object type.
  113. \fBNote:\fP Take into account that this can only ever be an approximation,
  114. as the actual size used on the installed system will depend greatly on the
  115. filesystem used and its parameters, which might end up using either more
  116. or less space than the specified in this field.
  117. .TP
  118. .B Extra\-Size
  119. Additional disk space used when the package is installed. If this
  120. variable is set its value is added to that of the
  121. .B Installed\-Size
  122. variable (whether set explicitly or using the default value) before it
  123. is copied into the
  124. .B Installed\-Size
  125. control file field.
  126. .TP
  127. .BI F: fieldname
  128. The value of the output field
  129. .IR fieldname
  130. (which must be given in the canonical capitalisation). Setting these
  131. variables has no effect other than on places where they are expanded
  132. explicitly.
  133. .TP
  134. .B Format
  135. The
  136. .B .changes
  137. file format version generated by this version of the source packaging
  138. scripts. If you set this variable the contents of the
  139. .B Format
  140. field in the
  141. .B .changes
  142. file will change too.
  143. .TP
  144. .BR Newline ", " Space ", " Tab
  145. These variables each hold the corresponding character.
  146. .TP
  147. .BI shlibs: dependencyfield
  148. Variable settings with names of this form are generated by
  149. .BR dpkg\-shlibdeps .
  150. .TP
  151. .B dpkg:Upstream\-Version
  152. The upstream version of dpkg (since dpkg 1.13.19).
  153. .TP
  154. .B dpkg:Version
  155. The full version of dpkg (since dpkg 1.13.19).
  156. .LP
  157. If a variable is referred to but not defined it generates a warning
  158. and an empty value is assumed.
  159. .
  160. .SH FILES
  161. .TP
  162. .B debian/substvars
  163. List of substitution variables and values.
  164. .
  165. .SH SEE ALSO
  166. .ad l
  167. .BR dpkg (1),
  168. .BR dpkg\-genchanges (1),
  169. .BR dpkg\-gencontrol (1),
  170. .BR dpkg\-shlibdeps (1),
  171. .BR dpkg\-source (1).