Re: Multiple import paths for a package seems to not work
Hey Nicolas,
Thanks for responding!
On 06/10/25 9:36 pm, Nicolas Peugnet wrote:
> Hi Nilesh,
>
> On 06/10/2025 17:46, Nilesh Patra wrote:
>> Hi,
>>
>> I was trying to update snowflake [1]. This has a change in import path, which I added in [2].
>>
>> This now has 2 import paths. riseup-vpn is a reverse-dependency of this package. When I tried
>> to build reverse-dependency (everything locally), I am getting:
>>
>> | # 0xacab.org/leap/bitmask-vpn/pkg/snowflake/lib
>> | src/0xacab.org/leap/bitmask-vpn/pkg/snowflake/lib/turbotunnel.go:10:2: cannot find package "git.torproject.org/
>> | pluggable-transports/snowflake.git/common/encapsulation" in any of:
>> | /build/reproducible-path/riseup-vpn-0.25.8+ds2/_build/src/0xacab.org/leap/bitmask-vpn/vendor/
>> | git.torproject.org/pluggable-transports/snowflake.git/common/encapsulation (vendor tree)
>>
>> While this directory _is_ present:
>>
>> | $ dpkg -c golang-snowflake-dev_2.10.1-1_all.deb | grep encapsulation
>> | drwxr-xr-x root/root 0 2024-12-07 00:00 ./usr/share/gocode/src/gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/encapsulation/
>> | -rw-r--r-- root/root 6700 2024-12-07 00:00 ./usr/share/gocode/src/gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/encapsulation/encapsulation.go
>> |-rw-r--r-- root/root 12313 2024-12-07 00:00 ./usr/share/gocode/src/gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/encapsulation/encapsulation_test.go
>>
>> Could someone help me understand as to why the other import path is not taken up?
>
> The documentation of dh_golang [3] indicates that only the *first*
> import path is used:
>> "DH_GOPKG" is automatically set to the value of the first import path of the "XS-Go-Import-Path" "debian/control" field, which can contain several comma-separated import paths.
>
> In your case, riseup-vpn is looking for the Go package
> "git.torproject.org/pluggable-transports/snowflake.git/common/encapsulation",
> whereas the snowflake one provides only
> "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/encapsulation/",
> which is a different import path.
Yep, I noticed this, but to my understanding DH_GOPKG matters for the package that we are
_currently_ building, IoW, it would matter for riseup-vpn itself as written in docs
https://manpages.debian.org/testing/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html
| "DH_GOPKG" (string) contains the Go package name which this Debian package is building.
| "DH_GOPKG" is automatically set to the value of the first import path of the "XS-Go-Import-Path" "debian/control"
| field, which can contain several comma-separated import paths.
In this case, golang-snowflake-dev is a Build-Depends of riseup-vpn. Does DH_GOPKG also impact the
dependencies? Shouldn't these be resolved based off all values of XS-Go-Import-Path?
> Maybe dh_golang should instead create symlinks for all the other listed
> import paths targeting the first one?
I think it should do this anyway, but for this case I should probably follow "Upstream package moves"
as specified in https://go-team.pages.debian.net/packaging.html
>> [1] https://salsa.debian.org/pkg-privacy-team/snowflake
>> [2] https://salsa.debian.org/pkg-privacy-team/snowflake/-/commit/e594bcde56436ac9dc9cc3aeb96eefdbfe4945a0
>
> [3]
> https://manpages.debian.org/bookworm/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html#ENVIRONMENT_VARIABLES
>
--
Best,
Nilesh
Reply to: