| OLD | NEW |
| (Empty) |
| 1 # Copyright © 2009 Raphaël Hertzog <hertzog@debian.org> | |
| 2 # | |
| 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. | |
| 7 # | |
| 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. | |
| 12 # | |
| 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/>. | |
| 15 | |
| 16 package Dpkg::Vendor::Default; | |
| 17 | |
| 18 use strict; | |
| 19 use warnings; | |
| 20 | |
| 21 our $VERSION = '0.01'; | |
| 22 | |
| 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); | |
| 26 | |
| 27 =encoding utf8 | |
| 28 | |
| 29 =head1 NAME | |
| 30 | |
| 31 Dpkg::Vendor::Default - default vendor object | |
| 32 | |
| 33 =head1 DESCRIPTION | |
| 34 | |
| 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). | |
| 39 | |
| 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 guaranty to be stable over an | |
| 43 extended period. If you run an important distribution that makes use | |
| 44 of vendor hooks, you'd better submit them for integration so that | |
| 45 we avoid breaking your code. | |
| 46 | |
| 47 =head1 FUNCTIONS | |
| 48 | |
| 49 =over 4 | |
| 50 | |
| 51 =item $vendor_obj = Dpkg::Vendor::Default->new() | |
| 52 | |
| 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. | |
| 55 | |
| 56 =cut | |
| 57 | |
| 58 sub new { | |
| 59 my ($this) = @_; | |
| 60 my $class = ref($this) || $this; | |
| 61 my $self = {}; | |
| 62 bless $self, $class; | |
| 63 return $self; | |
| 64 } | |
| 65 | |
| 66 =item $vendor_obj->run_hook($id, @params) | |
| 67 | |
| 68 Run the corresponding hook. The parameters are hook-specific. The | |
| 69 supported hooks are: | |
| 70 | |
| 71 =over 8 | |
| 72 | |
| 73 =item before-source-build ($srcpkg) | |
| 74 | |
| 75 The first parameter is a Dpkg::Source::Package object. The hook is called | |
| 76 just before the execution of $srcpkg->build(). | |
| 77 | |
| 78 =item keyrings () | |
| 79 | |
| 80 The hook is called when dpkg-source is checking a signature on a source | |
| 81 package. It takes no parameters, but returns a (possibly empty) list of | |
| 82 vendor-specific keyrings. | |
| 83 | |
| 84 =item register-custom-fields () | |
| 85 | |
| 86 The hook is called in Dpkg::Control::Fields to register custom fields. | |
| 87 You should return a list of arrays. Each array is an operation to perform. | |
| 88 The first item is the name of the operation and corresponds | |
| 89 to a field_* function provided by Dpkg::Control::Fields. The remaining | |
| 90 fields are the parameters that are passed unchanged to the corresponding | |
| 91 function. | |
| 92 | |
| 93 Known operations are "register", "insert_after" and "insert_before". | |
| 94 | |
| 95 =item post-process-changelog-entry ($fields) | |
| 96 | |
| 97 The hook is called in Dpkg::Changelog to post-process a | |
| 98 Dpkg::Changelog::Entry after it has been created and filled with the | |
| 99 appropriate values. | |
| 100 | |
| 101 =item update-buildflags ($flags) | |
| 102 | |
| 103 The hook is called in Dpkg::BuildFlags to allow the vendor to override | |
| 104 the default values set for the various build flags. $flags is a | |
| 105 Dpkg::BuildFlags object. | |
| 106 | |
| 107 =back | |
| 108 | |
| 109 =cut | |
| 110 | |
| 111 sub run_hook { | |
| 112 my ($self, $hook, @params) = @_; | |
| 113 | |
| 114 if ($hook eq 'before-source-build') { | |
| 115 my $srcpkg = shift @params; | |
| 116 } elsif ($hook eq 'keyrings') { | |
| 117 return (); | |
| 118 } elsif ($hook eq 'register-custom-fields') { | |
| 119 return (); | |
| 120 } elsif ($hook eq 'post-process-changelog-entry') { | |
| 121 my $fields = shift @params; | |
| 122 } elsif ($hook eq 'extend-patch-header') { | |
| 123 my ($textref, $ch_info) = @params; | |
| 124 } elsif ($hook eq 'update-buildflags') { | |
| 125 my $flags = shift @params; | |
| 126 } | |
| 127 | |
| 128 # Default return value for unknown/unimplemented hooks | |
| 129 return; | |
| 130 } | |
| 131 | |
| 132 =back | |
| 133 | |
| 134 =cut | |
| 135 | |
| 136 1; | |
| OLD | NEW |