/usr/share/perl5/FCM/System.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 | # ------------------------------------------------------------------------------
# (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::System;
use base qw{FCM::Class::CODE};
use FCM::Util;
use Scalar::Util qw{reftype};
# Alias
our $S;
# The (keys) named actions of this class and (values) their implementations.
our %ACTION_OF = (
browse => _func('misc', sub {$S->browse(@_)}),
build => _func('old' , sub {$S->build(@_)}),
config_compare => _func('old' , sub {$S->config_compare(@_)}),
config_parse => _func('misc', sub {$S->config_parse(@_)}),
cm_branch_create => _func('cm' , sub {$S->cm_branch_create(@_)}),
cm_branch_delete => _func('cm' , sub {$S->cm_branch_delete(@_)}),
cm_branch_diff => _func('cm' , sub {$S->cm_branch_diff(@_)}),
cm_branch_info => _func('cm' , sub {$S->cm_branch_info(@_)}),
cm_branch_list => _func('cm' , sub {$S->cm_branch_list(@_)}),
cm_commit => _func('cm' , sub {$S->cm_commit(@_)}),
cm_checkout => _func('cm' , sub {$S->cm_checkout(@_)}),
cm_check_missing => _func('cm' , sub {$S->cm_check_missing(@_)}),
cm_check_unknown => _func('cm' , sub {$S->cm_check_unknown(@_)}),
cm_diff => _func('cm' , sub {$S->cm_diff(@_)}),
cm_loc_layout => _func('cm' , sub {$S->cm_loc_layout(@_)}),
cm_merge => _func('cm' , sub {$S->cm_merge(@_)}),
cm_mkpatch => _func('cm' , sub {$S->cm_mkpatch(@_)}),
cm_project_create => _func('cm' , sub {$S->cm_project_create(@_)}),
cm_resolve_conflicts => _func('cm' , sub {$S->cm_resolve_conflicts(@_)}),
cm_switch => _func('cm' , sub {$S->cm_switch(@_)}),
cm_update => _func('cm' , sub {$S->cm_update(@_)}),
export_items => _func('misc', sub {$S->export_items(@_)}),
extract => _func('old' , sub {$S->extract(@_)}),
keyword_find => _func('misc', sub {$S->keyword_find(@_)}),
make => _func('make', sub {$S->main(@_)}),
svn => _func('cm' , sub {$S->svn(@_)}),
util => sub {$_[0]->{util}},
);
# The (keys) named system and their implementation classes.
our %SYSTEM_CLASS_OF = (
cm => 'FCM::System::CM',
old => 'FCM::System::Old',
make => 'FCM::System::Make',
misc => 'FCM::System::Misc',
);
# Creates the class.
__PACKAGE__->class(
{ gui => '$',
system_class_of => {isa => '%', default => {%SYSTEM_CLASS_OF}},
system_of => '%',
util => '&',
},
{init => \&_init, action_of => {%ACTION_OF}},
);
# Initialises attributes.
sub _init {
my $attrib_ref = shift();
$attrib_ref->{util} = FCM::Util->new();
}
# Generates main functions.
sub _func {
my ($name, $code_ref) = @_;
sub {
my ($attrib_ref, @args) = @_;
if (!defined($attrib_ref->{system_of}{$name})) {
my $class_name = $attrib_ref->{system_class_of}{$name};
$attrib_ref->{util}->class_load($class_name);
$attrib_ref->{system_of}{$name} = $class_name->new({
gui => $attrib_ref->{gui},
util => $attrib_ref->{util},
});
}
local($S) = $attrib_ref->{system_of}{$name};
$code_ref->(@args);
};
}
# ------------------------------------------------------------------------------
1;
__END__
=head1 NAME
FCM::System
=head1 SYNOPSIS
use FCM::System;
$fcm = FCM::System->new();
# ...
$fcm->make(\%option, @args);
=head1 DESCRIPTION
Provides a top level interface to access the functionalities of the FCM system.
=head1 METHODS
=over 4
=item $class->new(\%attrib)
Returns a new instance. It also initialises the utility and sub-system classes.
The %attrib hash can be used configure the behaviour of the instance:
=over 4
=item event
A CODE to handle event.
=item gui
The GUI geometry of "fcm gui-internal".
=item system_class_of
A HASH to map (keys) sub-system names to (values) their implementation classes.
See %FCM::System::SYSTEM_CLASS_OF.
=item system_of
A HASH to map (keys) sub-system names to (values) their implementation instances.
=item util
An instance of L<FCM::Util|FCM::Util>.
=back
=item $fcm->browse(\%option,@args)
Invokes a browser to browse the sources in @args.
=item $fcm->build(\%option,@args)
(Obsolete) Invokes the FCM 1 build system.
=item $fcm->config_compare(\%option,@args)
(Obsolete) Compares 2 FCM 1 extract configuration files.
=item $fcm->config_parse(\%option,@args)
Parses a configuration file.
=item $fcm->cm_branch_create(\%option,@args)
Creates of a branch in a project in a Subversion repository with a standard FCM
layout.
=item $fcm->cm_branch_delete(\%option,@args)
Deletes of a branch in a project in a Subversion repository with a standard FCM
layout.
=item $fcm->cm_branch_diff(\%option,@args)
Displays the changes between a branch and its parent in a project in a
Subversion repository with a standard FCM layout.
=item $fcm->cm_branch_info(\%option,@args)
Displays information of a branch in a project in a Subversion repository with a
standard FCM layout.
=item $fcm->cm_branch_list(\%option,@args)
Lists branches in a project in a Subversion repository with a standard FCM
layout.
=item $fcm->cm_commit(\%option,@args)
Wraps C<svn commit>.
=item $fcm->cm_checkout(\%option,@args)
Wraps C<svn checkout>.
=item $fcm->cm_check_missing(\%option,@args)
Checks for missing status in a Subversion working copy.
=item $fcm->cm_check_unknown(\%option,@args)
Checks for unknown status in a Subversion working copy.
=item $fcm->cm_diff(\%option,@args)
Wraps C<svn diff>.
=item $fcm->cm_loc_layout(\%option,@args)
Parse and print layout information of each target in @args.
=item $fcm->cm_merge(\%option,@args)
Wraps C<svn merge>.
=item $fcm->cm_mkpatch(\%option,@args)
Creates FCM patches.
=item $fcm->cm_project_create(\%option,@args)
Create a new project in a Subversion repository.
=item $fcm->cm_resolve_conflicts(\%option,@args)
Invokes a graphic merge tool to resolve conflicts.
=item $fcm->cm_switch(\%option,@args)
Wraps C<svn switch>.
=item $fcm->cm_update(\%option,@args)
Wraps C<svn update>.
=item $fcm->export_items(\%option,@args)
Exports directories as versioned items in a branch of a project in a Subversion
repository with the standard FCM layout.
=item $fcm->extract(\%option,@args)
(Obsolete) Invokes the FCM 1 extract system.
=item $fcm->keyword_find(\%option,@args)
If @args is empty, search for all known FCM location keyword entries. Otherwise,
search for FCM location keyword entries matching the locations specified in
@args.
=item $fcm->make(\%option,@args)
Invokes the FCM make system.
=item $fcm->svn(\%option,@args)
Invokes C<svn> with @args. %option is ignored.
=item $fcm->util()
Returns the L<FCM::Util|FCM::Util> object.
=back
=head1 DIAGNOSTICS
=head2 FCM::System::Exception
This exception is a sub-class of L<FCM::Exception|FCM::Exception> and is thrown
by methods of this class on error.
=head1 COPYRIGHT
(C) Crown copyright Met Office. All rights reserved.
=cut
|