3 # This file is part of the GROMACS molecular simulation package.
5 # Copyright (c) 2015, by the GROMACS development team, led by
6 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 # and including many others, as listed in the AUTHORS file in the
8 # top-level source directory and at http://www.gromacs.org.
10 # GROMACS is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public License
12 # as published by the Free Software Foundation; either version 2.1
13 # of the License, or (at your option) any later version.
15 # GROMACS is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with GROMACS; if not, see
22 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 # If you want to redistribute modifications to GROMACS, please
26 # consider that scientific software is very special. Version
27 # control is crucial - bugs must be traceable. We will be happy to
28 # consider code for inclusion in the official distribution, but
29 # derived work must not be called official GROMACS. Details are found
30 # in the README & COPYING files - if they are missing, get the
31 # official version at http://www.gromacs.org.
33 # To help us fund GROMACS development, we humbly ask that you cite
34 # the research papers on the package. Check out http://www.gromacs.org.
36 # This script is used by Gerrit to run uncrustify in the uncrustify_* jobs.
37 # The main purpose of this script is to isolate Jenkins from the details of
38 # the uncrustify.sh script, and to provide a facade that can keep the interface
39 # to Jenkins the same even if uncrustify.sh changes.
40 # It also provides some logic to produce better messages for Jenkins.
42 # Interface from Jenkins to this script is:
43 # * location of the script
44 # * UNCRUSTIFY environment variable to specify the location of uncrustify
46 # Communication back to Jenkins is through
47 # * return value of this script (non-zero marks the build failed).
48 # * stdout (any instance of "FAILED" marks the build unstable),
49 # * unsuccessful-reason.log contains a short description of what failed
51 # * uncrustify.log contains messages about what files needed changes
53 srcdir
=`git rev-parse --show-toplevel`
55 if [ ! -f "admin/run-uncrustify.sh" ] ; then
56 echo "Failed to find root of the source tree"
60 warning_log
=uncrustify.log
61 unsuccessful_log
=unsuccessful-reason.log
63 admin
/uncrustify.sh check
--rev=HEAD^
--warnings=$warning_log
65 if [ $stat -eq 1 ] ; then
66 echo "FAILED: uncrustify.sh found issues"
67 warning_count
=`wc -l <$warning_log`
68 if [ $warning_count -lt 5 ] ; then
69 cp -f $warning_log $unsuccessful_log
71 rm -f $unsuccessful_log
72 uncrustify_count
=`grep "needs uncrustify" $warning_log | wc -l`
73 cpyear_count
=`grep "copyright year" $warning_log | wc -l`
74 cpheader_count
=`grep "copyright header" $warning_log | wc -l`
75 [ $uncrustify_count -gt 0 ] && echo "formatting issues in" $uncrustify_count "file(s)" >> $unsuccessful_log
76 [ $cpyear_count -gt 0 ] && echo "copyright year missing in" $cpyear_count "file(s)" >> $unsuccessful_log
77 [ $cpheader_count -gt 0 ] && echo "copyright header issues in" $cpheader_count "file(s)" >> $unsuccessful_log
81 elif [ $stat -ne 0 ] ; then
82 echo "FAILED: uncrustify.sh failed to run"
83 echo "uncrustify.sh failed to run" > $unsuccessful_log