Joey Armstrong | 96bcf1b | 2023-06-27 14:49:40 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 2c03936 | 2024-02-04 18:51:52 -0500 | [diff] [blame] | 3 | # Copyright 2022-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 96bcf1b | 2023-06-27 14:49:40 -0400 | [diff] [blame] | 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 | ## ----------------------------------------------------------------------- |
| 22 | lint : lint-license |
| 23 | |
| 24 | lint-license-gargs += --recursive |
| 25 | |
| 26 | # ignore: png, xlsx |
| 27 | # will utf8 be excluded(?) |
| 28 | lint-license-gargs += --binary-files=without-match |
| 29 | lint-license-gargs += --files-without-match |
| 30 | |
| 31 | # [TODO] license checking accepts either Copy or Apache. |
| 32 | # [TODO] At least Copyright should be required (both?) |
| 33 | lint-license-gargs += --extended-regexp |
| 34 | lint-license-gargs += -e 'Copyright[[:space:]]+[[:digit:]]{4}' |
| 35 | lint-license-gargs += -e 'Apache License' |
| 36 | |
| 37 | # [TODO] --strict, --strict-dates |
| 38 | |
| 39 | # TODO: Normalize into .venv for consistent filtering across projects. |
| 40 | lint-license-gargs += --exclude-dir='.git' |
| 41 | lint-license-gargs += --exclude-dir='$(venv-name)' |
| 42 | lint-license-gargs += --exclude-dir='flog' |
| 43 | |
| 44 | lint-license-gargs += --exclude='*.json' |
| 45 | lint-license-gargs += --exclude='*.md' |
| 46 | lint-license-gargs += --exclude='*.pyc' |
| 47 | lint-license-gargs += --exclude='*.xml' |
| 48 | |
| 49 | # [FILE(s)] |
| 50 | lint-license-gargs += --exclude='VERSION' |
| 51 | |
| 52 | # [GIT] |
| 53 | # lint-license-gargs += --exclude='.gitignore' |
| 54 | # lint-license-gargs += --exclude='.gitreview' |
| 55 | lint-license-gargs += --exclude='\.*' |
| 56 | |
| 57 | # [PYTHON] |
| 58 | lint-license-gargs += --exclude='requirements.txt' |
| 59 | |
| 60 | # [WIP] |
| 61 | lint-license-gargs += --exclude='patch' |
| 62 | |
| 63 | ## ----------------------------------------------------------------------- |
| 64 | ## ----------------------------------------------------------------------- |
| 65 | lint-license-new: |
| 66 | grep $(lint-license-gargs) $(dot) |
| 67 | |
| 68 | ## ----------------------------------------------------------------------- |
| 69 | ## Jenkins job checking logic. |
| 70 | ## ----------------------------------------------------------------------- |
| 71 | lint-license: |
| 72 | $(MAKEDIR)/lint/license/license-check.sh |
| 73 | |
| 74 | ## ----------------------------------------------------------------------- |
| 75 | ## ----------------------------------------------------------------------- |
| 76 | help:: |
| 77 | @echo " lint-license Verify sources contain a license block." |
| 78 | @echo " lint-license-new Grep driven replacement logic." |
| 79 | |
| 80 | # [EOF] |