[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Packaging usql - help to limit the scope of the build?



On 10 April 2025 10:44:01 pm IST, "Otto Kekäläinen" <otto@debian.org> wrote:
>Thanks!
>
>Note I got this far by skipping the test suite. I will need to revisit
>it though, but getting end-to-end working first makes optimizing
>stages easier workflow-wise.

What are the other failing tests?

>...
>> 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 package already has this defined and it behaves correctly in the
>build, but not in this last phase:

I do not think this is working even in the build.

The build works due to the tags that are passed not because of this variable.

>export DH_GOLANG_BUILDPKG = \
>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
>
>
>
>> 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
>
>I tried this and it seems to pass the TAGS correctly to dh_golang, but
>it didn't affect the for loop:

And that is expected if you read the code I linked to in my previous mail.

In dh golang, the go list call is not taking up any arguments that you pass to it except DH_BUILDPKG variable.

So even if you pass tags or anything else it will not work.

>> Final option would be to ofcourse disable dh_golang but that may not be a good option.
>
>I am reading dh_golang to figure out if there is a way to get around
>this.. I guess I could also make a patch that disables those files
>with a "go:build" header.

That is not a good solution either. Since we are awfully close to get this building, can you try the approach in docker.io to see if it works?

I suspect the exported DH_GOLANG_BUILDPKG does not make it to dh_golang call for some weird reason.

Can you try to override dh_golang and manually pass this like the way it is done in docker.io? (Avoid the 3 dots ofcourse otherwise it takes up the subdir as well)

My hunch is that it will work.


Best,
Nilesh


Reply to: