feat: add initial support for source RPMs#3412
feat: add initial support for source RPMs#3412twpayne wants to merge 2 commits intogoreleaser:mainfrom
Conversation
|
The CI failure looks like |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3412 +/- ##
==========================================
- Coverage 82.61% 82.55% -0.07%
==========================================
Files 165 166 +1
Lines 16594 16787 +193
==========================================
+ Hits 13709 13858 +149
- Misses 2290 2319 +29
- Partials 595 610 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
yes, it checks for vulns... and turns out that go's base image has as couple of them 👀 |
|
I think we should be able to use nfpm itself to create the source rpms, as, afaik (and pls correct me if I'm wrong), are regular rpms with some different files in different places and (maybe) extra metadata? if there are options missing for that on nfpm, we can certainly add those there. the rpmpack thingy also can become an issue as we are using an internal fork of it in newer versions of nfpm cc/ @goreleaser/nfpm |
|
oh, and most importantly, thanks for the PR! 💜 |
bb24db1 to
8929b89
Compare
|
Thanks for the feedback! I've updated the PR to use I still need to find out exactly what the spec file should look like, so |
|
awesome @twpayne! I don't know how srpms spec files work either, but I'll study about them when I can |
|
I think the tricky bits with the
The current approach in this PR is to provide a basic default template that should be OK for simple projects, but leave the option for the user to specify their own For the record, I won't have much time to work on this for the next ten days or so, but am keen to get good source RPM support added to goreleaser :) |
yes, I think this is the important bit... so users that need more/different stuff can write their spec files themselves, and still use templates for things like version, hashes, etc..
yes, probably a good idea as well
same here! will be more offline for a couple of days next week, so if I take too long to reply its probably because of that! Any way, I'm excited to get this into goreleaser as well, if posssible on v1.12.0 or v1.13.0 (next minors) 🤘 (EDIT: no pressure whatsoever, if it is not ready by then its totally fine, and of course I'll help whenever I can 🙏) |
|
hey! anything I could help with here? |
|
Sorry, I haven't looked at this in a while. I think the code is correct, but it needs testing. I won't have time to look at this again for several weeks, so feel free to close this if the feature is not needed. |
|
hey, no problem, I'll see if I find some time, or worst case, we look at it together in a couple of weeks thanks for the heads up and the PR 💜 |
|
I've not looked at this for a while. I've just re-pushed to resolve conflicts. @frzifus if you'd like to help, there are a few areas:
|
|
Thanks, I will come back to you asap. I will try to generate a spec/srpm using go2rpm first. Then Ive something to compare. |
|
|
||
| // Run the pipe. | ||
| func (Pipe) Run(ctx *context.Context) error { | ||
| sourceArchives := ctx.Artifacts.Filter(artifact.ByType(artifact.UploadableSourceArchive)).List() |
There was a problem hiding this comment.
Seems the result for me here is always nil. But I expect my test config might be wrong?
May I ask, do you have a config that you used for testing? :)
Here is what I used so far
---
version: 1
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
gomod:
proxy: true
report_sizes: true
git:
ignore_tags:
- "{{ if not .IsNightly }}nightly{{ end }}"
metadata:
mod_timestamp: "{{ .CommitTimestamp }}"
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
main: ./cmd/vlookup/main.go
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }}
universal_binaries:
- replace: false
checksum:
name_template: "checksums.txt"
srpm:There was a problem hiding this comment.
I've not run the code in this PR for a long time. I think you need to build a source archive, something like:
source:
enabled: true
prefix_template: '{{ .ProjectName }}-{{ .Version }}/'|
For info, I have some time to work on this again, but am currently blocked by #5069. |
1838b53 to
db87749
Compare
|
Tried again to work on this and hit #5409 🙈 |
|
@twpayne sorry for the delay, I'll review this sometime in the next couple of weeks having a couple of crazy days here as well hehe |
| // FIXME check source RPM contents using https://github.com/sassoftware/go-rpmutils? | ||
| // FIXME check source RPM contents using https://github.com/cavaliergopher/rpm? |
|
@twpayne what do you think about this: goreleaser/nfpm#935 |
|
Looks good to me :) |
|
Nice! Merged & released: https://github.com/goreleaser/nfpm/releases/tag/v2.43.0 |
3f40f19 to
33775b6
Compare
|
This PR is now ready for review/merging. I think it's OK to release this as an alpha feature for advanced users. It's far from easy-to-use, but we have to start somewhere :)
This is probably setting a record for the longest-ever open PR (2.5 years now!) but I do want to help get this functionality into goreleaser :) |
caarlos0
left a comment
There was a problem hiding this comment.
Nice! This is looking really good!
Should we document all the options available? (I can do it btw if you don't want or can't rn).
Also would be nice to have, in the docs, a minimal starter spec template, maybe? wdyt?
Finally, this is not uploading these files anywhere... should we put them in the release? I think things like fury.io and cloudsmith? 🤔
|
Thanks for the review!
We can, but this currently requires expertise in the This There are some changes around the source tarball names. As I understand it, goreleaser uses To reproduce my current state:
On my setup, this currently fails with: ...which seems related to how Fedora builds Go packages (note tens of other modules build just fine, github.com/charmbracelet/x/[email protected] is the first one to fail).
All of the above is a long way to say I don't have a working minimal starter spec template yet, but I don't think there are any more changes required to the goreleaser code. |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Sorry, I'm not going to trawl through pages of LLM review slop to determine what is valid and what is BS. Feel free to close this PR. |
|
@twpayne yeah i was trying this thing out but didn't really like it too much - its way too verbose. Will disable it - sorry for the noise. |
|
@twpayne besides docs, anything else you think is missing here? Let me know, maybe i can finish it so we can release this 🙏 |
|
I think it's ready to be released as an experimental component. It probably needs more documentation, and there's so much variation in SRPMs that I don't think it's realistic to provide a default SRPM template. |
This PR adds support for generating source RPMs, fixing #3136.
Firstly, thank you for the excellent architecture in
goreleaser! It was much easier to add this initial functionality than I expected.This PR is not ready for merge yet, but is in reasonable shape, and ready for expert input:
.src.rpmfiles that seem to have the correct contents..specfile is configurable.There are a certainly missing features:
There are a number of unanswered questions:
google/rpmpackdirectly instead ofgoreleaser/nfpm; should it usegoreleaser/nfpminstead?.specfiles for Go projects but still have many questions, especially as we're distributing source RPMs that build final binaries and don't want to create packages for every single dependency.All feedback very welcome!
closes #3136