From 7a381f7eaf5899296c87650228918219a0302061 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 17 Oct 2019 15:52:54 -0500 Subject: [PATCH] allow years other than 2017 in licenses Also clean up the license hash checking a bit. We trim vendor early in find so we don't have to walk the whole vendor tree only to grep the files out, and we don't check the license hashes of the exceptions, and the exceptions are now a plain text file of non-regex strings we match exactly. Also the license hash code is only written once. This will help us a lot if development on Pilosa continues through 2018 or later. --- Makefile | 13 ++++++++----- license.exceptions | 9 +++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 license.exceptions diff --git a/Makefile b/Makefile index 969624d90..f47c92740 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,11 @@ RELEASE_ENABLED = $(subst 0,,$(RELEASE)) BUILD_TAGS += $(if $(ENTERPRISE_ENABLED),enterprise) BUILD_TAGS += $(if $(RELEASE_ENABLED),release) BUILD_TAGS += shardwidth$(SHARD_WIDTH) -LICENSE_HASH=$(shell head -13 pilosa.go | shasum | cut -f 1 -d " ") +define LICENSE_HASH_CODE + head -13 $1 | sed -e 's/Copyright 20[0-9][0-9]/Copyright 20XX/g' | shasum | cut -f 1 -d " " +endef +LICENSE_HASH=$(shell $(call LICENSE_HASH_CODE, pilosa.go)) + export GO111MODULE=on # Run tests and compile Pilosa @@ -32,7 +36,7 @@ vendor: go.mod # Run test suite test: - go test ./... -tags='$(BUILD_TAGS)' $(TESTFLAGS) + go test ./... -tags='$(BUILD_TAGS)' $(TESTFLAGS) bench: go test ./... -bench=. -run=NoneZ -timeout=127m $(TESTFLAGS) @@ -161,9 +165,8 @@ gometalinter: require-gometalinter vendor # Verify that all Go files have license header check-license-headers: SHELL:=/bin/bash check-license-headers: - @! find . -name '*.go' | grep -v '^./vendor' | while read fn;\ - do [[ `head -13 $$fn | shasum | cut -f 1 -d " "` == $(LICENSE_HASH) ]] || echo $$fn; done | \ - grep -v apimethod_string.go | grep -v pb.go | grep -v peg.go | grep -v lru.go | grep -v btree | grep -v enterprise + @! find . -path ./vendor -prune -o -name '*.go' -print | grep -v -F -f license.exceptions | while read fn;\ + do [[ `$(call LICENSE_HASH_CODE, $$fn)` == $(LICENSE_HASH) ]] || echo $$fn; done | grep '.' ###################### # Build dependencies # diff --git a/license.exceptions b/license.exceptions new file mode 100644 index 000000000..5d70f2e3a --- /dev/null +++ b/license.exceptions @@ -0,0 +1,9 @@ +# names of files which we do not expect to have our license header +./apimethod_string.go +./pql/pql.peg.go +./internal/private.pb.go +./internal/public.pb.go +./lru/lru.go +./enterprise/enterprise.go +./roaring/btree.go +./roaring/btree_test.go