summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2015-04-27 15:02:25 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-09-01 16:18:32 -0500
commit4ae690e4eeb9297ed59ff932cc4184d23896234d (patch)
treeb3205f1b84aff7dbad3f949c78fe6e4c08067368 /src
parent0795cc6781a4d937786b39c23b655397432ec90e (diff)
downloadtalos-hostboot-4ae690e4eeb9297ed59ff932cc4184d23896234d.tar.gz
talos-hostboot-4ae690e4eeb9297ed59ff932cc4184d23896234d.zip
Generalize env vars, env setup, and copyright scripts
Methods ported over from code in EKB. Change-Id: I26b6f2326314936b0316f64272230730ecd3f9ee RTC: 126634 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17465 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/citest/autocitest8
-rwxr-xr-xsrc/build/citest/build-errl-parsers6
-rwxr-xr-xsrc/build/citest/build-script8
-rwxr-xr-xsrc/build/citest/check-copyright6
-rwxr-xr-xsrc/build/citest/cxxtest-start.sh4
-rwxr-xr-xsrc/build/citest/etc/workarounds.postsimsetup2
-rwxr-xr-xsrc/build/citest/setup-env8
-rwxr-xr-xsrc/build/debug/Hostboot/Gcov.pm6
-rwxr-xr-xsrc/build/debug/Hostboot/_DebugFramework.pm2
-rwxr-xr-xsrc/build/debug/memalloc.pl6
-rwxr-xr-xsrc/build/simics/combined.simics10
-rwxr-xr-xsrc/build/tools/addCopyright.pl79
-rwxr-xr-xsrc/build/tools/gerrit-hostname79
-rwxr-xr-xsrc/build/tools/hb46
-rwxr-xr-xsrc/build/tools/hbGenConfig6
-rwxr-xr-xsrc/build/tools/post-commit10
-rwxr-xr-xsrc/build/tools/pre-commit10
-rwxr-xr-xsrc/build/tools/pre-commit-actions50
-rwxr-xr-xsrc/build/tools/setupgithooks.sh14
-rwxr-xr-xsrc/build/tools/verify-commit4
20 files changed, 243 insertions, 121 deletions
diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest
index 16a1e33fb..922bd9627 100755
--- a/src/build/citest/autocitest
+++ b/src/build/citest/autocitest
@@ -76,7 +76,7 @@ function runtraceHB()
{
echo "Collect traceHB info..."
-
+
#autosim $NOWIN --simcmd "run-python-file ${SBXHOME}/src/build/simics/hb-simdebug.py"
#if [ $? -ne 0 ] ; then
# echo "ERROR 3: Unable to run $?"
@@ -84,7 +84,7 @@ function runtraceHB()
# stopserver
# exit 1
#fi
-
+
autosim $NOWIN --simcmd "pipe hb-trace \"cat > traceHB.log\"" \
--timeout 300
if [ $? -ne 0 ] ; then
@@ -112,13 +112,13 @@ DRIVER="$1" ## backing tree
export bb=$DRIVER ## simulate a workon
HBICORE_TEST="$2" ## path to hbicore_test.img
-export SHELL="/bin/bash" ## Needed to fool workon to launch a bash
+export SHELL="/bin/bash" ## Needed to fool workon to launch a bash
## shell, which autosim expects.
NOWIN="--nowin" ## remote execution does not have a display
## jenkins creates a new workspace for every compile.
## cxxtest-start.sh will verify this and then export WORKSPACE_DIR for us.
-SBXHOME=$HOSTBOOTROOT
+SBXHOME=$PROJECT_ROOT
if [ "$DRIVER" = "" ] ; then
echo "ERROR: you must specify a driver (backing tree) to run the tests with"
diff --git a/src/build/citest/build-errl-parsers b/src/build/citest/build-errl-parsers
index ae5379cfa..f55418dd2 100755
--- a/src/build/citest/build-errl-parsers
+++ b/src/build/citest/build-errl-parsers
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2014
+# Contributors Listed Below - COPYRIGHT 2014,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.
@@ -26,7 +28,7 @@ echo "====Building error log parsers===="
if [ -z $HOSTBOOT_CI_ENV_SETUP ];
then
- source "$HOSTBOOTROOT/src/build/citest/setup-env"
+ source "$PROJECT_ROOT/src/build/citest/setup-env"
fi
if [ ! -d "$SANDBOXBASE" ];
diff --git a/src/build/citest/build-script b/src/build/citest/build-script
index 1f0628909..798c2055b 100755
--- a/src/build/citest/build-script
+++ b/src/build/citest/build-script
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2014
+# Contributors Listed Below - COPYRIGHT 2014,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.
@@ -22,11 +24,11 @@
#
# IBM_PROLOG_END_TAG
-if [ -z $HOSTBOOTROOT ]; then
+if [ -z $PROJECT_ROOT ]; then
source "$WORKSPACE/env.bash"
fi
-source "$HOSTBOOTROOT/src/build/citest/setup-env"
+source "$PROJECT_ROOT/src/build/citest/setup-env"
#export HOSTBOOT_DEBUG=1 #-- Ensure printkd / tracd is compiled in.
diff --git a/src/build/citest/check-copyright b/src/build/citest/check-copyright
index 50c5285e7..c83cf21f6 100755
--- a/src/build/citest/check-copyright
+++ b/src/build/citest/check-copyright
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014
+# Contributors Listed Below - COPYRIGHT 2014,2015
# [+] International Business Machines Corp.
#
#
@@ -24,8 +24,8 @@
#
# IBM_PROLOG_END_TAG
-COPYRIGHT_CHECK=${HOSTBOOTROOT}/src/build/tools/copyright-check.sh
-COMMIT_CHECK=${HOSTBOOTROOT}/src/build/tools/verify-commit
+COPYRIGHT_CHECK=${PROJECT_ROOT}/src/build/tools/copyright-check.sh
+COMMIT_CHECK=${PROJECT_ROOT}/src/build/tools/verify-commit
$COPYRIGHT_CHECK || exit -1
$COMMIT_CHECK || exit -1
diff --git a/src/build/citest/cxxtest-start.sh b/src/build/citest/cxxtest-start.sh
index 840ef8316..d1fbc4f85 100755
--- a/src/build/citest/cxxtest-start.sh
+++ b/src/build/citest/cxxtest-start.sh
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2015
# [+] International Business Machines Corp.
#
#
@@ -28,7 +28,7 @@ if [ -z $HOSTBOOT_CI_ENV_SETUP ];
then
unset $SANDBOXBASE
unset $SANDBOXNAME
- source "$HOSTBOOTROOT/src/build/citest/setup-env"
+ source "$PROJECT_ROOT/src/build/citest/setup-env"
fi
HOSTBOOT_IMAGE=img/hbicore_test.bin
diff --git a/src/build/citest/etc/workarounds.postsimsetup b/src/build/citest/etc/workarounds.postsimsetup
index d82fefcb0..2a0353765 100755
--- a/src/build/citest/etc/workarounds.postsimsetup
+++ b/src/build/citest/etc/workarounds.postsimsetup
@@ -32,5 +32,5 @@
#echo "+++ Updating something wonderful in a simics file"
#mkdir -p $sb/simu/data/cec-chip/
#cp $BACKING_BUILD/src/simu/data/cec-chip/base_cec_chip_file $sb/simu/data/cec-chip
-#patch -p0 $sb/simu/data/cec-chip/base_cec_chip_file $HOSTBOOTROOT/src/build/citest/etc/patches/my_patch_File
+#patch -p0 $sb/simu/data/cec-chip/base_cec_chip_file $PROJECT_ROOT/src/build/citest/etc/patches/my_patch_File
diff --git a/src/build/citest/setup-env b/src/build/citest/setup-env
index b73e11ea4..f93eca19a 100755
--- a/src/build/citest/setup-env
+++ b/src/build/citest/setup-env
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014
+# Contributors Listed Below - COPYRIGHT 2014,2015
# [+] International Business Machines Corp.
#
#
@@ -24,7 +24,7 @@
#
# IBM_PROLOG_END_TAG
-export CITESTPATH=${HOSTBOOTROOT}/src/build/citest
+export CITESTPATH=${PROJECT_ROOT}/src/build/citest
export PATH=${CITESTPATH}:${PATH}
# Determine backing build.
@@ -43,7 +43,7 @@ fi
# Setup sandbox location variables.
if [ -z $SANDBOXROOT ];
then
- export SANDBOXROOT=${HOSTBOOTROOT}
+ export SANDBOXROOT=${PROJECT_ROOT}
fi
if [ -z $SANDBOXNAME ];
@@ -79,7 +79,7 @@ export -f execute_in_sandbox
# Determine if sandbox is in /tmp, which requires -nre to simics.
echo $SANDBOXROOT | grep "/tmp" > /dev/null
-if [ $? -eq 0 ];
+if [ $? -eq 0 ];
then
export SANDBOX_IN_TEMP=1
fi
diff --git a/src/build/debug/Hostboot/Gcov.pm b/src/build/debug/Hostboot/Gcov.pm
index 8e4c9c89e..84df2f9f9 100755
--- a/src/build/debug/Hostboot/Gcov.pm
+++ b/src/build/debug/Hostboot/Gcov.pm
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2012,2014
+# Contributors Listed Below - COPYRIGHT 2012,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.
@@ -317,7 +319,7 @@ sub parseGcovFuncs
# The *.gcda filename found in the gcov_info struct is an absolute path to
# the corresponding .o file (not the .C file). This is of the form:
-# ${HOSTBOOTROOT}/src/usr/module/${ROOTPATH}/obj/${MODULE}/foo.gcda .
+# ${PROJECT_ROOT}/src/usr/module/${ROOTPATH}/obj/${MODULE}/foo.gcda .
# Since we might not even be running this on the same machine, we need to put
# the output into the "output_dir" but we need to strip off a lot of stuff.
# The path is going to have an obj in it somewhere so we key off that
diff --git a/src/build/debug/Hostboot/_DebugFramework.pm b/src/build/debug/Hostboot/_DebugFramework.pm
index b180aa0dc..e516bdb4d 100755
--- a/src/build/debug/Hostboot/_DebugFramework.pm
+++ b/src/build/debug/Hostboot/_DebugFramework.pm
@@ -250,7 +250,7 @@ sub determineImagePath
}
else
{
- $imgPath = $ENV{"HOSTBOOTROOT"} . "/img/";
+ $imgPath = $ENV{"PROJECT_ROOT"} . "/img/";
}
}
diff --git a/src/build/debug/memalloc.pl b/src/build/debug/memalloc.pl
index 99efbd80c..49905ccdd 100755
--- a/src/build/debug/memalloc.pl
+++ b/src/build/debug/memalloc.pl
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2012,2014
+# Contributors Listed Below - COPYRIGHT 2012,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.
@@ -89,7 +91,7 @@ close MEMORY_LOG;
my %symbol_address = ();
my %symbol_isfunc = ();
-my $gensyms = $ENV{"HOSTBOOTROOT"}."/img/hbicore_test.syms";
+my $gensyms = $ENV{"PROJECT_ROOT"}."/img/hbicore_test.syms";
open (GENSYMS, "< $gensyms") or die "Cannot find syms file: $gensyms\n";
while (my $line = <GENSYMS>)
{
diff --git a/src/build/simics/combined.simics b/src/build/simics/combined.simics
index 373494761..0fe3b8fbc 100755
--- a/src/build/simics/combined.simics
+++ b/src/build/simics/combined.simics
@@ -1,9 +1,9 @@
-#If running in Hostboot Developer Environment, copies patched base
-#and extended hostboot images onto the FSP so HWSV will load
-#pached versions to PNOR instead of the default images
+#If running in Hostboot Developer Environment, copies patched base
+#and extended hostboot images onto the FSP so HWSV will load
+#pached versions to PNOR instead of the default images
#from the FSP the driver.
try {
- if (python "os.environ.has_key('HOSTBOOTROOT')") {
+ if (python "os.environ.has_key('PROJECT_ROOT')") {
echo "Running Hostboot developer patch commands"
$sbbase = (python "os.environ['sb']")
$hbsrc_dir = "/host/" + $sbbase + "/hbfw/img/"
@@ -17,6 +17,6 @@ try {
local $con = fsp2_minicomA.con
$con.wait-for-string "C1001FFF"
$con.input $hbpatch_cmd
- }
+ }
}
} except { echo "ERROR: Failed to load tools in combined.simics." }
diff --git a/src/build/tools/addCopyright.pl b/src/build/tools/addCopyright.pl
index 604fa9807..c89ddbf5f 100755
--- a/src/build/tools/addCopyright.pl
+++ b/src/build/tools/addCopyright.pl
@@ -52,7 +52,6 @@
# and run the file to update all #
###############################################################################
-
use strict;
use warnings;
use POSIX;
@@ -60,21 +59,35 @@ use Getopt::Long;
use File::Basename;
use lib dirname (__FILE__);
-
#------------------------------------------------------------------------------
# Project-specific settings.
#------------------------------------------------------------------------------
my $ReleaseYear = `date +%Y`;
chomp( $ReleaseYear );
-
$ReleaseYear = $ENV{'DATE_OVERRIDE'} if defined $ENV{'DATE_OVERRIDE'};
my $copyrightSymbol = "";
# my $copyrightSymbol = "(C)"; # Uncomment if unable to use  character.
-my $projectName = "HostBoot";
+# set by environment variable in project env.bash
+my $projectName = $ENV{'PROJECT_NAME'};
my $copyrightStr = "Contributors Listed Below - COPYRIGHT";
+## note that these use single ticks so that the escape chars are NOT evaluated yet.
+my $OLD_DELIMITER_END = 'IBM_PROLOG_END';
+my $DELIMITER_END = 'IBM_PROLOG_END_TAG';
+my $DELIMITER_BEGIN = 'IBM_PROLOG_BEGIN_TAG';
+
+my $SOURCE_BEGIN_TAG = "\$Source:";
+my $SOURCE_END_TAG = "\$";
+
+# Desired License, set by environment variable in project env.bash
+my $LicenseFile = $ENV{'LICENSE'};
+
+#------------------------------------------------------------------------------
+# Contributer info
+#------------------------------------------------------------------------------
+
# Constants for company's copyright
# When adding a new company add constant here and to %fileContributorsCompany
use constant IBM => 'International Business Machines Corp.';
@@ -88,16 +101,6 @@ my %fileContributorsCompany = (
"Google Shared Technology" => GOOGLE,
);
-## note that these use single ticks so that the escape chars are NOT evaluated yet.
-my $OLD_DELIMITER_END = 'IBM_PROLOG_END';
-my $DELIMITER_END = 'IBM_PROLOG_END_TAG';
-my $DELIMITER_BEGIN = 'IBM_PROLOG_BEGIN_TAG';
-
-my $SOURCE_BEGIN_TAG = "\$Source:";
-my $SOURCE_END_TAG = "\$";
-
-# End Project-specific settings
-
#------------------------------------------------------------------------------
# Constants
#------------------------------------------------------------------------------
@@ -107,7 +110,7 @@ use constant RC_NO_COPYRIGHT_BLOCK => 3;
use constant RC_INVALID_SOURCE_LINE => 4;
use constant RC_INVALID_YEAR => 5;
use constant RC_OLD_DELIMITER_END => 6;
-use constant RC_NOT_HOSTBOOT_BLOCK => 7;
+use constant RC_PROJECT_DOES_NOT_MATCH => 7;
use constant RC_BAD_CONTRIBUTORS_BLOCK => 8;
use constant RC_NO_COPYRIGHT_STRING => 9;
use constant RC_INVALID_FILETYPE => 10;
@@ -342,9 +345,6 @@ foreach ( @Files )
} # end foreach
-
-
-
if ( $opt_logfile ne "" )
{
close( LOGFH );
@@ -648,11 +648,11 @@ sub checkCopyrightBlock( $$ )
return RC_NO_COPYRIGHT_STRING;
}
- ## Check to see if this is a HostBoot Copyright notice
- if ( !( $block =~ m/OpenPOWER $projectName Project/ ) )
+ ## Check to see if this matches the project it lives in
+ if ( !( $block =~ m/$projectName Project/ ) )
{
- print STDOUT "WARNING: Not a $projectName copyright block\n";
- return RC_NOT_HOSTBOOT_BLOCK;
+ print STDOUT "WARNING: Copyright block does not reference project $projectName\n";
+ return RC_PROJECT_DOES_NOT_MATCH;
}
## split into lines and check for specific things
@@ -1026,7 +1026,7 @@ sub addPrologComments($$$)
# NOTE: CMVC prologs with inline comments will have a single trailing
# space at the end of the line. This is undesirable for most
- # hostboot developers so it will not be added.
+ # developers so it will not be added.
if ( $line =~ m/$DELIMITER_BEGIN/ )
{
@@ -1083,30 +1083,20 @@ sub fillinEmptyCopyrightBlock( $$ )
$copyright_Contributors .= "[+] ".$key."\n";
}
+ ## Get desired license
+ my $LicenseContent = "";
+ open(LICENSE, "< $LicenseFile") or die " $? can't open $LicenseFile: $!" ;
+ while (my $line = <LICENSE>)
+ {
+ my $evalLine = eval "qq($line)";
+ $LicenseContent .= $evalLine;
+ }
+ close(LICENSE);
+
## define the final copyright block template here.
my $IBMCopyrightBlock = <<EOF;
$DELIMITER_BEGIN
-This is an automatically generated prolog.
-
-$SOURCE_BEGIN_TAG $filename $SOURCE_END_TAG
-
-OpenPOWER $projectName Project
-
-$copyrightStr $copyrightYear
-$copyright_Contributors
-
-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.
-
+$LicenseContent
$DELIMITER_END
EOF
@@ -1189,7 +1179,6 @@ EOF
}
}
-
#######################################
## Gets file contirbutors based on git log of a file
##
diff --git a/src/build/tools/gerrit-hostname b/src/build/tools/gerrit-hostname
new file mode 100755
index 000000000..6f77778bd
--- /dev/null
+++ b/src/build/tools/gerrit-hostname
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/tools/gerrit-hostname $
+#
+# 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
+
+## Usage
+# It is imperative that there are no prints other than the die command or
+# "export GERRIT_SRV=$host" as this script is evaluated by env.bash and not
+# called directly
+
+use strict;
+
+my $homeDir = $ENV{'HOME'};
+my $sshConfigFile = $homeDir."/.ssh/config";
+# If the server changes location these will change
+my $gerritHostname = "gfw160.aus.stglabs.ibm.com";
+my $gerritPort = "29418";
+
+open(CONFIG, "< $sshConfigFile") or die " $? can't open $sshConfigFile: $!" ;
+
+my $host = "";
+my $hostname = "";
+my $port = "";
+while (my $line = <CONFIG>)
+{
+ # Whitespace after each constant is important
+ if ($line =~ m/^Host [^\s]/)
+ {
+ ($host) = $line =~ m/^Host (.*?)\s/
+ }
+ elsif ($line =~ m/Hostname [^\s]/)
+ {
+ ($hostname) = $line =~ m/^*Hostname (.*)/;
+ }
+ elsif ($line =~ m/Port [^\s]/)
+ {
+ ($port) = $line =~ m/^*Port (.*)/;
+ }
+
+ # Check if we found the gerrit host name
+ if ($host ne "" &&
+ $hostname eq $gerritHostname &&
+ $port eq $gerritPort)
+ {
+ last;
+ }
+}
+close(CONFIG);
+
+if ($host eq "")
+{
+ die "Error> Could not find gerrit host in $sshConfigFile";
+}
+else
+{
+ # Set gerrit server env variable by returning command to env.bash
+ print "export GERRIT_SRV=$host\n";
+}
diff --git a/src/build/tools/hb b/src/build/tools/hb
index bb2490350..357653768 100755
--- a/src/build/tools/hb
+++ b/src/build/tools/hb
@@ -287,7 +287,7 @@ hb_workon()
hb_prime()
{
[ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
if [ ! -d "${SANDBOXBASE}" ]; then
echo "Sandbox does not exist. Create with 'hb simsetup."
@@ -297,10 +297,10 @@ hb_prime()
# Prevent error message in cases where SANDBOXBASE is set but hb simsetup
# is not performed. Example seen in cronjob scripts
if [[ -f ${SANDBOXBASE}/rc_files/sb.conf ]] &&
- [[ -f ${HOSTBOOTROOT}/src/build/citest/etc/bbuild ]]; then
+ [[ -f ${PROJECT_ROOT}/src/build/citest/etc/bbuild ]]; then
SBDRIVER=`cat ${SANDBOXBASE}/rc_files/sb.conf | \
grep "backing_build" | awk '{ print $3 }'`
- DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`
+ DRIVER=`cat ${PROJECT_ROOT}/src/build/citest/etc/bbuild`
if [ ${SBDRIVER} != ${DRIVER} ]; then
echo "ERROR: Driver mismatch between sandbox and src/build/citest/etc/bbuild."
echo "Sandbox at ${SBDRIVER}"
@@ -317,10 +317,10 @@ hb_fipssetup()
[ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
[ -z "${SANDBOXROOT}" ] && echo "Missing SANDBOXROOT." && exit -1
[ -z "${SANDBOXNAME}" ] && echo "Missing SANDBOXNAME." && exit -1
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
SANDBOXRC="${SANDBOXROOT}/hbsandboxrc"
- DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`
+ DRIVER=`cat ${PROJECT_ROOT}/src/build/citest/etc/bbuild`
if [ -d "${SANDBOXBASE}" ]; then
echo "Removing old sandbox."
@@ -342,7 +342,7 @@ hb_fipssetup()
-sb ${SANDBOXNAME} -m ppc
echo "Running workarounds (presimsetup)."
- cp ${HOSTBOOTROOT}/src/build/citest/etc/workarounds.presimsetup \
+ cp ${PROJECT_ROOT}/src/build/citest/etc/workarounds.presimsetup \
${SANDBOXBASE}/src
execute_in_sandbox "export BACKING_BUILD=\$bb && \
./workarounds.presimsetup" "ppc"
@@ -353,13 +353,13 @@ hb_simsetup()
{
hb_fipssetup
- DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`
+ DRIVER=`cat ${PROJECT_ROOT}/src/build/citest/etc/bbuild`
needs_machine_variable
execute_in_sandbox "start_simics -no_start -machine ${MACHINE}" "ppc"
echo "Running workarounds (postsimsetup)."
- cp ${HOSTBOOTROOT}/src/build/citest/etc/workarounds.postsimsetup ${SANDBOXBASE}/src
+ cp ${PROJECT_ROOT}/src/build/citest/etc/workarounds.postsimsetup ${SANDBOXBASE}/src
execute_in_sandbox "export BACKING_BUILD=\$bb && ./workarounds.postsimsetup" "ppc"
rm ${SANDBOXBASE}/src/workarounds.postsimsetup
@@ -372,7 +372,7 @@ hb_simsetup()
hb_startsimics()
{
[ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
if [ ! -d "${SANDBOXBASE}" ]; then
echo "Sandbox does not exist. Create with 'hb simsetup."
@@ -381,7 +381,7 @@ hb_startsimics()
SBDRIVER=`cat ${SANDBOXBASE}/rc_files/sb.conf | \
grep "backing_build" | awk '{ print $3 }'`
- DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`
+ DRIVER=`cat ${PROJECT_ROOT}/src/build/citest/etc/bbuild`
if [ ${SBDRIVER} != ${DRIVER} ]; then
echo "Driver mismatch between sandbox and src/build/citest/etc/bbuild."
@@ -398,9 +398,9 @@ hb_startsimics()
hb_rsync_call()
{
if [ -z "${RSYNCHOST}" ]; then
- rsync -av --delete ${HOSTBOOTROOT}/ ${RSYNCDIR}
+ rsync -av --delete ${PROJECT_ROOT}/ ${RSYNCDIR}
else
- rsync -zav --delete ${HOSTBOOTROOT}/ ${RSYNCHOST}:${RSYNCDIR}
+ rsync -zav --delete ${PROJECT_ROOT}/ ${RSYNCHOST}:${RSYNCDIR}
fi
}
@@ -423,7 +423,7 @@ hb_rsync_helper()
hb_rsync()
{
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
[ -z "${RSYNCDIR}" ] && echo "Missing RSYNCDIR." && exit -1
# Parse arguments
@@ -462,11 +462,11 @@ hb_rsync()
hb_objsizes()
{
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
echo "Object,Text Size,RO Data Size,Data Size"
- objdump -h ${HOSTBOOTROOT}/img/*.elf ${HOSTBOOTROOT}/img/*.so | \
+ objdump -h ${PROJECT_ROOT}/img/*.elf ${PROJECT_ROOT}/img/*.so | \
grep -e ".elf" -e ".so:" -e ".text " -e ".rodata" -e ".data " | \
sed "s/.so:.*/.so/" | \
sed "s/.elf:.*/.elf/" | \
@@ -488,9 +488,9 @@ hb_errlparser()
[ -z "${SANDBOXBASE}" ] && echo "Missing SANDBOXBASE." && exit -1
[ -z "${SANDBOXROOT}" ] && echo "Missing SANDBOXROOT." && exit -1
[ -z "${SANDBOXNAME}" ] && echo "Missing SANDBOXNAME." && exit -1
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
- DRIVER=`cat ${HOSTBOOTROOT}/src/build/citest/etc/bbuild`
+ DRIVER=`cat ${PROJECT_ROOT}/src/build/citest/etc/bbuild`
# sanity checks
if [ ! -f ${DRIVER}/src/makefile ]; then
@@ -498,19 +498,19 @@ hb_errlparser()
exit -1
fi
- ${HOSTBOOTROOT}/src/build/citest/build-errl-parsers
+ ${PROJECT_ROOT}/src/build/citest/build-errl-parsers
return $?
}
hb_cachesync()
{
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
rsync -av /gsa/ausgsa/projects/h/hostboot/.binary_cache/ \
- ${HOSTBOOTROOT}/.git/hb_cache
+ ${PROJECT_ROOT}/.git/hb_cache
failure=0
- for files in ${HOSTBOOTROOT}/.git/hb_cache/data/*; do
+ for files in ${PROJECT_ROOT}/.git/hb_cache/data/*; do
echo "`basename $files` $files" | sha1sum --check >> /dev/null
if [ $? -ne 0 ]; then
echo "Failed SHA1 verification! $files"
@@ -523,7 +523,7 @@ hb_cachesync()
hb_cacheadd()
{
- [ -z "${HOSTBOOTROOT}" ] && echo "Missing HOSTBOOTROOT." && exit -1
+ [ -z "${PROJECT_ROOT}" ] && echo "Missing PROJECT_ROOT." && exit -1
CACHE_PATH=/gsa/ausgsa/projects/h/hostboot/.binary_cache/
FILE=$1
@@ -531,7 +531,7 @@ hb_cacheadd()
if [ $FILE == "--local" ]; then
echo "Adding as local copy."
- CACHE_PATH=${HOSTBOOTROOT}/.git/hb_cache/
+ CACHE_PATH=${PROJECT_ROOT}/.git/hb_cache/
FILE=$1
shift
diff --git a/src/build/tools/hbGenConfig b/src/build/tools/hbGenConfig
index f846faa3c..3792c50bf 100755
--- a/src/build/tools/hbGenConfig
+++ b/src/build/tools/hbGenConfig
@@ -254,9 +254,9 @@ sub evaluateExpr
# Create the config.mk / config.h files with the enabled options.
sub outputResults
{
- die if not defined $ENV{HOSTBOOTROOT};
- open CONFIGMK, "> $ENV{HOSTBOOTROOT}/obj/genfiles/config.mk" or die;
- open CONFIGH, "> $ENV{HOSTBOOTROOT}/obj/genfiles/config.h" or die;
+ die if not defined $ENV{PROJECT_ROOT};
+ open CONFIGMK, "> $ENV{PROJECT_ROOT}/obj/genfiles/config.mk" or die;
+ open CONFIGH, "> $ENV{PROJECT_ROOT}/obj/genfiles/config.h" or die;
print CONFIGH "#ifndef __HOSTBOOT_CONFIG_H\n";
print CONFIGH "#define __HOSTBOOT_CONFIG_H\n";
diff --git a/src/build/tools/post-commit b/src/build/tools/post-commit
index 42eaa9928..ab0f6ad1e 100755
--- a/src/build/tools/post-commit
+++ b/src/build/tools/post-commit
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2013,2014
+# Contributors Listed Below - COPYRIGHT 2013,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.
@@ -22,8 +24,4 @@
#
# IBM_PROLOG_END_TAG
-. git-sh-setup
-export GIT_DIR=$GIT_DIR
-export TOOLS_DIR=$GIT_DIR/../src/build/tools
-
-$TOOLS_DIR/verify-commit
+$TOOLSDIR/verify-commit
diff --git a/src/build/tools/pre-commit b/src/build/tools/pre-commit
index 316b4a989..013e42329 100755
--- a/src/build/tools/pre-commit
+++ b/src/build/tools/pre-commit
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,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.
@@ -22,8 +24,4 @@
#
# IBM_PROLOG_END_TAG
-. git-sh-setup
-export GIT_DIR=$GIT_DIR
-export TOOLS_DIR=$GIT_DIR/../src/build/tools
-
-$TOOLS_DIR/pre-commit-prologs
+$TOOLSDIR/pre-commit-actions
diff --git a/src/build/tools/pre-commit-actions b/src/build/tools/pre-commit-actions
new file mode 100755
index 000000000..fc2740bdd
--- /dev/null
+++ b/src/build/tools/pre-commit-actions
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/tools/pre-commit-actions $
+#
+# 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
+
+# This hook is used to add or update copyright prolog statements and run
+# the code beautifier astyle.
+
+my $copyrightScript = "addCopyright.pl";
+
+## Make up a list of all staged files ( --cached --name-only )
+## Filter for only Added or Modified ( --diff-filter=AM )
+chomp( my @fileList = `git diff --cached --name-only --diff-filter=AM` );
+
+
+if ( @fileList )
+{
+ print "run $copyrightScript update ...\n";
+ print " $_\n" foreach @fileList;
+ print "\n";
+
+ system "$ENV{'TOOLSDIR'}/$copyrightScript update @fileList";
+ die("$?") if ($? != 0);
+
+ system "git add @fileList";
+ exit 1 if ($? != 0);
+}
+
+exit 0;
diff --git a/src/build/tools/setupgithooks.sh b/src/build/tools/setupgithooks.sh
index cde55518a..707286e6e 100755
--- a/src/build/tools/setupgithooks.sh
+++ b/src/build/tools/setupgithooks.sh
@@ -6,7 +6,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,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.
@@ -25,11 +27,6 @@
# Each developer runs this from the git_repo base dir, where it will copy the
# needed scripts into .git/hooks/ directory and make them executable.
-# Setup some global variables
-HOOKSDIR=$HOSTBOOTROOT/.git/hooks
-TOOLSDIR=$HOSTBOOTROOT/src/build/tools
-HB_SRV=hostboot.gerrit
-
if [ -d $HOOKSDIR ]
then
@@ -37,11 +34,12 @@ then
if [ ! -f $HOOKSDIR/commit-msg ]
then
echo "Copying Gerrit hooks..."
- scp -p -q $HB_SRV:hooks/commit-msg $HOOKSDIR
+ scp -p -q $GERRIT_SRV:hooks/commit-msg $HOOKSDIR
fi
# Copy custom pre/post commit hooks from tools directory.
- if [ -f "$TOOLSDIR/pre-commit" -a -f "$TOOLSDIR/post-commit" ]
+ if [ -f "$TOOLSDIR/pre-commit" -a \
+ -f "$TOOLSDIR/post-commit" ]
then
echo "Copying pre/post commit hooks..."
diff --git a/src/build/tools/verify-commit b/src/build/tools/verify-commit
index 65b589c4d..f4218293a 100755
--- a/src/build/tools/verify-commit
+++ b/src/build/tools/verify-commit
@@ -29,6 +29,8 @@ use strict;
my $issueFound = 0;
my $errorFound = 0;
+my $projectName = $ENV{'PROJECT_NAME'};
+
verifyPatchSet(); # Verify the patch contents.
verifyCommitMsg(); # Verify the commit message.
@@ -179,7 +181,7 @@ sub verifyFileLine
}
# Check for "Confidential".
- if ($line =~ m/Confidential/i)
+ if ($line =~ m/Confidential/i && $projectName =~ m/HostBoot/i)
{
unless (($file =~ m/verify-commit/) ||
($file =~ m/addCopyright.pl/))
OpenPOWER on IntegriCloud