man: Add dpkg-build-api behavior for Rules-Requires-Root field defaults
[dpkg.git] / scripts / Dpkg / Control / Fields.pm
bloba70f30c401cad103820e3d74dedbc9c65f75e01b
1 # Copyright © 2007-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 =encoding utf8
18 =head1 NAME
20 Dpkg::Control::Fields - manage (list of official) control fields
22 =head1 DESCRIPTION
24 The module contains a list of vendor-neutral and vendor-specific field names
25 with associated meta-data explaining in which type of control information
26 they are allowed. The vendor-neutral field names and all functions are
27 inherited from L<Dpkg::Control::FieldsCore>.
29 =cut
31 package Dpkg::Control::Fields 1.00;
33 use strict;
34 use warnings;
36 our @EXPORT = @Dpkg::Control::FieldsCore::EXPORT;
38 use Carp;
39 use Exporter qw(import);
41 use Dpkg::Control::FieldsCore;
42 use Dpkg::Vendor qw(run_vendor_hook);
44 # Register vendor specifics fields
45 foreach my $op (run_vendor_hook('register-custom-fields')) {
46 next if not (defined $op and ref $op); # Skip when not implemented by vendor
47 my $func = shift @$op;
48 if ($func eq 'register') {
49 my ($field, $allowed_type, @opts) = @{$op};
50 field_register($field, $allowed_type, @opts);
51 } elsif ($func eq 'insert_before') {
52 my ($type, $ref, @fields) = @{$op};
53 field_insert_before($type, $ref, @fields);
54 } elsif ($func eq 'insert_after') {
55 my ($type, $ref, @fields) = @{$op};
56 field_insert_after($type, $ref, @fields);
57 } else {
58 croak "vendor hook register-custom-fields sent bad data: @$op";
62 =head1 CHANGES
64 =head2 Version 1.00 (dpkg 1.15.6)
66 Mark the module as public.
68 =cut