Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dpkg::substvars(3) [linux man page]

Dpkg::Substvars(3)						   libdpkg-perl 						Dpkg::Substvars(3)

NAME
Dpkg::Substvars - handle variable substitution in strings DESCRIPTION
It provides some an object which is able to substitute variables in strings. METHODS
my $s = Dpkg::Substvars->new($file) Create a new object that can do substitutions. By default it contains generic substitutions like ${Newline}, ${Space}, ${Tab}, ${dpkg:Version} and ${dpkg:Upstream-Version}. Additional substitutions will be read from the $file passed as parameter. It keeps track of which substitutions were actually used (only counting substvars(), not get()), and warns about unused substvars when asked to. The substitutions that are always present are not included in these warnings. $s->set($key, $value) Add/replace a substitution. $s->get($key) Get the value of a given substitution. $s->delete($key) Remove a given substitution. $s->no_warn($key) Prevents warnings about a unused substitution, for example if it is provided by default. $s->load($file) Add new substitutions read from $file. $s->parse($fh, $desc) Add new substitutions read from the filehandle. $desc is used to identify the filehandle in error messages. $s->set_version_substvars($version) Defines ${binary:Version}, ${source:Version} and ${source:Upstream-Version} based on the given version string. These will never be warned about when unused. $s->set_arch_substvars() Defines architecture variables: ${Arch}. This will never be warned about when unused. $newstring = $s->substvars($string) Substitutes variables in $string and return the result in $newstring. $s->warn_about_unused() Issues warning about any variables that were set, but not used $s->set_msg_prefix($prefix) Define a prefix displayed before all warnings/error messages output by the module. $s->save($file) Store all substitutions variables except the automatic ones in the indicated file. "$s" Return a string representation of all substitutions variables except the automatic ones. $str = $s->output($fh) Print all substitutions variables except the automatic ones in the filehandle and return the content written. AUTHOR
Raphael Hertzog <hertzog@debian.org>. 1.16.0.3 2012-04-17 Dpkg::Substvars(3)

Check Out this Related Man Page

deb-substvars(5)						  dpkg utilities						  deb-substvars(5)

NAME
deb-substvars - Debian source substitution variables SYNOPSIS
substvars DESCRIPTION
Before dpkg-source, dpkg-gencontrol and dpkg-genchanges write their control information (to the source control file .dsc for dpkg-source and to standard output for dpkg-gencontrol and dpkg-genchanges) they perform some variable substitutions on the output file. A variable substitution has the form ${variable-name}. Variable names consist of alphanumerics, hyphens and colons and start with an alphanumeric. Variable substitutions are performed repeatedly until none are left; the full text of the field after the substitution is rescanned to look for more substitutions. After all the substitutions have been done each occurrence of the string ${} (which is not a legal substitution) is replaced with a $ sign. 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. Variable substitution happens on the content of the fields after they have been parsed, thus 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 if 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. Variables can be set using the -V common option. They can be also specified in the file debian/substvars (or whatever other file is speci- fied using the -T option). This file consists of lines of the form name=value. Trailing whitespace on each line, blank lines, and lines starting with a # symbol (comments) are ignored. Additionally, the following standard variables are available: Arch The current build architecture (from dpkg --print-architecture). source:Version The source package version. source:Upstream-Version The upstream source package version, including the Debian version epoch if any. binary:Version The binary package version (which may differ from source:Version in a binNMU for example). Source-Version The source package version (from the changelog file). This variable is now deprecated as its meaning is different from its function, please use the source:Version or binary:Version as appropriate. Installed-Size The 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 isn't set dpkg-gencontrol will use du -k debian/tmp to find the default value. 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. F:fieldname The value of the output field fieldname (which must be given in the canonical capitalisation). 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. 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. dpkg:Version The full version of dpkg. If a variable is referred to but not defined it generates a warning and an empty value is assumed. FILES
debian/substvars List of substitution variables and values. BUGS
The point at which field overriding occurs compared to certain standard output field settings is rather confused. SEE ALSO
dpkg(1), dpkg-genchanges(1), dpkg-gencontrol(1), dpkg-shlibdeps(1), dpkg-source(1). AUTHOR
Copyright (C) 1995-1996 Ian Jackson Copyright (C) 2000 Wichert Akkerman This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY. Debian Project 2009-07-15 deb-substvars(5)
Man Page