1 # Copyright © 2009 Raphaël Hertzog <hertzog@debian.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 package Dpkg::Vendor::Default;
21 our $VERSION = '0.01';
23 # If you use this file as template to create a new vendor object, please
24 # uncomment the following lines
25 #use parent qw(Dpkg::Vendor::Default);
31 Dpkg::Vendor::Default - default vendor object
35 A vendor object is used to provide vendor specific behaviour
36 in various places. This is the default object used in case
37 there's none for the current vendor or in case the vendor could
38 not be identified (see Dpkg::Vendor documentation).
40 It provides some hooks that are called by various dpkg-* tools.
41 If you need a new hook, please file a bug against dpkg-dev and explain
42 your need. Note that the hook API has no guarantee to be stable over an
43 extended period of time. If you run an important distribution that makes
44 use of vendor hooks, you'd better submit them for integration so that
45 we avoid breaking your code.
51 =item $vendor_obj = Dpkg::Vendor::Default->new()
53 Creates the default vendor object. Can be inherited by all vendor objects
54 if they don't need any specific initialization at object creation time.
60 my $class = ref($this) || $this;
66 =item $vendor_obj->run_hook($id, @params)
68 Run the corresponding hook. The parameters are hook-specific. The
73 =item before-source-build ($srcpkg)
75 The first parameter is a Dpkg::Source::Package object. The hook is called
76 just before the execution of $srcpkg->build().
78 =item package-keyrings ()
80 The hook is called when dpkg-source is checking a signature on a source
81 package (since dpkg 1.18.11). It takes no parameters, but returns a
82 (possibly empty) list of vendor-specific keyrings.
84 =item archive-keyrings ()
86 The hook is called when there is a need to check signatures on artifacts
87 from repositories, for example by a download method (since dpkg 1.18.11).
88 It takes no parameters, but returns a (possibly empty) list of
89 vendor-specific keyrings.
91 =item archive-keyrings-historic ()
93 The hook is called when there is a need to check signatures on artifacts
94 from historic repositories, for example by a download method
95 (since dpkg 1.18.11). It takes no parameters, but returns a (possibly empty)
96 list of vendor-specific keyrings.
98 =item builtin-build-depends ()
100 The hook is called when dpkg-checkbuilddeps is initializing the source
101 package build dependencies (since dpkg 1.18.2). It takes no parameters,
102 but returns a (possibly empty) list of vendor-specific B<Build-Depends>.
104 =item builtin-build-conflicts ()
106 The hook is called when dpkg-checkbuilddeps is initializing the source
107 package build conflicts (since dpkg 1.18.2). It takes no parameters,
108 but returns a (possibly empty) list of vendor-specific B<Build-Conflicts>.
110 =item register-custom-fields ()
112 The hook is called in Dpkg::Control::Fields to register custom fields.
113 You should return a list of arrays. Each array is an operation to perform.
114 The first item is the name of the operation and corresponds
115 to a field_* function provided by Dpkg::Control::Fields. The remaining
116 fields are the parameters that are passed unchanged to the corresponding
119 Known operations are "register", "insert_after" and "insert_before".
121 =item post-process-changelog-entry ($fields)
123 The hook is called in Dpkg::Changelog to post-process a
124 Dpkg::Changelog::Entry after it has been created and filled with the
127 =item update-buildflags ($flags)
129 The hook is called in Dpkg::BuildFlags to allow the vendor to override
130 the default values set for the various build flags. $flags is a
131 Dpkg::BuildFlags object.
133 =item builtin-system-build-paths ()
135 The hook is called by dpkg-genbuildinfo to determine if the current path
136 should be recorded in the B<Build-Path> field (since dpkg 1.18.11). It takes
137 no parameters, but returns a (possibly empty) list of root paths considered
138 acceptable. As an example, if the list contains "/build/", a Build-Path
139 field will be created if the current directory is "/build/dpkg-1.18.0". If
140 the list contains "/", the path will always be recorded. If the list is
141 empty, the current path will never be recorded.
148 my ($self, $hook, @params) = @_;
150 if ($hook eq 'before-source-build') {
151 my $srcpkg = shift @params;
152 } elsif ($hook eq 'keyrings') {
153 warnings::warnif('deprecated', 'obsolete keyrings vendor hook');
155 } elsif ($hook eq 'package-keyrings') {
157 } elsif ($hook eq 'archive-keyrings') {
159 } elsif ($hook eq 'archive-keyrings-historic') {
161 } elsif ($hook eq 'register-custom-fields') {
163 } elsif ($hook eq 'builtin-build-depends') {
165 } elsif ($hook eq 'builtin-build-conflicts') {
167 } elsif ($hook eq 'post-process-changelog-entry') {
168 my $fields = shift @params;
169 } elsif ($hook eq 'extend-patch-header') {
170 my ($textref, $ch_info) = @params;
171 } elsif ($hook eq 'update-buildflags') {
172 my $flags = shift @params;
173 } elsif ($hook eq 'builtin-system-build-paths') {
177 # Default return value for unknown/unimplemented hooks
187 This is a private module.