File: test_license.sh

package info (click to toggle)
pgrouting 4.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,332 kB
  • sloc: cpp: 21,315; sql: 10,419; ansic: 9,795; perl: 1,142; sh: 919; javascript: 314; xml: 182; makefile: 29
file content (58 lines) | stat: -rwxr-xr-x 1,678 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# This file is part of the pgRouting project.
# Copyright (c) 2020-2026 pgRouting developers
# License: GPL-2 See https://github.com/pgRouting/pgrouting/blob/main/LICENSE

# This test checks that all source files correctly have license headers

DIR=$(git rev-parse --show-toplevel)
pushd "${DIR}" > /dev/null || exit


# extensions
EXCLUDE_LIST="png|jpeg|gif|ico|md|sig|mo|xml"
# directories
EXCLUDE_LIST="${EXCLUDE_LIST}|_static|_templates|git-tools|doctrees"
# files
EXCLUDE_LIST="${EXCLUDE_LIST}|forward|README|Doxyfile|allPairs-performance|typos_whitelist|CPPLINT|gitignore"
mylicensecheck() {
    licensecheck --copyright -r -m -l 30 --tail 0 -i "$EXCLUDE_LIST" "$1"
}


error=0
copyr=""
missing=""
NAMES=("doc" "src" "include" "docqueries" "pgtap" "sql" "tools" "ci" "cmake" "doxygen")
for n in "${NAMES[@]}" ; do
    results=$(mylicensecheck "${n}")
    tmp=$(grep UNKNOWN <<< "${results}")
    if [ -n "${tmp}" ] ; then
        error=1
        missing="$missing ${tmp}"
    fi
    tmp=$(grep "No copyright" <<< "${results}")
    if [ -n "${tmp}" ] ; then
        error=1
        copyr="${copyr} ${tmp}"
    fi
done

if [[ ${copyr} ]]; then
  echo " ****************************************************"
  echo " *** Found source files without copyright           *"
  echo " ****************************************************"
  echo "${copyr}"
fi

if [[ $missing ]]; then
  echo " ****************************************************"
  echo " *** Found source files without valid license headers"
  echo " ****************************************************"
  echo "$missing"
fi

echo the pop
popd > /dev/null || exit ${error}
echo the pop
exit $error