From 95327e6d9bd4f70980acd8fd6c9524265990dc4d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 10 May 2017 10:49:57 -0400 Subject: [PATCH 12/24] Add coverity build scripts Signed-off-by: Peter Jones --- .gitignore | 1 + Make.coverity | 37 +++++++++++++++++++++++++++++++++++++ Make.defaults | 2 ++ Make.rules | 4 ++++ Makefile | 1 + 5 files changed, 45 insertions(+) create mode 100644 Make.coverity diff --git a/.gitignore b/.gitignore index 1635ba2..847e172 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ *.tar.* *.rpm core.* +cov-int diff --git a/Make.coverity b/Make.coverity new file mode 100644 index 0000000..b80b091 --- /dev/null +++ b/Make.coverity @@ -0,0 +1,37 @@ +include $(TOPDIR)/Make.version +include $(TOPDIR)/Make.rules +include $(TOPDIR)/Make.defaults + +COV_EMAIL=$(call get-config,coverity.email) +COV_TOKEN=$(call get-config,coverity.token) +COV_URL=$(call get-config,coverity.url) +COV_FILE=$(NAME)-coverity-$(VERSION)-$(COMMIT_ID).tar.bz2 + +cov-int : clean + cov-build --dir cov-int make all + +cov-clean : + @rm -vf $(NAME)-coverity-*.tar.* + @if [[ -d cov-int ]]; then rm -rf cov-int && echo "removed 'cov-int'"; fi + +cov-file : | $(COV_FILE) + +$(COV_FILE) : cov-int + tar caf $@ cov-int + +cov-upload : + @if [[ -n "$(COV_URL)" ]] && \ + [[ -n "$(COV_TOKEN)" ]] && \ + [[ -n "$(COV_EMAIL)" ]] ; \ + then \ + echo curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \ + curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \ + else \ + echo Coverity output is in $(COV_FILE) ; \ + fi + +coverity : cov-file cov-upload + +clean : | cov-clean + +.PHONY : coverity cov-upload cov-clean cov-file diff --git a/Make.defaults b/Make.defaults index 3511080..39b78f0 100644 --- a/Make.defaults +++ b/Make.defaults @@ -1,3 +1,5 @@ +NAME = pesign +COMMIT_ID ?= $(shell git log -1 --pretty=%H 2>/dev/null || echo master) prefix ?= /usr/ prefix := $(abspath $(prefix))/ libdir ?= $(prefix)lib64/ diff --git a/Make.rules b/Make.rules index af5ecfe..5e3c83d 100644 --- a/Make.rules +++ b/Make.rules @@ -79,3 +79,7 @@ endef $(TOPDIR)/libdpe/%.a $(TOPDIR)/libdpe/% : $(MAKE) -C $(TOPDIR)/libdpe $(notdir $@) + +define get-config = +$(shell git config --local --get "$(NAME).$(1)") +endef diff --git a/Makefile b/Makefile index db8eb7e..ca1a359 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ TOPDIR = $(realpath .) include $(TOPDIR)/Make.version include $(TOPDIR)/Make.rules include $(TOPDIR)/Make.defaults +include $(TOPDIR)/Make.coverity SUBDIRS := include libdpe src -- 2.13.4