1Dpkg::Control::FieldsCore(3perl) libdpkg-perl Dpkg::Control::FieldsCore(3perl)
2
3
4
6 Dpkg::Control::FieldsCore - manage (list of official) control fields
7
9 The modules contains a list of fieldnames with associated meta-data
10 explaining in which type of control information they are allowed. The
11 types are the CTRL_* constants exported by Dpkg::Control.
12
14 $f = field_capitalize($field_name)
15 Returns the field name properly capitalized. All characters are
16 lowercase, except the first of each word (words are separated by a
17 hyphen in field names).
18
19 $bool = field_is_official($fname)
20 Returns true if the field is official and known.
21
22 $bool = field_is_allowed_in($fname, @types)
23 Returns true (1) if the field $fname is allowed in all the types
24 listed in the list. Note that you can use type sets instead of
25 individual types (ex: CTRL_FILE_CHANGES | CTRL_CHANGELOG).
26
27 field_allowed_in(A|B, C) returns true only if the field is allowed
28 in C and either A or B.
29
30 Undef is returned for non-official fields.
31
32 $new_field = field_transfer_single($from, $to, $field)
33 If appropriate, copy the value of the field named $field taken from
34 the $from Dpkg::Control object to the $to Dpkg::Control object.
35
36 Official fields are copied only if the field is allowed in both
37 types of objects. Custom fields are treated in a specific manner.
38 When the target is not among CTRL_PKG_SRC, CTRL_PKG_DEB or
39 CTRL_FILE_CHANGES, then they are always copied as is (the X- prefix
40 is kept). Otherwise they are not copied except if the target object
41 matches the target destination encoded in the field name. The
42 initial X denoting custom fields can be followed by one or more
43 letters among "S" (Source: corresponds to CTRL_PKG_SRC), "B"
44 (Binary: corresponds to CTRL_PKG_DEB) or "C" (Changes: corresponds
45 to CTRL_FILE_CHANGES).
46
47 Returns undef if nothing has been copied or the name of the new
48 field added to $to otherwise.
49
50 @field_list = field_transfer_all($from, $to)
51 Transfer all appropriate fields from $from to $to. Calls
52 field_transfer_single() on all fields available in $from.
53
54 Returns the list of fields that have been added to $to.
55
56 @field_list = field_ordered_list($type)
57 Returns an ordered list of fields for a given type of control
58 information. This list can be used to output the fields in a
59 predictable order. The list might be empty for types where the
60 order does not matter much.
61
62 ($source, $version) = field_parse_binary_source($ctrl)
63 Parse the Source field in a binary package control stanza. The
64 field contains the source package name where it was built from, and
65 optionally a space and the source version enclosed in parenthesis
66 if it is different from the binary version.
67
68 Returns a list with the $source name, and the source $version, or
69 undef or an empty list when $ctrl does not contain a binary package
70 control stanza. Neither $source nor $version are validated, but
71 that can be done with Dpkg::Package::pkg_name_is_illegal() and
72 Dpkg::Version::version_check().
73
74 @field_list = field_list_src_dep()
75 List of fields that contains dependencies-like information in a
76 source Debian package.
77
78 @field_list = field_list_pkg_dep()
79 List of fields that contains dependencies-like information in a
80 binary Debian package. The fields that express real dependencies
81 are sorted from the stronger to the weaker.
82
83 $dep_type = field_get_dep_type($field)
84 Return the type of the dependency expressed by the given field. Can
85 either be "normal" for a real dependency field (Pre-Depends,
86 Depends, ...) or "union" for other relation fields sharing the
87 same syntax (Conflicts, Breaks, ...). Returns undef for fields
88 which are not dependencies.
89
90 $sep_type = field_get_sep_type($field)
91 Return the type of the field value separator. Can be one of
92 FIELD_SEP_UNKNOWN, FIELD_SEP_SPACE, FIELD_SEP_COMMA or
93 FIELD_SEP_LINE.
94
95 field_register($field, $allowed_types, %opts)
96 Register a new field as being allowed in control information of
97 specified types. %opts is optional.
98
99 $bool = field_insert_after($type, $ref, @fields)
100 Place field after another one ($ref) in output of control
101 information of type $type.
102
103 Return true if the field was inserted, otherwise false.
104
105 $bool = field_insert_before($type, $ref, @fields)
106 Place field before another one ($ref) in output of control
107 information of type $type.
108
109 Return true if the field was inserted, otherwise false.
110
112 Version 1.01 (dpkg 1.21.0)
113 New function: field_parse_binary_source().
114
115 Version 1.00 (dpkg 1.17.0)
116 Mark the module as public.
117
118
119
1201.21.9 2022-08-04 Dpkg::Control::FieldsCore(3perl)