[pkg-go] testdata/ directories and incorrect test path patches

Michael Stapelberg stapelberg at debian.org
Fri Feb 16 08:28:19 UTC 2018


Hey,

I noticed recently that we have 13 packages in the archive which ship with
a patch similar to
https://anonscm.debian.org/cgit/pkg-go/packages/golang-bindata.git/tree/debian/patches/test-fixture-locations.patch?h=debian/3.0.7%2bgit20151023.72.a0ff256-2&id=704d22e89d455b581d92e0a36d551d399275d502,
i.e. a patch which modifies the upstream code to look for testdata files
not in the current directory, but in the Debian sources.

The cited rationale for such a patch is an apparent issue with the Debian
packaging executing tests in the wrong directory.

This is incorrect: dh-golang runs go test, which ensures the directory is
correct. Instead, what is happening is that dh-golang constructs a
temporary GOPATH and, by default, only copies Go source files into that
path.

The proper solution is to have dh-golang install the required files. Up
until dh-golang 1.30, this would be accomplished with e.g. export
DH_GOLANG_INSTALL_EXTRA := html/charset/testdata in debian/rules.

To make this a little easier for everyone, I just uploaded dh-golang 1.31,
which honors the testdata/ convention and copies testdata/ contents by
default.

I will also update the affected packages and drop the now-unnecessary patch
from them. I just wanted to bring this to people’s attention to ensure that
— when required — we add installation directives to debian/rules instead of
patching upstream source.

Read
https://manpages.debian.org/unstable/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html
if you’re curious about more details of the inner workings of dh-golang,
and let me know if you have any questions.

Thanks!

-- 
Best regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-go-maintainers/attachments/20180216/d5bd1396/attachment.html>


More information about the Pkg-go-maintainers mailing list