1Test::AutoBuild::RuntimUes(e3r)Contributed Perl DocumentTaetsito:n:AutoBuild::Runtime(3)
2
3
4
6 Test::AutoBuild::Runtime - Builder runtime state
7
9 use Test::AutoBuild::Runtime;
10
11 my $runtime = new Test::AutoBuild::Runtime (archive_manager => $archive_manager,
12 monitors => \%monitors,
13 repositories => \%repositories,
14 modules => \%modules,
15 package_types => \%package_types,
16 publishers => \%publishers,
17 groups => \%groups,
18 platforms => \%platforms,
19 source_root => $dir,
20 install_root => $dir,
21 package_root => $dir,
22 log_root => $dir,
23 counter => $counter);
24
25 my $archive = $runtime->archive;
26
27 my @monitor_names = $runtime->monitors;
28 my @repository_names = $runtime->repositories;
29 my @module_names = $runtime->modules;
30 my @package_types_names = $runtime->package_types;
31 my @publisher_names = $runtime->publishers;
32 my @group_names = $runtime->groups;
33 my @platform_names = $runtime->platforms;
34
35 my $monitor = $runtime->monitor($name);
36 my $repository = $runtime->repository($name);
37 my $module = $runtime->module($name);
38 my $package_type = $runtime->package_type($name);
39 my $publisher = $runtime->publisher($name);
40 my $group = $runtime->group($name);
41 my $platform = $runtime->platform($name);
42
43 $runtime->attribute($key, $value);
44 my $value = $runtime->attribute($key);
45 my %attributes = $runtime->attributes()
46
47 my $dir = $runtime->source_root();
48 my $dir = $runtime->install_root();
49 my $dir = $runtime->package_root();
50 my $dir = $runtime->log_root();
51
53 This module provides access to the core objects comprising the build
54 engine, including monitors, repositories, modules, package types, pub‐
55 lishers and groups. The runtime state object is made available to the
56 "run" method of stages in the build engine.
57
59 my $runtime = Test::AutoBuild::Runtime->new(archive => $archive, moni‐
60 tors => \%monitors, repositories => \%repositories, modules => \%mod‐
61 ules, package_types => \%package_types, publishers => \%publishers,
62 groups => \%groups, platforms => \%platforms, source_root => $dir,
63 counter => $counter);
64 Creates a new runtime state object. The "archive" parameter
65 requires an instance of the Test::AutoBuild::Archive module. The
66 "monitors" parameter requires an hash reference of Test::Auto‐
67 Build::Monitor objects. The "monitors" parameter requires an hash
68 reference of Test::AutoBuild::Repository objects. The "reposito‐
69 ries" parameter requires an hash reference of Test::AutoBuild::Mod‐
70 ule objects. The "package_types" parameter requires an hash refer‐
71 ence of Test::AutoBuild::PackageType objects. The "publishers"
72 parameter requires an hash reference of Test::AutoBuild::Publisher
73 objects. The "groups" parameter requires an hash reference of
74 Test::AutoBuild::Group objects. The "platforms" parameter requires
75 an hash reference of Test::AutoBuild::Platform objects.
76
77 $runtime->_sort_modules()
78 Regenerates the internally cached sorted list of modules, by per‐
79 forming a topological sort of modules against their declared build
80 dependancies. There is generally no need to call this method.
81
82 my $archive = $runtime->archive_manager;
83 Returns an instance of the Test::AutoBuild::ArchiveManager module
84 to use for persisting build state across cycles.
85
86 my $archive = $runtime->archive;
87 Returns the active archive object
88
89 my $monitor_names = $runtime->monitors;
90 Returns a list of monitor names, which can be used to retrieve a
91 Test::AutoBuild::Monitor object from the "monitor" method.
92
93 my $monitor = $runtime->monitor($name);
94 Retrieves the Test::AutoBuild::Monitor object corresponding to the
95 name specified by the $name parameter.
96
97 my $repository_names = $runtime->repositories;
98 Returns a list of repository names, which can be used to retrieve a
99 Test::AutoBuild::Repository object from the "repository" method.
100
101 my $repository = $runtime->repository($name);
102 Retrieves the Test::AutoBuild::Repository object corresponding to
103 the name specified by the $name parameter.
104
105 my $module_names = $runtime->modules;
106 Returns a list of module names, which can be used to retrieve a
107 Test::AutoBuild::Module object from the "module" method.
108
109 my $module_names = $runtime->sorted_modules;
110 Returns a list of module names, sorted topologically according to
111 their declared build dependancies. The names can be used to
112 retrieve a Test::AutoBuild::Module object from the "module" method.
113
114 my $module = $runtime->module($name);
115 Retrieves the Test::AutoBuild::Module object corresponding to the
116 name specified by the $name parameter.
117
118 my $package_type_names = $runtime->package_types;
119 Returns a list of package type names, which can be used to retrieve
120 a Test::AutoBuild::PackageType object from the "package_type"
121 method.
122
123 my $package_type = $runtime->package_type($name);
124 Retrieves the Test::AutoBuild::PackageType object corresponding to
125 the name specified by the $name parameter.
126
127 my $publisher_names = $runtime->publishers;
128 Returns a list of publisher names, which can be used to retrieve a
129 Test::AutoBuild::Publisher object from the "publisher" method.
130
131 my $publisher = $runtime->publisher($name);
132 Retrieves the Test::AutoBuild::Publisher object corresponding to
133 the name specified by the $name parameter.
134
135 my $group_names = $runtime->groups;
136 Returns a list of group names, which can be used to retrieve a
137 Test::AutoBuild::Group object from the "group" method.
138
139 my $group = $runtime->group($name);
140 Retrieves the Test::AutoBuild::Group object corresponding to the
141 name specified by the $name parameter.
142
143 my $platform_names = $runtime->platforms;
144 Returns a list of platform names, which can be used to retrieve a
145 Test::AutoBuild::Platform object from the "platform" method.
146
147 my $platform = $runtime->platform($name);
148 Retrieves the Test::AutoBuild::Platform object corresponding to the
149 name specified by the $name parameter.
150
151 my $value = $runtime->attribute($name[, $value]);
152 Retrieves the attribute value corresponding to the key given in the
153 $name parameter. If the optional $value parameter is supplied, then
154 the attribute value is set.
155
156 my @names = $runtime->attributes;
157 Returns the names of the runtime attributes passed between stages
158
159 my $build_counter = $runtime->build_counter;
160 Returns the unique counter for this cycle of the builder
161
162 my $timestamp = $runtime->timestamp;
163 Returns the time to which the source repositories are synchronized
164
165 $runtime->notify($event_name, @args);
166 Notify all monitors about the event specified by the $event_name
167 parameter. The following @args are event dependant and passed
168 through to monitors unchanged.
169
170 my $dir = $runtime->source_root();
171 Retrieve the directory in which modules' sources are checked out
172 from the repositories
173
174 my $dir = $runtime->install_root();
175 Retrieve the directory into which modules install built files.
176
177 my $dir = $runtime->package_root();
178 Retrieve the directory in which binary packages are placed.
179
180 my $dir = $runtime->log_root();
181 Retrieve the directory in which log files are placed.
182
183 my \%packages = $runtime->package_snapshot();
184 Takes a snapshot of all packages on disk for each package type. The
185 keys in the returned hash ref will be the fully qualified filenames
186 of the packages, while the values will be instances of Test::Auto‐
187 Build::Package class.
188
189 my @values = $runtime->expand_macros($value[, \%restrictions]);
190 Replaces macros of the form %key in the string provided in the
191 $value argument. A macro can expand to multiple values, so the sin‐
192 gle input, can turn into multiple outputs, hence the return from
193 this method is an array of strings. A macro which usually expands
194 to multiple values can be restricted to a single value by specify‐
195 ing the value in the optional %restrictions parameter.
196
197 The macros which will be expanded are:
198
199 %m List of modules, or the 'module' entry in the %restrictions
200 parameter
201
202 %p List of package types, or the 'package_type' entry in the
203 %restrictions parameter
204
205 %g List of groups, or the 'group' entry in the %restrictions
206 parameter
207
208 %r List of repositories, or the 'reposiry' entry in the %restric‐
209 tions parameter
210
211 %h Hostname of the builder
212
213 %c Build cycle counter
214
215 my %env = $module->get_shell_environment($module);
216 Returns a hash containing the set of shell environment variables to
217 set when running the commands for the module $module. The following
218 environment variables are set
219
220 $AUTO_BUILD_ROOT
221 Legacy variable for compatability with Test-AutoBuild 1.0.x.
222 Use $AUTOBUILD_INSTALL_ROOT instead.
223
224 $AUTO_BUILD_COUNTER
225 Legacy variable for compatability with Test-AutoBuild 1.0.x.
226 Use $AUTOBUILD_COUNTER instead.
227
228 $AUTOBUILD_INSTALL_ROOT
229 The location into which a module will install its files, typi‐
230 cally used as value for --prefix argument to configure scripts.
231 This is based on the value return by the "install_root" method.
232
233 $AUTOBUILD_PACKAGE_ROOT
234 The location into which a module will create binary packages.
235 For example, $AUTOBUILD_PACKAGE_ROOT/rpm would be used to set
236 %_topdir when building RPMs. This is based on the value return
237 by the "package_root" method.
238
239 $AUTOBUILD_SOURCE_ROOT
240 The location into which the module was checked out. This is
241 based on the value return by the "install_root" method.
242
243 $AUTOBUILD_MODULE
244 The name of the module being built. This can be used in con‐
245 junction with the $AUTOBUILD_SOURCE_ROOT to determine the top
246 level directory of the module's source.
247
248 $AUTOBUILD_COUNTER
249 The build counter value, based on the value return by the
250 "build_counter" method. This counter is not guarenteed to be
251 different on each build cycle
252
253 $AUTOBUILD_TIMESTAMP
254 The build counter value, based on the value return by the
255 "build_counter" method. This counter will uniquely refer to a
256 particular checkout of the source code.
257
258 The returned hash will also include module specific environment
259 entries from the "env" method.
260
262 Daniel P. Berrange <dan@berrange.com>
263
265 Copyright (C) 2005 Daniel Berrange <dan@berrange.com>
266
268 perl(1), Test::AutoBuild::Stage, Test::AutoBuild::Module, Test::Auto‐
269 Build::Repository, Test::AutoBuild::PackageType, Test::AutoBuild::Moni‐
270 tor, Test::AutoBuild::Group, Test::AutoBuild::Publisher
271
272
273
274perl v5.8.8 2007-12-09 Test::AutoBuild::Runtime(3)