summaryrefslogtreecommitdiffstats
path: root/tools/hooks
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2017-10-13 15:49:25 -0500
committerRichard J. Knight <rjknight@us.ibm.com>2017-10-17 15:05:22 -0500
commit41e7df45e64f623499b8d286a4012e6e7d24eaf6 (patch)
treee7a54e4950d2610c3fddeaf2b74b53b424315bf1 /tools/hooks
downloadtalos-hcode-41e7df45e64f623499b8d286a4012e6e7d24eaf6.tar.gz
talos-hcode-41e7df45e64f623499b8d286a4012e6e7d24eaf6.zip
Initial hcode commit
Change-Id: I2c6c9b05c6afbd7732f472ea9cf049d00c5cad45
Diffstat (limited to 'tools/hooks')
-rwxr-xr-xtools/hooks/post-commit29
-rwxr-xr-xtools/hooks/pre-commit36
-rwxr-xr-xtools/hooks/tools/pre-commit-actions60
3 files changed, 125 insertions, 0 deletions
diff --git a/tools/hooks/post-commit b/tools/hooks/post-commit
new file mode 100755
index 00000000..6601ed74
--- /dev/null
+++ b/tools/hooks/post-commit
@@ -0,0 +1,29 @@
+#!/bin/bash
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: tools/hooks/post-commit $
+#
+# OpenPOWER HCODE Project
+#
+# COPYRIGHT 2015,2017
+# [+] 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
+
+if [ -z $DISABLEHOOKS ] && [ -z $MIRROR ]; then
+ $TOOLSDIR/verify-commit
+fi
diff --git a/tools/hooks/pre-commit b/tools/hooks/pre-commit
new file mode 100755
index 00000000..04ad9a81
--- /dev/null
+++ b/tools/hooks/pre-commit
@@ -0,0 +1,36 @@
+#!/bin/bash
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: tools/hooks/pre-commit $
+#
+# OpenPOWER HCODE Project
+#
+# COPYRIGHT 2015,2017
+# [+] 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
+
+if [ -z $EKBHOOKSDIR ]; then
+ echo Error: environment not setup properly...
+ echo "Run 'source env.bash' or './ekb workon' based on your current environment"
+ echo "For more info run './ekb --help'"
+ exit -1
+fi
+
+if [ -z $DISABLEHOOKS ] && [ -z $MIRROR ]; then
+ $EKBHOOKSDIR/tools/pre-commit-actions
+fi
diff --git a/tools/hooks/tools/pre-commit-actions b/tools/hooks/tools/pre-commit-actions
new file mode 100755
index 00000000..7c0e8b1b
--- /dev/null
+++ b/tools/hooks/tools/pre-commit-actions
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: tools/hooks/tools/pre-commit-actions $
+#
+# OpenPOWER HCODE Project
+#
+# COPYRIGHT 2015,2017
+# [+] 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.
+use Getopt::Long;
+
+my $copyrightScript = "addCopyright";
+my @fileList = ();
+my $args = @ARGV;
+
+if ($args)
+{
+ @fileList = @ARGV;
+}
+else
+{
+ ## Make up a list of all staged files ( --cached --name-only )
+ ## Filter for only Added or Modified ( --diff-filter=AM )
+ chomp( @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" if ($args == 0);
+ exit 1 if ($? != 0);
+}
+
+exit 0;
OpenPOWER on IntegriCloud