File: rules

package info (click to toggle)
prometheus-alertmanager 0.15.3+ds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,776 kB
  • sloc: sh: 168; makefile: 116
file content (68 lines) | stat: -rwxr-xr-x 2,465 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

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 examples
export DH_GOLANG_INSTALL_EXTRA := template/default.tmpl

METAPKG := github.com/prometheus/common
BINPKG := prometheus-alertmanager
LIBPKG := golang-github-prometheus-alertmanager-dev

BRANCH     := debian/sid
USER       := pkg-go-maintainers@lists.alioth.debian.org
BUILD_DATE := $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' \
    +%Y%m%d-%H:%M:%S)
GO_VERSION := $(shell go version | sed 's/go version \(\S*\).*/\1/')
GCCGO      := $(strip $(shell go version | grep gccgo))
VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | tr '~' '-')
BUILDFLAGS := -ldflags \
  " -X $(METAPKG)/version.Version=$(VERSION)\
    -X $(METAPKG)/version.Revision=$(DEB_VERSION)\
    -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,bash-completion \
	    --builddirectory=build

WHATIS1 := "prometheus-alertmanager \\- The Prometheus alert manager"
WHATIS2 := "promtool \\- Tooling for the Prometheus alert manager"

override_dh_auto_build:
	dh_auto_build -- $(BUILDFLAGS)
	cp -v build/bin/alertmanager build/bin/prometheus-alertmanager
	# Build bash completion scripts.
	mkdir -vp build/bash_completion.d
	build/bin/amtool --completion-script-bash > \
	    build/bash_completion.d/amtool
	# Build man pages.
	mkdir -vp build/man
	build/bin/prometheus-alertmanager --help-man > \
	    build/man/prometheus-alertmanager.1
	build/bin/amtool --help-man > \
	    build/man/amtool.1
	# Remove build information headers, and fix whatis entry.
	sed -i '/^  /d; /^.SH "NAME"/,+1c.SH "NAME"\n'$(WHATIS1) \
	    build/man/prometheus-alertmanager.1
	sed -i '/^  /d; /^.SH "NAME"/,+1c.SH "NAME"\n'$(WHATIS2) \
	    build/man/amtool.1

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test
	# Don't abort if acceptance tests fail, as they are too sensitive to
	# timing issues.
	GOPATH=$(CURDIR)/build go test -v $(DH_GOPKG)/test/acceptance || true
endif

override_dh_auto_install:
	dh_auto_install
	dh_install -p$(LIBPKG) usr/share/gocode
	dh_install -p$(BINPKG) usr/bin/amtool
	dh_install -p$(BINPKG) usr/bin/prometheus-alertmanager