1Dpkg::Deps(3perl) libdpkg-perl Dpkg::Deps(3perl)
2
3
4
6 Dpkg::Deps - parse and manipulate dependencies of Debian packages
7
9 The Dpkg::Deps module provides objects implementing various types of
10 dependencies.
11
12 The most important function is deps_parse(), it turns a dependency line
13 in a set of Dpkg::Deps::{Simple,AND,OR,Union} objects depending on the
14 case.
15
17 All the deps_* functions are exported by default.
18
19 deps_eval_implication($rel_p, $v_p, $rel_q, $v_q)
20 ($rel_p, $v_p) and ($rel_q, $v_q) express two dependencies as
21 (relation, version). The relation variable can have the following
22 values that are exported by Dpkg::Version: REL_EQ, REL_LT, REL_LE,
23 REL_GT, REL_GT.
24
25 This functions returns 1 if the "p" dependency implies the "q"
26 dependency. It returns 0 if the "p" dependency implies that "q" is
27 not satisfied. It returns undef when there's no implication.
28
29 The $v_p and $v_q parameter should be Dpkg::Version objects.
30
31 $dep = deps_concat(@dep_list)
32 This function concatenates multiple dependency lines into a single
33 line, joining them with ", " if appropriate, and always returning a
34 valid string.
35
36 $dep = deps_parse($line, %options)
37 This function parses the dependency line and returns an object,
38 either a Dpkg::Deps::AND or a Dpkg::Deps::Union. Various options
39 can alter the behaviour of that function.
40
41 use_arch (defaults to 1)
42 Take into account the architecture restriction part of the
43 dependencies. Set to 0 to completely ignore that information.
44
45 host_arch (defaults to the current architecture)
46 Define the host architecture. By default it uses
47 Dpkg::Arch::get_host_arch() to identify the proper
48 architecture.
49
50 build_arch (defaults to the current architecture)
51 Define the build architecture. By default it uses
52 Dpkg::Arch::get_build_arch() to identify the proper
53 architecture.
54
55 reduce_arch (defaults to 0)
56 If set to 1, ignore dependencies that do not concern the
57 current host architecture. This implicitly strips off the
58 architecture restriction list so that the resulting
59 dependencies are directly applicable to the current
60 architecture.
61
62 use_profiles (defaults to 1)
63 Take into account the profile restriction part of the
64 dependencies. Set to 0 to completely ignore that information.
65
66 build_profiles (defaults to no profile)
67 Define the active build profiles. By default no profile is
68 defined.
69
70 reduce_profiles (defaults to 0)
71 If set to 1, ignore dependencies that do not concern the
72 current build profile. This implicitly strips off the profile
73 restriction formula so that the resulting dependencies are
74 directly applicable to the current profiles.
75
76 reduce_restrictions (defaults to 0)
77 If set to 1, ignore dependencies that do not concern the
78 current set of restrictions. This implicitly strips off any
79 architecture restriction list or restriction formula so that
80 the resulting dependencies are directly applicable to the
81 current restriction. This currently implies "reduce_arch" and
82 "reduce_profiles", and overrides them if set.
83
84 union (defaults to 0)
85 If set to 1, returns a Dpkg::Deps::Union instead of a
86 Dpkg::Deps::AND. Use this when parsing non-dependency fields
87 like Conflicts.
88
89 build_dep (defaults to 0)
90 If set to 1, allow build-dep only arch qualifiers, that is
91 “:native”. This should be set whenever working with build-
92 deps.
93
94 tests_dep (defaults to 0)
95 If set to 1, allow tests-specific package names in
96 dependencies, that is "@" and "@builddeps@" (since dpkg
97 1.18.7). This should be set whenever working with dependency
98 fields from debian/tests/control.
99
100 $bool = deps_iterate($deps, $callback_func)
101 This function visits all elements of the dependency object, calling
102 the callback function for each element.
103
104 The callback function is expected to return true when everything is
105 fine, or false if something went wrong, in which case the iteration
106 will stop.
107
108 Return the same value as the callback function.
109
110 deps_compare($a, $b)
111 Implements a comparison operator between two dependency objects.
112 This function is mainly used to implement the sort() method.
113
115 There are several kind of dependencies. A Dpkg::Deps::Simple dependency
116 represents a single dependency statement (it relates to one package
117 only). Dpkg::Deps::Multiple dependencies are built on top of this
118 object and combine several dependencies in different manners.
119 Dpkg::Deps::AND represents the logical "AND" between dependencies while
120 Dpkg::Deps::OR represents the logical "OR". Dpkg::Deps::Multiple
121 objects can contain Dpkg::Deps::Simple object as well as other
122 Dpkg::Deps::Multiple objects.
123
124 In practice, the code is only meant to handle the realistic cases
125 which, given Debian's dependencies structure, imply those restrictions:
126 AND can contain Simple or OR objects, OR can only contain Simple
127 objects.
128
129 Dpkg::Deps::KnownFacts is a special object that is used while
130 evaluating dependencies and while trying to simplify them. It
131 represents a set of installed packages along with the virtual packages
132 that they might provide.
133
135 Version 1.06 (dpkg 1.18.7; module version bumped on dpkg 1.18.24)
136 New option: Add tests_dep option to Dpkg::Deps::deps_parse().
137
138 Version 1.05 (dpkg 1.17.14)
139 New function: Dpkg::Deps::deps_iterate().
140
141 Version 1.04 (dpkg 1.17.10)
142 New options: Add use_profiles, build_profiles, reduce_profiles and
143 reduce_restrictions to Dpkg::Deps::deps_parse().
144
145 Version 1.03 (dpkg 1.17.0)
146 New option: Add build_arch option to Dpkg::Deps::deps_parse().
147
148 Version 1.02 (dpkg 1.17.0)
149 New function: Dpkg::Deps::deps_concat()
150
151 Version 1.01 (dpkg 1.16.1)
152 <Used to document changes to Dpkg::Deps::* modules before they were
153 split.>
154
155 Version 1.00 (dpkg 1.15.6)
156 Mark the module as public.
157
158
159
1601.19.7 2020-02-18 Dpkg::Deps(3perl)