summaryrefslogtreecommitdiffstats
path: root/src/build/tools/perl.modules/ToolInit.pm
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2015-12-18 14:40:51 -0600
committerStephen Cprek <smcprek@us.ibm.com>2016-02-19 17:06:05 -0600
commit875b7b11041874bd1f4ca2ecf595f14652cbdac8 (patch)
tree1d2de55ed2df6a7a8de8f606d1ce96faef012638 /src/build/tools/perl.modules/ToolInit.pm
parent3fd70a51b397987f839af987287f5afbb2fc087f (diff)
downloadtalos-hostboot-875b7b11041874bd1f4ca2ecf595f14652cbdac8.tar.gz
talos-hostboot-875b7b11041874bd1f4ca2ecf595f14652cbdac8.zip
Copy ekb tools and modules into hostboot
Change-Id: I4bb4fbd339e373fa15e2de15810f18421a9006f3 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22911 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/build/tools/perl.modules/ToolInit.pm')
-rw-r--r--src/build/tools/perl.modules/ToolInit.pm96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/build/tools/perl.modules/ToolInit.pm b/src/build/tools/perl.modules/ToolInit.pm
new file mode 100644
index 000000000..381acaabb
--- /dev/null
+++ b/src/build/tools/perl.modules/ToolInit.pm
@@ -0,0 +1,96 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/tools/perl.modules/ToolInit.pm $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2015
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+
+package ToolInit;
+
+use strict;
+use Getopt::Long qw(:config pass_through);
+use Switch;
+# Allow platform scripts to use init_globals
+use Exporter 'import';
+our @EXPORT = qw(init_globals $debug $help $module_script MASTER FETCH_HEAD);
+
+# Globals
+our $debug = 0;
+our $help = 0;
+our $module_script = "";
+my %globals = ( branch => "master");
+
+# Projects that use ToolInit
+use constant {
+ MASTER => "master",
+ FETCH_HEAD => "FETCH_HEAD",
+ EKB => "EKB",
+};
+
+# Global options for all infrastructure scripts/modules
+GetOptions("debug!" => \$debug,
+ "help" => \$help,
+ "module-script:s" => \$module_script,
+ "branch:s" => \$globals{branch});
+
+# sub init_globals
+#
+# Export global variables to all scripts/modules that need them
+#
+# @return hash - variables needed for infrastructure scripts
+#
+sub init_globals
+{
+ $globals{project_name} = $ENV{'PROJECT_NAME'};
+ $globals{remote_server} = $ENV{'GERRIT_SRV'};
+
+ if ($globals{project_name} eq "")
+ {
+ print "Environment not setup properly...\n\tRun 'source env.bash' or ";
+ print "'./$module_script workon' based on your current environment\n";
+ print "\tFor more info run './$module_script --help'\n";
+ die ();
+ }
+ project_settings();
+
+ return %globals;
+}
+
+# sub project_settings
+#
+# Set project specific settings for tools on any platform.
+# Project names are found via env variable set (e.g.in env.bash)
+# If project is not supported this fails, as supported must be added.
+#
+sub project_settings
+{
+ switch ($globals{project_name})
+ {
+ case (EKB)
+ {
+ $globals{gerrit_project} = "hw/ekb";
+ }
+ else
+ {
+ die "Project => $module_script not supported";
+ }
+ }
+} \ No newline at end of file
OpenPOWER on IntegriCloud