I just realized that this package doesn’t use dh-golang yet, i.e. the
Built-Using patch alone won’t have any effect.

The attached patch shows how using dh-golang would look like. I ran out of
time figuring out a cleaner solution to rename the binary; perhaps you know
of one.

Thanks for considering,

On Mon, Mar 5, 2018 at 8:11 PM, Michael Stapelberg <stapelb...@debian.org>
wrote:

> Source: prometheus-sql-exporter
> Severity: wishlist
> Tags: patch
>
> Please consider merging the attached patch. Thanks!
>
> -- System Information:
> Debian Release: buster/sid
>   APT prefers testing
>   APT policy: (990, 'testing'), (500, 'unstable-debug'), (500,
> 'testing-debug'), (500, 'unstable')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386, armel, mipsel, arm64
>
> Kernel: Linux 4.13.0-1-amd64 (SMP w/12 CPU cores)
> Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8),
> LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
>
> _______________________________________________
> Pkg-go-maintainers mailing list
> pkg-go-maintain...@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers
>



-- 
Best regards,
Michael
From 8ed5c67230a0e7ac72df6aefef76dafd720c21ee Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <stapelb...@debian.org>
Date: Mon, 5 Mar 2018 20:10:53 +0100
Subject: [PATCH] use dh-golang

---
 debian/control                         |  3 +++
 debian/prometheus-sql-exporter.install |  1 -
 debian/rules                           | 15 +++++----------
 3 files changed, 8 insertions(+), 11 deletions(-)
 delete mode 100644 debian/prometheus-sql-exporter.install

diff --git a/debian/control b/debian/control
index a8e1947..cacb481 100644
--- a/debian/control
+++ b/debian/control
@@ -12,8 +12,10 @@ Build-Depends: debhelper (>= 10),
  golang-github-prometheus-common-dev,
  golang-github-go-kit-kit-dev,
  help2man,
+ dh-golang,
 Standards-Version: 4.1.3
 Homepage: https://github.com/credativ/sql_exporter
+XS-Go-Import-Path: github.com/credativ/sql_exporter
 Vcs-Browser: https://github.com/credativ/sql_exporter
 Vcs-Git: https://github.com/credativ/sql_exporter.git
 
@@ -23,6 +25,7 @@ Depends:
  postgresql-common,
  ${shlibs:Depends},
  ${misc:Depends},
+Built-Using: ${misc:Built-Using}
 Description: Flexible SQL Exporter for Prometheus
  This Prometheus exporter extracts various metrics from PostgreSQL, MySQL, and
  MSSQL databases. The metrics are configurable via a YAML file.
diff --git a/debian/prometheus-sql-exporter.install b/debian/prometheus-sql-exporter.install
deleted file mode 100644
index 2d29d3b..0000000
--- a/debian/prometheus-sql-exporter.install
+++ /dev/null
@@ -1 +0,0 @@
-prometheus-sql-exporter usr/bin
diff --git a/debian/rules b/debian/rules
index 549c65f..eef5054 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,20 +1,15 @@
 #!/usr/bin/make -f
 
-export GOPATH=/usr/share/gocode
-
 %:
-	dh $@ --with=systemd
-
-override_dh_auto_build:
-	go build -v -o prometheus-sql-exporter
-
-override_dh_auto_test:
-	go test -v
+	dh $@ --with=systemd --with=golang --buildsystem=golang
 
 override_dh_auto_install:
+	mv obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/bin/sql_exporter \
+	obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/bin/prometheus-sql-exporter
+	dh_auto_install -- --no-source
 
 override_dh_installman:
-	PATH=$(PATH):debian/prometheus-sql-exporter/usr/bin \
+	PATH=$(PATH):obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/bin \
 	help2man --no-discard-stderr --no-info \
 		--name "SQL Exporter for Prometheus" \
 		--version-string=$(shell dpkg-parsechangelog -S Version) \
-- 
2.15.1

Reply via email to