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