Debian Codegraph @

tests/license/checklicense.sh

raw symbols SCIP
1 #!/bin/bash
2 #
3 # Copyright 2015 Canonical Ltd.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; version 3.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # Based on pbuilderjenkins license checking script.
18
19 command -v licensecheck >/dev/null 2>&1 || exit 1
20
21 include_files="\.(c(c|pp|xx)?|h(h|pp|xx)?|p(l|m)|php|py(|x)|java|js|vala|qml)$"
22 exclude_dirs="(3rd_party|qrc_|moc_|_build|include|^build)"
23 allowed_licenses="(Canonical|UBports|Android|Google|Digia|Qt Company Ltd)"
24 tab_char="$(echo -e \\t)"
25 issues=`licensecheck -r * --copyright -m -c "$include_files" -i "$exclude_dirs" | egrep -v "$tab_char.*$allowed_licenses"`
26
27 if [ -z "$issues" ]; then
28 echo No license problems found.
29 exit 0
30 else
31 echo "Found $(echo "$issues" | wc -l) license problem(s):"
32 echo "$issues"
33 exit 1
34 fi