[Buildroot] go: patching dependency versions w/ go modules?

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat Jun 25 23:20:22 UTC 2022


Hello,

On Sat, 25 Jun 2022 15:37:36 -0700
Christian Stewart <christian at paral.in> wrote:

> There's a particular issue I've run into with the Go implementation
> while trying to fix the gocryptfs package.
> 
> Currently the process is:
> 
>  1. Download the package source code.
>  2. Run "go mod vendor" and re-bundle into a .tar.gz.
>  3. Hash the resulting .tar.gz
>  4. Extract it to the build/ tree
>  5. Apply any patches
>  6. Run the build.
> 
> The problem with this is, if we try to patch the versions of any
> dependencies, for example by editing go.mod and go.sum, this is after
> the download step at #2.
> 
> So currently it is not possible to change the version of dependencies
> with a patch.

Correct.

> Is there any clean way to fix this?

No, not with the current infrastructure indeed.

> The only thing I can think of is to add a new variable which contains
> a list of "go mod edit" commands to run just before "go mod vendor" in
> the download & extract step.
> 
> go mod edit -replace
> github.com/jacobsa/crypto=github.com/piggynl/jacobsa-crypto at xorblock-generic

I don't really have a good idea here, but whatever solution we come up
with should not be Go-specific, as it should also work for the Cargo
use-case (and possibly other similar situations in the future).

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com



More information about the buildroot mailing list