blob: b457f585d99f12290df13cfae6f9e9813e236d15 [file] [log] [blame]
Joey Armstrong96bcf1b2023-06-27 14:49:40 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17
18.PHONY: lint-license
19
20## -----------------------------------------------------------------------
21## -----------------------------------------------------------------------
22lint : lint-license
23
24lint-license-gargs += --recursive
25
26# ignore: png, xlsx
27# will utf8 be excluded(?)
28lint-license-gargs += --binary-files=without-match
29lint-license-gargs += --files-without-match
30
31# [TODO] license checking accepts either Copy or Apache.
32# [TODO] At least Copyright should be required (both?)
33lint-license-gargs += --extended-regexp
34lint-license-gargs += -e 'Copyright[[:space:]]+[[:digit:]]{4}'
35lint-license-gargs += -e 'Apache License'
36
37# [TODO] --strict, --strict-dates
38
39# TODO: Normalize into .venv for consistent filtering across projects.
40lint-license-gargs += --exclude-dir='.git'
41lint-license-gargs += --exclude-dir='$(venv-name)'
42lint-license-gargs += --exclude-dir='flog'
43
44lint-license-gargs += --exclude='*.json'
45lint-license-gargs += --exclude='*.md'
46lint-license-gargs += --exclude='*.pyc'
47lint-license-gargs += --exclude='*.xml'
48
49# [FILE(s)]
50lint-license-gargs += --exclude='VERSION'
51
52# [GIT]
53# lint-license-gargs += --exclude='.gitignore'
54# lint-license-gargs += --exclude='.gitreview'
55lint-license-gargs += --exclude='\.*'
56
57# [PYTHON]
58lint-license-gargs += --exclude='requirements.txt'
59
60# [WIP]
61lint-license-gargs += --exclude='patch'
62
63## -----------------------------------------------------------------------
64## -----------------------------------------------------------------------
65lint-license-new:
66 grep $(lint-license-gargs) $(dot)
67
68## -----------------------------------------------------------------------
69## Jenkins job checking logic.
70## -----------------------------------------------------------------------
71lint-license:
72 $(MAKEDIR)/lint/license/license-check.sh
73
74## -----------------------------------------------------------------------
75## -----------------------------------------------------------------------
76help::
77 @echo " lint-license Verify sources contain a license block."
78 @echo " lint-license-new Grep driven replacement logic."
79
80# [EOF]