tech-pkg archive

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

Patching Go software



Packaging golang software is becoming increasingly frustrating. One of the main problems we have with the current setup is that it appears to be impossible to patch dependencies.

As an example I'm updating gitea but need to patch one of the deps. After 'bmake extract' I have the following file in WRKDIR:

  work/github.com/sassoftware/go-rpmutils@v0.2.0/fileutil/fileutil_unix.go

In older golang/pkgsrc setups it used to be possible to patch these files, at least we still have some "patch-.._github.com..." patches across pkgsrc.

However, it appears that all of these extracted files are completely redundant. During the build go will unpack its own copies from GOPROXY into ${WRKDIR}/.gopath:

  work/.gopath/pkg/mod/github.com/sassoftware/go-rpmutils@v0.2.0/fileutil/fileutil_unix.go

and even if I try to patch that file after the build fails, go just extracts a brand new unmodified version in place.

Do we have anyone who understands go who can answer why we unpack GO_MODULE_FILES into WRKDIR if they're just going to be ignored, and ideally how we can patch vendor dependencies?

As a comparison, OmniOS does not have the same problems with their gitea build and happily patch the dependency, but they do not have the same strict distfile requirements that we do, so it must be related to our GOPROXY usage.

Being unable to patch them results in the process being significantly harder, as you then need to fork entire dependencies on github.com, create your own releases, then ship patches for the brittle 'go mod replace' dance. This causes problems with updates as other committers aren't interested or don't have the permissions to update the forks.

It's not helped by golang upstreams becoming increasingly hostile towards non-Linux platforms, so this is only going to get worse.

Thanks,

--
Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
Open Source Complete Cloud   www.tritondatacenter.com


Home | Main Index | Thread Index | Old Index