libdpkg: Add varbuf_add_strn()
[dpkg.git] / scripts / Dpkg.pm
blob8c567a42eefcf3cd09ee32d45cdfa950b36c9f17
1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <https://www.gnu.org/licenses/>.
14 =encoding utf8
16 =head1 NAME
18 Dpkg - module with core variables
20 =head1 DESCRIPTION
22 The Dpkg module provides a set of variables with information concerning
23 this system installation.
25 It is also the entry point to the Dpkg module hierarchy.
27 =cut
29 package Dpkg 2.00;
31 use strict;
32 use warnings;
34 our @EXPORT_OK = qw(
35 $PROGNAME
36 $PROGVERSION
37 $PROGMAKE
38 $PROGTAR
39 $PROGPATCH
40 $CONFDIR
41 $ADMINDIR
42 $LIBDIR
43 $DATADIR
46 use Exporter qw(import);
48 =head1 VARIABLES
50 =over 4
52 =item $Dpkg::PROGNAME
54 Contains the name of the current program.
56 =item $Dpkg::PROGVERSION
58 Contains the version of the dpkg suite.
60 =item $Dpkg::PROGMAKE
62 Contains the name of the system GNU make program.
64 =item $Dpkg::PROGTAR
66 Contains the name of the system GNU tar program.
68 =item $Dpkg::PROGPATCH
70 Contains the name of the system GNU patch program (or another implementation
71 that is directory traversal resistant).
73 =item $Dpkg::CONFDIR
75 Contains the path to the dpkg system configuration directory.
77 =item $Dpkg::ADMINDIR
79 Contains the path to the dpkg database directory.
81 =item $Dpkg::LIBDIR
83 Contains the path to the dpkg methods and plugins directory.
85 =item $Dpkg::DATADIR
87 Contains the path to the dpkg architecture tables directory.
89 =back
91 =cut
93 our ($PROGNAME) = $0 =~ m{(?:.*/)?([^/]*)};
95 # The following lines are automatically fixed at install time
96 our $PROGVERSION = '1.22.x';
97 our $PROGMAKE = $ENV{DPKG_PROGMAKE} // 'make';
98 our $PROGTAR = $ENV{DPKG_PROGTAR} // 'tar';
99 our $PROGPATCH = $ENV{DPKG_PROGPATCH} // 'patch';
101 our $CONFDIR = '/etc/dpkg';
102 our $ADMINDIR = '/var/lib/dpkg';
103 our $LIBDIR = '.';
104 our $DATADIR = '../data';
106 $DATADIR = $ENV{DPKG_DATADIR} if defined $ENV{DPKG_DATADIR};
108 =head1 MODULES
110 The following is the list of public modules within the Dpkg hierarchy. Only
111 modules with versions 1.00 or higher, and only the interfaces documented in
112 their POD are considered public.
114 =over
116 =item L<Dpkg>
118 This module, core variables.
120 =item L<Dpkg::Arch>
122 Architecture handling functions.
124 =item L<Dpkg::BuildFlags>
126 Set, modify and query compilation build flags.
128 =item L<Dpkg::BuildInfo>
130 Build information functions.
132 =item L<Dpkg::BuildOptions>
134 Parse and manipulate B<DEB_BUILD_OPTIONS>.
136 =item L<Dpkg::BuildProfiles>
138 Parse and manipulate build profiles.
140 =item L<Dpkg::Changelog>
142 Parse changelogs.
144 =item L<Dpkg::Changelog::Entry>
146 Represents a changelog entry.
148 =item L<Dpkg::Changelog::Parse>
150 Generic changelog parser for F<dpkg-parsechangelog>.
152 =item L<Dpkg::Checksums>
154 Generate and parse checksums.
156 =item L<Dpkg::Compression>
158 Simple database of available compression methods.
160 =item L<Dpkg::Compression::FileHandle>
162 Transparently compress and decompress files.
164 =item L<Dpkg::Compression::Process>
166 Wrapper around compression tools.
168 =item L<Dpkg::Conf>
170 Parse F<dpkg> configuration files.
172 =item L<Dpkg::Control>
174 Parse and manipulate Debian control information (F<.dsc>, F<.changes>,
175 F<Packages>/F<Sources> entries, etc.).
177 =item L<Dpkg::Control::Changelog>
179 Represent fields output by F<dpkg-parsechangelog>.
181 =item L<Dpkg::Control::Fields>
183 Manage (list of known) control fields.
185 =item L<Dpkg::Control::Hash>
187 Parse and manipulate a stanza of deb822 fields.
189 =item L<Dpkg::Control::Info>
191 Parse files like F<debian/control>.
193 =item L<Dpkg::Control::Tests>
195 Parse files like F<debian/tests/control>.
197 =item L<Dpkg::Control::Tests::Entry>
199 Represents a F<debian/tests/control> stanza.
201 =item L<Dpkg::Deps>
203 Parse and manipulate dependencies.
205 =item L<Dpkg::Deps::Simple>
207 Represents a single dependency statement.
209 =item L<Dpkg::Deps::Multiple>
211 Base module to represent multiple dependencies.
213 =item L<Dpkg::Deps::Union>
215 List of unrelated dependencies.
217 =item L<Dpkg::Deps::AND>
219 List of AND dependencies.
221 =item L<Dpkg::Deps::OR>
223 List of OR dependencies.
225 =item L<Dpkg::Deps::KnownFacts>
227 List of installed and virtual packages.
229 =item L<Dpkg::Exit>
231 Push, pop and run exit handlers.
233 =item L<Dpkg::Gettext>
235 Wrapper around L<Locale::gettext>.
237 =item L<Dpkg::IPC>
239 Spawn sub-processes and feed/retrieve data.
241 =item L<Dpkg::Index>
243 Collections of L<Dpkg::Control> (F<Packages>/F<Sources> files for example).
245 =item L<Dpkg::Interface::Storable>
247 Base object serializer.
249 =item L<Dpkg::Path>
251 Common path handling functions.
253 =item L<Dpkg::Source::Format>
255 Parse and manipulate debian/source/format files.
257 =item L<Dpkg::Source::Package>
259 Extract Debian source packages.
261 =item L<Dpkg::Substvars>
263 Substitute variables in strings.
265 =item L<Dpkg::Vendor>
267 Identify current distribution vendor.
269 =item L<Dpkg::Version>
271 Parse and manipulate Debian package versions.
273 =back
275 =head1 CHANGES
277 =head2 Version 2.00 (dpkg 1.20.0)
279 Remove variables: $version, $progname, $admindir, $dpkglibdir and $pkgdatadir.
281 =head2 Version 1.03 (dpkg 1.18.24)
283 New variable: $PROGPATCH.
285 =head2 Version 1.02 (dpkg 1.18.11)
287 New variable: $PROGTAR, $PROGMAKE.
289 =head2 Version 1.01 (dpkg 1.17.0)
291 New variables: $PROGNAME, $PROGVERSION, $CONFDIR, $ADMINDIR, $LIBDIR and
292 $DATADIR.
294 Deprecated variables: $version, $admindir, $dpkglibdir and $pkgdatadir.
296 =head2 Version 1.00 (dpkg 1.15.6)
298 Mark the module as public.
300 =head1 LICENSE
302 See the header comment on each module for their particular license.
304 =cut