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
Add RPM install/upgrade scriptlet examples to documentation #356
Comments
For the record, the Is there a way to supply a rpm spec file in the nfpm config? |
sorry, your issue is a bit confusing... both examples you said are generated by nfpm, and then "The nfpm version does the right thing imho.", which one? also, nfpm/goreleaser do not generate any of those scripts... so this is even more confusing for me...
not possible... |
I've corrected the nfpm/fpm typo in the original comment. In essence, the fpm generated spec for the preinstall trigger example that I have cited originally,
Quoting from the docs,
You are correct when you say that the contents of the postremove and preinstall scripts are supplied by me but the wrapping up and the conditional based on I hope I have done a better job explaining the scenario. |
yes, understood it now. Thanks for explaining. That said, IMHO this should be done by the caller, not by nfpm, otherwise we can't never change the scripts we generate without breaking things... in any case, since this is more nfpm-specific, will move the issue there and see if anyone has a different opinion. |
cc/ @erikgeiser @djgilcrease thoughts? |
Hey @caarlos0 , I'm not sure what is intended by
You mean goreleaser should do the wrapping and pass to nfpm? Or this could be configured in goreleaser.yml somehow? If so, would you please post a link? I think perhaps a goreleaser stanza that takes a debian/ dir or rpm spec and will build packages using dpkg-buildpackage or rpmbuild might be needed. Any non trivial packaging will want features provided by native tools that need not be duplicated in nfpm. My 2¢. |
the while reason we created nfpm is to avoid depending on rpmbuild and dpkg-buildpackage...
I mean nor nfpm/goreleaser should not create any scripts for you, maybe we should have documentation examples for those cases though. |
I think we should make a clear distinction between what Now, I don't understand how this is a bug. The I understand your point and I think many run into similar issues. I would propose to add documentation with examples for |
for clarification, the issue was opened on goreleaser and I moved it here. I think it was opened as a bug because @alephnull expected the behavior to be the same as fpm, but, nfpm is not fpm... so yeah, not a bug. also: even as feature request, I don't think this should be added. as @erikgeiser mentioned: too much magic. |
Yes, but to be clear, I understand the problem and I this may be a problem that other users will also run into. So while we won't add this as a feature to |
FTR, I am not expecting magic nor compatibility with fpm. I just want upgrades to work. Consider the following,
These facts have led to me shipping a package that will break things when customers upgrade it.
These tools have real world relevance that has been built over decades. Ignoring the accumulated experience of rpmbuild and dpkg-buildpackage for whatever reason will come back to bite with the monorepo work in the enterprise version of goreleaser. I agree that this need not be "fixed" in nfpm. Would you be ok with an issue in goreleaser calling for an alternate to nfpm for rpm and deb packages? |
In theory, what you can do with rpmbuild, you should be able to do with nfpm a well - with the only exception being the Maybe it will need some more work (e.g. different scripts for deb and rpm), but it should work, e.g.: overrides:
rpm:
scripts:
postinstall: ./rpm-postinstall.sh rpmbuild also does not do anything magical
problem is that different versions of rpmbuild have different behaviors, and then we have to add a lot of we are not ignoring the knowledge there, and are more often that not inspecting how they work to mimic in nfpm.
for the reasons explained above, it's more likely we'll eventually add a "custom packager", like we have the "custom publisher" stuff. Then users can run whatever (e.g. rombuild) and we handle from there. |
The tips, hints and other useful information kind of covers this, but not the part about not auto generating scripts |
@djgilcrease nice, I wasn't aware of that but it looks like it already covers everything related to this issue. So, I guess we can close this issue then, right? |
indeed, looks so. thanks everyone 🙏 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
When upgrading rpm packages, the scripts generated by nfpm do not do the right thing for upgrades. For instance, look at the pre-install script generated by nfpm, (using
rpm -qp --scripts <rpmfile>
) it looks like:While the package generated by fpm looks like:
The fpm version does the right thing imho.
How can we reproduce this?
Using https://packagecloud.io/tyk/tyk-gateway-unstable,
You will see that the systemd service file is removed at the end of the upgrade as it is in the postuninstall trigger of the old package.
As per the spec, the postuninstall trigger of the old package runs after the postinstall trigger of the new package. This is a little confusing but the fpm generated trigger scripts use
$1
to figure out the right situation.I can't be the first to encounter this problem but I'm not sure if I am doing something wrong.
You can see the goreleaser config at https://github.com/TykTechnologies/tyk/blob/master/.goreleaser.yml#L263-L266
goreleaser version
GoReleaser Check
Search
Code of Conduct
Additional context
I have also checked the scripts with GoReleaser version found: v0.169.0 and the scripts are the generated without reference to $1.
We also have a goreleaser license from gumroad, if that makes a difference.
The text was updated successfully, but these errors were encountered: