Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2 # -*- Mode: makefile -*-
3 include /usr/share/dpkg/pkg-info.mk
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 # Include test fixtures.
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 # EOL
25
26 # Do not build examples
27 export DH_GOLANG_EXCLUDES := documentation storage/remote/azuread
28 # Disable OTLP Ingestion
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 # Tests in armel take way too long, and run out of memory in armhf.
50 TESTFLAGS := -timeout 60m -short
51 else ifeq ($(DEB_HOST_ARCH_CPU),mips64el)
52 # mips64el is also super slow
53 TESTFLAGS := -timeout 60m -short
54 else ifeq ($(DEB_HOST_ARCH_CPU),riscv64)
55 # Override gcflags to workaround https://github.com/golang/go/issues/63167
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 # Restore docker SD test fixture filename for older build-deps
73 ln -s json.json \
74 $(BUILDDIR)/src/$(PKG)/discovery/moby/testdata/dockerprom/containers/json_limit_0.json
75 # Copy vendored packages
76 cp -a debian/vendor $(BUILDDIR)/src/$(PKG)/
77
78 # Exclude package without non-test files.
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 # Fix title and header footers.
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 # Remove build user/build date/go version headers, which is ugly.
96 sed -i '/^ /d' $(BUILDDIR)/*.1
97 # Fix whatis entries.
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 # Remove default values, as they create unwieldy long lines.
101 sed -i 's/\\fB--\(.*\)=".*"\\fR/\\fB--\1\\fR/' $(BUILDDIR)/*.1
102
103 override_dh_auto_test:
104 dh_auto_test -- $(TESTFLAGS)