| 1 |
|
| 2 |
|
| 3 |
include /usr/share/dpkg/pkg-info.mk |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
export DH_GOLANG_INSTALL_EXTRA := \ |
| 10 |
cmd/prometheus/testdata \ |
| 11 |
cmd/promtool/testdata \ |
| 12 |
config/testdata \ |
| 13 |
discovery/file/fixtures \ |
| 14 |
discovery/http/fixtures \ |
| 15 |
discovery/moby/testdata \ |
| 16 |
discovery/puppetdb/fixtures \ |
| 17 |
documentation/examples/prometheus-agent.yml \ |
| 18 |
documentation/examples/prometheus.yml \ |
| 19 |
model/rulefmt/testdata \ |
| 20 |
promql/fuzz-data \ |
| 21 |
rules/fixtures \ |
| 22 |
scrape/testdata \ |
| 23 |
tsdb/testdata \ |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
export DH_GOLANG_EXCLUDES := documentation storage/remote/azuread |
| 28 |
|
| 29 |
export DH_GOLANG_EXCLUDES += storage/remote/otlptranslator |
| 30 |
|
| 31 |
BUILDDIR := $(CURDIR)/.build |
| 32 |
PKG := github.com/prometheus/prometheus |
| 33 |
METAPKG := github.com/prometheus/common |
| 34 |
|
| 35 |
BRANCH := debian/sid |
| 36 |
USER := team+pkg-go@tracker.debian.org |
| 37 |
BUILD_DATE = $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' \ |
| 38 |
+%Y%m%d-%H:%M:%S) |
| 39 |
GO_VERSION = $(shell go version | sed 's/go version \(\S*\).*/\1/') |
| 40 |
BUILDFLAGS = -ldflags \ |
| 41 |
" -X $(METAPKG)/version.Version=$(DEB_VERSION_UPSTREAM)\ |
| 42 |
-X $(METAPKG)/version.Revision=$(DEB_VERSION)\ |
| 43 |
-X $(METAPKG)/version.Branch=$(BRANCH)\ |
| 44 |
-X $(METAPKG)/version.BuildUser=$(USER)\ |
| 45 |
-X $(METAPKG)/version.BuildDate=$(BUILD_DATE)\ |
| 46 |
-X $(METAPKG)/version.GoVersion=$(GO_VERSION)" |
| 47 |
|
| 48 |
ifeq ($(DEB_HOST_ARCH_CPU),arm) |
| 49 |
|
| 50 |
TESTFLAGS := -timeout 60m -short |
| 51 |
else ifeq ($(DEB_HOST_ARCH_CPU),mips64el) |
| 52 |
|
| 53 |
TESTFLAGS := -timeout 60m -short |
| 54 |
else ifeq ($(DEB_HOST_ARCH_CPU),riscv64) |
| 55 |
|
| 56 |
TESTFLAGS := -timeout 60m -short -gcflags=all=-d=wrapglobalmapctl=1 |
| 57 |
else |
| 58 |
TESTFLAGS := -timeout 60m |
| 59 |
endif |
| 60 |
|
| 61 |
%: |
| 62 |
dh $@ --buildsystem=golang --builddirectory=$(BUILDDIR) |
| 63 |
|
| 64 |
PROMPB := $(BUILDDIR)/src/$(PKG)/prompb |
| 65 |
|
| 66 |
override_dh_auto_configure: |
| 67 |
dh_auto_configure -- $(BUILDFLAGS) |
| 68 |
protoc --gogofast_out=plugins=grpc:$(PROMPB) \ |
| 69 |
-I$(PROMPB) \ |
| 70 |
-I$(BUILDDIR)/src/github.com/gogo/protobuf \ |
| 71 |
$(PROMPB)/*.proto |
| 72 |
|
| 73 |
ln -s json.json \ |
| 74 |
$(BUILDDIR)/src/$(PKG)/discovery/moby/testdata/dockerprom/containers/json_limit_0.json |
| 75 |
|
| 76 |
cp -a debian/vendor $(BUILDDIR)/src/$(PKG)/ |
| 77 |
|
| 78 |
|
| 79 |
override_dh_auto_build: DH_GOLANG_EXCLUDES += tsdb/test |
| 80 |
override_dh_auto_build: |
| 81 |
dh_auto_build -- $(BUILDFLAGS) |
| 82 |
|
| 83 |
MAN_WHATIS := "prometheus \\- The Prometheus monitoring server" |
| 84 |
MAN_WHATIS_TOOL := "promtool \\- Tooling for the Prometheus monitoring system" |
| 85 |
MAN_DATE := $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' '+%B %Y') |
| 86 |
|
| 87 |
execute_before_dh_installman: |
| 88 |
$(BUILDDIR)/bin/prometheus --help-man > $(BUILDDIR)/prometheus.1 |
| 89 |
$(BUILDDIR)/bin/promtool --help-man > $(BUILDDIR)/promtool.1 |
| 90 |
|
| 91 |
sed -i '/^.TH .*/c.TH PROMETHEUS "1" "$(MAN_DATE)" "$(DEB_SOURCE) $(DEB_VERSION_UPSTREAM)" "Prometheus"/' \ |
| 92 |
$(BUILDDIR)/prometheus.1 |
| 93 |
sed -i '/^.TH .*/c.TH PROMTOOL "1" "$(MAN_DATE)" "$(DEB_SOURCE) $(DEB_VERSION_UPSTREAM)" "Prometheus"/' \ |
| 94 |
$(BUILDDIR)/promtool.1 |
| 95 |
|
| 96 |
sed -i '/^ /d' $(BUILDDIR)/*.1 |
| 97 |
|
| 98 |
sed -i '/^.SH "NAME"/,+1c.SH "NAME"\n'$(MAN_WHATIS) $(BUILDDIR)/prometheus.1 |
| 99 |
sed -i '/^.SH "NAME"/,+1c.SH "NAME"\n'$(MAN_WHATIS_TOOL) $(BUILDDIR)/promtool.1 |
| 100 |
|
| 101 |
sed -i 's/\\fB--\(.*\)=".*"\\fR/\\fB--\1\\fR/' $(BUILDDIR)/*.1 |
| 102 |
|
| 103 |
override_dh_auto_test: |
| 104 |
dh_auto_test -- $(TESTFLAGS) |