Debian / dh-make-golang

Automatically creates Debian packaging for Go packages
BSD 3-Clause "New" or "Revised" License
375 stars 76 forks source link

Switch dependency/duplicate check to newly-added api.ftp-master.debian.org/binary/by_metadata/Go-Import-Path #73

Open stapelberg opened 6 years ago

stapelberg commented 6 years ago

The current heuristic is not precise. For example, when packaging github.com/coreos/dex, I got:

2017/10/21 18:19:49 Build-Dependency "golang-github-gtank-cryptopasta-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-golang-protobuf-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-gopkg-ldap.v2-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-cockroachdb-cockroach-go-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-gopkg-square-go-jose.v2-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-beevik-etree-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-russellhaering-goxmldsig-dev" is not yet available in Debian

But, github.com/golang/protobuf and gopkg.in/ldap.v2 are in fact packaged (in golang-goprotobuf-dev and golang-github-go-ldap-ldap-dev, respectively).

@paultag suggested using the XS-Go-Import-Path field in debian/control instead of setting DH_GOPKG (see also https://manpages.debian.org/unstable/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html), which allows us to precisely list all binary packages by their Go import path.

I recently implemented a query for this in dakweb, see https://lists.debian.org/debian-dak/2017/10/msg00012.html for the patch.

We should switch dh-make-golang to make use of that, and convert all of our remaining packages to set XS-Go-Import-Path (I’ll analyze which these are in a bit).

stapelberg commented 6 years ago

The following packages have not yet been converted to XS-Go-Import-Path:

"golang-redhat-audit-dev"
"golang-github-google-cadvisor-dev"
"golang-github-shiguredo-fuji-dev"
"golang-mode"
"golang-gopkg-libgit2-git2go.v24-dev"
"golang-github-gosexy-gettext-dev"
"golang-github-mvo5-goconfigparser-dev"
"golang-gosqlite-dev"
"golang-guestfs-dev"
"golang-github-opencontainers-runc-dev"

Generated using:

% wget https://api.ftp-master.debian.org/binary/by_metadata/Go-Import-Path
% wget https://people.debian.org/~stapelberg/dh-make-golang/binary-amd64-grep-golang
% grep -v -f <(jq '.[].binary' Go-Import-Path) <(sed 's,^Package: ,",g; s,$,",g' binary-amd64-grep-golang)
rajudev commented 6 years ago

While running dh-make-golang on a package today, I got this line in the output.

2018/02/04 11:03:42 Could not check for existing Go packages in Debian: getting "https://api.ftp-master.debian.org/binary/by\_metadata/Go-Import-Path": %!v(MISSING)

Is it related to this issue?

I asked this on IRC, after no replies there posting here.

stapelberg commented 6 years ago

I pushed an update to fix the error message. Please try again and open a separate issue if the error persists.