/usr/share/perl5/FCM/Context/Make/Build.pm is in fcm 2016.12.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | # ------------------------------------------------------------------------------
# (C) British Crown Copyright 2006-16 Met Office.
#
# This file is part of FCM, tools for managing and building source code.
#
# FCM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FCM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FCM. If not, see <http://www.gnu.org/licenses/>.
# ------------------------------------------------------------------------------
use strict;
use warnings;
# ------------------------------------------------------------------------------
package FCM::Context::Make::Build;
use base qw{FCM::Class::HASH};
use FCM::Context::Make;
use constant {
CTX_SOURCE => 'FCM::Context::Make::Build::Source',
CTX_TARGET => 'FCM::Context::Make::Build::Target',
ID_OF_CLASS => 'build',
};
my $ST_UNKNOWN = FCM::Context::Make->ST_UNKNOWN;
__PACKAGE__->class(
{ dest => '$',
dests => '@',
id => {isa => '$' , default => ID_OF_CLASS},
id_of_class => {isa => '$' , default => ID_OF_CLASS},
input_ns_excl => '@',
input_ns_incl => '@',
input_source_of => '%',
prop_of => '%',
source_of => '%',
status => {isa => '$' , default => $ST_UNKNOWN},
target_of => '%',
target_key_of => '%',
target_select_by => '%',
},
);
# ------------------------------------------------------------------------------
package FCM::Context::Make::Build::Source;
use base qw{FCM::Class::HASH};
__PACKAGE__->class({
checksum => '$',
deps => '@',
info_of => '%',
ns => '$',
path => '$',
prop_of => '%',
type => '$',
up_to_date => '$',
});
# ------------------------------------------------------------------------------
package FCM::Context::Make::Build::Target;
use base qw{FCM::Class::HASH};
use constant {
CT_BIN => 'bin',
CT_ETC => 'etc',
CT_INCLUDE => 'include',
CT_LIB => 'lib',
CT_O => 'o',
CT_SRC => 'src',
POLICY_CAPTURE => 'POLICY_CAPTURE',
POLICY_FILTER => 'POLICY_FILTER',
POLICY_FILTER_IMMEDIATE => 'POLICY_FILTER_IMMEDIATE',
ST_FAILED => 'ST_FAILED',
ST_MODIFIED => 'ST_MODIFIED',
ST_OOD => 'ST_OOD',
ST_UNCHANGED => 'ST_UNCHANGED',
ST_UNKNOWN => 'ST_UNKNOWN',
};
__PACKAGE__->class(
{ category => '$',
checksum => '$',
deps => '@',
dep_policy_of => '%',
failed_by => '@',
info_of => '%',
key => '$',
ns => '$',
path => '$',
path_of_prev => '$',
path_of_source => '$',
prop_of => '%',
prop_of_prev_of => '%',
status => {isa => '$', default => ST_UNKNOWN},
status_of => '%',
task => '$',
triggers => '@',
type => '$',
},
);
# Returns true if target has a usable dest status.
sub can_be_source {
$_[0]->get_category() && $_[0]->get_category() eq CT_SRC;
}
# Returns true if target has an OK status.
sub is_ok {
$_[0]->get_status() eq ST_MODIFIED || $_[0]->get_status() eq ST_UNCHANGED;
}
# Returns true if target has a failed status.
sub is_failed {
$_[0]->get_status() eq ST_FAILED;
}
# Shorthand for $target->get_status() eq $target->ST_MODIFIED.
sub is_modified {
$_[0]->get_status() eq ST_MODIFIED;
}
# Shorthand for $target->get_status() eq $target->ST_UNCHANGED.
sub is_unchanged {
$_[0]->get_status() eq ST_UNCHANGED;
}
# ------------------------------------------------------------------------------
1;
__END__
=head1 NAME
FCM::Context::Make::Build
=head1 SYNOPSIS
use FCM::Context::Make::Build;
my $ctx = FCM::Context::Make::Build->new();
=head1 DESCRIPTION
Provides a context object for the FCM build system. All the classes described
below are sub-classes of L<FCM::Class::HASH|FCM::Class::HASH>.
=head1 OBJECTS
=head2 FCM::Context::Make::Build
An instance of this class represents a build. It has the following
attributes:
=over 4
=item dest
The destination of the build.
=item dests
An ARRAY containing the path for searching items in the current build.
=item id
The ID of the context. (default="build")
=item id_of_class
The class ID of the context. (default="build")
=item input_source_of
A HASH to map a name space to its ARRAY of input sources.
=item input_ns_excl
An ARRAY of source name-spaces to exclude.
=item input_ns_incl
An ARRAY of source name-spaces to include.
=item prop_of
A HASH containing the named properties (i.e. options and settings of named
external tools). Expects a value to be an instance of
L<FCM::Context::Make::Share::Property|FCM::Context::Make::Share::Property>.
=item prop_of_prev_of
A HASH containing the named properties (i.e. options and settings of named
external tools) in the latest successful update of this target. Expects a value
to be an instance of
L<FCM::Context::Make::Share::Property|FCM::Context::Make::Share::Property>.
=item source_of
A HASH to map the namespace to the source contexts. Each element is expected to
be an L</FCM::Context::Make::Build::Source> object.
=item status
The status of this context. See L<FCM::Context::Make|FCM::Context::Make> for the
status constants.
=item target_of
A HASH to map the namespace to the target contexts. Each element is expected to
be an L</FCM::Context::Make::Build::Target> object.
=item target_key_of
A HASH to map the automatic key of targets to their desired key.
=item target_select_by
A HASH to allow users to specify how to select from all the targets. The key can
be "category", "key", "ns" or "task". Each value should be a HASH that
represents the set of criteria.
=back
=head2 FCM::Context::Make::Build::Source
An instance of this class represents an actual source of the build. It has the
following attributes:
=over 4
=item checksum
The checksum of the source file.
=item deps
An ARRAY to contain the dependencies of the source file. Each element of the
ARRAY is expected to be a reference to a two-element ARRAY [$name, $type] where
$name is the name of the dependency and $type is its type.
=item info_of
A HASH to contain the extra information of the source file. E.g. If the {main}
element is true, the source contains a main program. If the {symbols} element
is defined, it contains a reference to an ARRAY of program unit symbols that has
been found in the source file.
=item ns
The name-space of the source file.
=item path
The path in the file system pointing to the source file.
=item prop_of
A HASH containing the keys and the values of the build properties (mainly on
dependency settings) of the source.
=item type
The file type of the source file.
=item up_to_date
A flag to indicate whether the source file is up to date, compared with a
previous build or the nearest inherited build.
=back
=head2 FCM::Context::Make::Build::Target
An instance of this class represents a target of the build. It has the following
attributes:
=over 4
=item category
The target category, e.g. bin, etc, include, lib, o, src
=item checksum
The checksum of the target.
=item deps
An ARRAY containing the dependencies of the target. Each element of the
ARRAY is expected to be a reference to a two-element ARRAY [$name, $type] where
$name is the name of the dependency and $type is its type.
=item dep_policy_of
A HASH to contain a map between each relevant dependency type of this target and
its policy to apply to the dependency type. The policy should take the value of
POLICY_CAPTURE, POLICY_FILTER or POLICY_FILTER_IMMEDIATE.
=item failed_by
On failure, set to an ARRAY containing the names of the targets that cause the
failure of this target.
=item info_of
A HASH to contain the extra information of the target. E.g. The {paths} => ARRAY
reference of include/object search paths for the compile, link and preprocess
tasks; and {deps}{o} => ARRAY reference and {deps}{o.special} => ARRAY
reference of object dependency for the link tasks.
=item key
The key (i.e. the base name) of the target.
=item ns
The name-space (of the source file) associated with this target.
=item path
The path in the file system where the target can be located.
=item path_of_prev
The path in the file system where the target in a previous or inherited build
can be located.
=item path_of_source
The path in the file system where the source file associated with the target can
be located.
=item prop_of
A HASH containing the keys and the values of the build properties of the target.
=item status
The status of the target.
=item status_of
A HASH containing the status of dependency types that may be relevant to targets
higher up in the dependency tree.
=item task
The target type, (i.e. the name of the task to update with the target).
=item triggers
An ARRAY reference of the keys of targets that should be automatically triggered
by this target.
=item type
The type of the source that gives this target.
=back
In addition, an instance of FCM::Context::Make::Extract::Target has the
following methods:
=over 4
=item $target->can_be_source()
Returns true if the destination status indicates that the target is usable as a
source file of a subsequent a make (step).
=item $target->is_ok()
Returns true if the target has a OK destination status.
=item $target->is_failed()
Returns true if the target has a failed destination status.
=item $target->is_modified()
Shorthand for $target->get_status() eq $target->ST_MODIFIED.
=item $target->is_unchanged()
Shorthand for $target->get_status() eq $target->ST_UNCHANGED.
=back
=head1 CONSTANTS
The following is a list of constants:
=over 4
=item FCM::Context::Make::Build->CTX_INPUT
Alias of FCM::Context::Make::Build::Input.
=item FCM::Context::Make::Build->CTX_SOURCE
Alias of FCM::Context::Make::Build::Source.
=item FCM::Context::Make::Build->ID_OF_CLASS
The default value of the "id" attribute (of an instance), and the ID of the
functional class. ("build")
=item FCM::Context::Make::Build::Target->CT_BIN
Target category, "bin", executable.
=item FCM::Context::Make::Build::Target->CT_ETC
Target category, "etc", data and misc file.
=item FCM::Context::Make::Build::Target->CT_INCLUDE
Target category, "include", include file.
=item FCM::Context::Make::Build::Target->CT_LIB
Target category, "lib", program library.
=item FCM::Context::Make::Build::Target->CT_O
Target category, "o", compiled object file.
=item FCM::Context::Make::Build::Target->CT_SRC
Target category, "src", generated source file.
=item FCM::Context::Make::Build::Target->POLICY_CAPTURE
Indicates that the dependency type is relevant to the target, and the build
engine should stop floating the dependency target up the dependency tree.
=item FCM::Context::Make::Build::Target->POLICY_FILTER
Indicates that the dependency type is relevant to the target, and the build
engine may float the dependency target up the dependency tree as well.
=item FCM::Context::Make::Build::Target->POLICY_FILTER_IMMEDIATE
Indicates that the dependency type is relevant to the target but only if the
dependency target is an immediate dependency of this target, and the build
engine may float the dependency target up the dependency tree as well.
=item FCM::Context::Make::Build::Target->ST_FAILED
Indicates that the build has failed to update the target.
=item FCM::Context::Make::Build::Target->ST_MODIFIED
Indicates that the target is out of date and has been modified by the build.
=item FCM::Context::Make::Build::Target->ST_OOD
Indicates that the target is out of date.
=item FCM::Context::Make::Build::Target->ST_UNCHANGED
Indicates that the target is up to date and unchanged by the build.
=item FCM::Context::Make::Build::Target->ST_UNKNOWN
Indicates an unknown target status.
=back
=head1 COPYRIGHT
(C) Crown copyright Met Office. All rights reserved.
=cut
|