New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add initial support for source RPMs #3412
base: main
Are you sure you want to change the base?
Conversation
The CI failure looks like |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3412 +/- ##
==========================================
- Coverage 83.75% 83.66% -0.09%
==========================================
Files 135 136 +1
Lines 12919 13109 +190
==========================================
+ Hits 10820 10968 +148
- Misses 1671 1700 +29
- Partials 428 441 +13 ☔ View full report in Codecov by Sentry. |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 }}/'
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.rpm
files that seem to have the correct contents..spec
file is configurable.There are a certainly missing features:
There are a number of unanswered questions:
google/rpmpack
directly instead ofgoreleaser/nfpm
; should it usegoreleaser/nfpm
instead?.spec
files 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