Hi Fedorians,
A recent PR reminded me that I never properly announced the new (well, four months old) bundled() Provides generator for Golang projects[1]. This can be used to simplify generating these Provides when bundling is justified in Fedora[2] or for (EP)EL. Simply mark the vendor/modules.txt file generated by `go mod vendor` with `%license` and the generator will take care of the rest.
This removes the need for long lists of Provides that clutter specfiles and have to be updated after each upstream release. It's up to package maintainers to inspect the Provides for correctness when opting in to this generator. Please let us know if you find any bugs.
The generator is available in all Fedora branches and on EPEL 9 (part of go-rpm-macros-epel that shadows RHEL's go-rpm-macros). go-rpm-macros has been updated in c9s, so I'll remove the generator from go-rpm-macros-epel when the next RHEL 9 minor release comes out.
[1]: https://pagure.io/go-rpm-macros/c/226596177c63c3dc180b5aeda45fe3b18706e877?b... and https://pagure.io/go-rpm-macros/c/c32fbbd25bbcedee8c0b898d3653255b18a0d30e?b...
[2]: https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/#_bundled_o...
-- Maxwell G (@gotmax23) Pronouns: He/Him/His
Hi Maxwell & Go SIG,
we have recently started working on introducing a bundled() provides generator for golang in openSUSE and found a very simple solution using the output of `go version -m /path/to/binary` [1]
The solution is of course only that simple, because we build more or less all go binaries with vendored dependencies and hence we do not need to distinguish between those build with vendored and those build without.
As I would like to align the Fedora and openSUSE go packaging closer together and hence, if possible, find a solution to use this generator for both Fedora and openSUSE. I think it is a bit simpler and does not require to ship the modules.txt in the final rpm. However, I see that both are rather weak reasons.
Do you see a way how we can find a common solution? E.g. by having a macro %go_enable_bundled_provides that would set an environment variable and enable the bundled generator?
Cheers,
Dan
Footnotes: [1] https://github.com/dcermak/golang-packaging/blob/master/golang.prov
On Tue Apr 2, 2024 at 17:16 +0200, Dan Čermák wrote:
Hi Maxwell & Go SIG,
Hi Dan,
Thank you for reaching out!
we have recently started working on introducing a bundled() provides generator for golang in openSUSE and found a very simple solution using the output of `go version -m /path/to/binary` [1]
It seems that only works when builds are performed with GO111MODULE turned on[1]. We have it turned off by default, although I suppose we can turn it on when doing vendored builds—we only need to turn it off when using the RPM-packaged dependencies for un-vendored packages. Without GO111MODULE, the dep information doesn't show up with "go version -m."
[1] https://go.dev/blog/go116-module-changes
The solution is of course only that simple, because we build more or less all go binaries with vendored dependencies and hence we do not need to distinguish between those build with vendored and those build without.
As I would like to align the Fedora and openSUSE go packaging closer together and hence, if possible, find a solution to use this generator for both Fedora and openSUSE. I think it is a bit simpler and does not require to ship the modules.txt in the final rpm. However, I see that both are rather weak reasons.
Do you see a way how we can find a common solution? E.g. by having a macro %go_enable_bundled_provides that would set an environment variable and enable the bundled generator?
Other than the technical issue with GO111MODULE, I still prefer modules.txt approach. It is more efficient, as we don't need to process every single binary file in the package, and it requires explicit opt-in from the packager.
Best, Maxwell