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 classes 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 virtual (defaults to 0)
90 If set to 1, allow only virtual package version relations, that
91 is none, or “=”. This should be set whenever working with
92 Provides fields.
93
94 build_dep (defaults to 0)
95 If set to 1, allow build-dep only arch qualifiers, that is
96 “:native”. This should be set whenever working with build-
97 deps.
98
99 tests_dep (defaults to 0)
100 If set to 1, allow tests-specific package names in
101 dependencies, that is "@" and "@builddeps@" (since dpkg
102 1.18.7). This should be set whenever working with dependency
103 fields from debian/tests/control.
104
105 $bool = deps_iterate($deps, $callback_func)
106 This function visits all elements of the dependency object, calling
107 the callback function for each element.
108
109 The callback function is expected to return true when everything is
110 fine, or false if something went wrong, in which case the iteration
111 will stop.
112
113 Return the same value as the callback function.
114
115 deps_compare($a, $b)
116 Implements a comparison operator between two dependency objects.
117 This function is mainly used to implement the sort() method.
118
120 There are several kind of dependencies. A Dpkg::Deps::Simple dependency
121 represents a single dependency statement (it relates to one package
122 only). Dpkg::Deps::Multiple dependencies are built on top of this
123 class and combine several dependencies in different manners.
124 Dpkg::Deps::AND represents the logical "AND" between dependencies while
125 Dpkg::Deps::OR represents the logical "OR". Dpkg::Deps::Multiple
126 objects can contain Dpkg::Deps::Simple object as well as other
127 Dpkg::Deps::Multiple objects.
128
129 In practice, the code is only meant to handle the realistic cases
130 which, given Debian's dependencies structure, imply those restrictions:
131 AND can contain Simple or OR objects, OR can only contain Simple
132 objects.
133
134 Dpkg::Deps::KnownFacts is a special class that is used while evaluating
135 dependencies and while trying to simplify them. It represents a set of
136 installed packages along with the virtual packages that they might
137 provide.
138
140 Version 1.07 (dpkg 1.20.0)
141 New option: Add virtual option to Dpkg::Deps::deps_parse().
142
143 Version 1.06 (dpkg 1.18.7; module version bumped on dpkg 1.18.24)
144 New option: Add tests_dep option to Dpkg::Deps::deps_parse().
145
146 Version 1.05 (dpkg 1.17.14)
147 New function: Dpkg::Deps::deps_iterate().
148
149 Version 1.04 (dpkg 1.17.10)
150 New options: Add use_profiles, build_profiles, reduce_profiles and
151 reduce_restrictions to Dpkg::Deps::deps_parse().
152
153 Version 1.03 (dpkg 1.17.0)
154 New option: Add build_arch option to Dpkg::Deps::deps_parse().
155
156 Version 1.02 (dpkg 1.17.0)
157 New function: Dpkg::Deps::deps_concat()
158
159 Version 1.01 (dpkg 1.16.1)
160 <Used to document changes to Dpkg::Deps::* modules before they were
161 split.>
162
163 Version 1.00 (dpkg 1.15.6)
164 Mark the module as public.
165
166
167
1681.20.9 2021-07-21 Dpkg::Deps(3perl)