Re: Packaging usql - help to limit the scope of the build?
On 10/04/25 9:00 pm, Otto Kekäläinen wrote:
> Thanks Nilesh, passing tags to dh_auto_test worked following the above example.
>
> Any suggestions on how to pass tags to the final stage of the build,
> after dh_install ?
Looks like we are in the final stages of the build. That's actually good.
I think I may have a hint, see below...
> ....
> "go list -f '{{ range .Deps }}{{.}}\
> {{ end }}'" github.com/xo/usql github.com/xo/usql/drivers
> github.com/xo/usql/drivers/metadata
> github.com/xo/usql/drivers/metadata/informationschema
> github.com/xo/usql/drivers/metadata/mysql
> github.com/xo/usql/drivers/metadata/postgres
> github.com/xo/usql/drivers/mymysql github.com/xo/usql/drivers/mysql
> github.com/xo/usql/drivers/sqlite3
> github.com/xo/usql/drivers/sqlite3/sqshared github.com/xo/usql/env
> github.com/xo/usql/handler github.com/xo/usql/internal
> github.com/xo/usql/metacmd github.com/xo/usql/metacmd/charts
> github.com/xo/usql/rline github.com/xo/usql/stmt
> github.com/xo/usql/styles github.com/xo/usql/text
> debian/.build/upstream/src/github.com/xo/usql/drivers/clickhouse/clickhouse.go:12:2:
> cannot find package "github.com/ClickHouse/clickhouse-go/v2" in any
So, dh-golang runs `go list -f` to generate a dependency list and propagate to substvar as per the
manpage[1].
I do not see the explicit -tags option in the upstream manpage[2]. However, if I pass in -tags to `go list`
in a debian system, it does seem to give some output. I am not sure if that is even a standard option
or no. However, dh-golang does not have provision to pass -tags in any case as can been seen in the code[3]
However, it does have a provision to specify DH_GOLANG_BUILDPKG. So you can pass that variable via an override
to dh_golang. Here's an example for you:
https://salsa.debian.org/go-team/packages/docker/-/blob/master/debian/rules?ref_type=heads#L75
The other option is an ugly hack that I did in mgmt package. Since that was just one file, I moved
it to a different name and moved back after dh_golang so go list does not discover it.
https://salsa.debian.org/go-team/packages/mgmt/-/blob/debian/unstable/debian/rules?ref_type=heads#L55
Final option would be to ofcourse disable dh_golang but that may not be a good option.
Hope this helps.
[1] https://manpages.debian.org/testing/dh-golang/dh_golang.1p.en.html
[2] https://pkg.go.dev/cmd/go#hdr-List_packages_or_modules
[3] https://salsa.debian.org/go-team/packages/dh-golang/-/blob/debian/sid/lib/Debian/Debhelper/Buildsystem/golang.pm?ref_type=heads#L638
Reply to: