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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/usr/bin/make -f
export DH_VERBOSE=1
export DH_GOPKG := github.com/prometheus/alertmanager
# Acceptance tests need to be run separately.
export DH_GOLANG_EXCLUDES := $(DH_GOPKG)/test/acceptance
export DH_GOLANG_INSTALL_EXTRA := template/default.tmpl
BUILDDIR := $(CURDIR)/build
METAPKG := github.com/prometheus/common
BINPKG := prometheus-alertmanager
LIBPKG := golang-github-prometheus-alertmanager-dev
DEBVERS ?= $(shell dpkg-parsechangelog -SVersion)
VERSION ?= $(shell echo '$(DEBVERS)' | sed 's/^[[:digit:]]*://; s/[-].*//')
DEBPKGNAME ?= $(shell dpkg-parsechangelog -SSource)
DEBDATE ?= $(shell dpkg-parsechangelog -SDate)
REV := $(DEBVERS)
BRANCH := debian/sid
USER := pkg-go-maintainers@lists.alioth.debian.org
HOSTNAME := debian
BUILD_DATE := $(shell date --utc --date='$(DEBDATE)' +%Y%m%d-%H:%M:%S)
GO_VERSION := $(shell go version | sed 's/go version \(\S*\).*/\1/')
GCCGO := $(strip $(shell go version | grep gccgo))
BUILDFLAGS := -ldflags \
" -X $(METAPKG)/version.Version=$(VERSION)\
-X $(METAPKG)/version.Revision=$(REV)\
-X $(METAPKG)/version.Branch=$(BRANCH)\
-X $(METAPKG)/version.BuildUser=$(USER)\
-X $(METAPKG)/version.BuildDate=$(BUILD_DATE)\
-X $(METAPKG)/version.GoVersion=$(GO_VERSION)"
%:
dh $@ --buildsystem=golang --with=golang --builddirectory=$(BUILDDIR)
ifneq ($(GCCGO),)
# Gccgo ignores vendoring.
API_PATH := github.com/prometheus/client_golang/api/alertmanager
override_dh_auto_configure:
mkdir -vp `dirname $(BUILDDIR)/src/$(API_PATH)`
dh_auto_configure
mv -v $(BUILDDIR)/src/$(DH_GOPKG)/vendor/$(API_PATH) \
$(BUILDDIR)/src/$(API_PATH)
endif
override_dh_auto_build:
dh_auto_build -- $(BUILDFLAGS)
# # Build UI dependencies.
mkdir -vp $(BUILDDIR)/uideps
uglifyjs --mangle --compress \
< ui/lib/angular-moment/angular-moment.js \
> $(BUILDDIR)/uideps/angular-moment.min.js
python2-pyscss ui/lib/kube/src/kube.scss \
> $(BUILDDIR)/uideps/kube.min.css
override_dh_auto_test:
dh_auto_test
# Don't abort if acceptance tests fail, as they are too sensitive to
# timing issues.
GOPATH=$(BUILDDIR) go test -v $(DH_GOLANG_EXCLUDES) || true
override_dh_auto_install:
cp -v $(BUILDDIR)/bin/alertmanager debian/$(BINPKG)/usr/bin/$(BINPKG)
mkdir -vp debian/$(LIBPKG)/usr/share/gocode/$(DH_GOPKG)
cp -vaT $(BUILDDIR)/src/$(DH_GOPKG) \
debian/$(LIBPKG)/usr/share/gocode/$(DH_GOPKG)
ifneq ($(GCCGO),)
mkdir -vp debian/$(LIBPKG)/usr/share/gocode/$(API_PATH)
cp -vaT $(BUILDDIR)/src/$(API_PATH) \
debian/$(LIBPKG)/usr/share/gocode/$(API_PATH)
endif
gen-orig-tgz:
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ] ; then \
git archive --format=tar.gz --prefix=$(DEBPKGNAME)-$(VERSION)/ \
upstream/$(subst ~,_,$(VERSION)) > \
../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ; \
fi
|