Skip to content

Conversation

@cognifloyd
Copy link
Member

This PR is working towards doing packaging via pantsbuild. Eventually, I hope to archive and stop using st2-packages.git. This PR begins refactoring packaging/{rpm,deb}/scripts/*.sh cherry-picked in:

This refactor PR focuses on removing code from the scripts including dead code, broken code, and legacy code that is now pointless. I recommend reviewing each commit, as the commit description explains what is being removed and why.

/etc/logrotate.d/st2 is already recorded in conffiles,
so let dpkg handle conf preservation and restoration.

Besides, there was a bug in the code anyway rendering this logic useless.
post-remove.sh should have had
mv /etc/logrotate.d/st2 /etc/logrotate.d/st2-pkgsaved.disabled
but was missing the first argument, so it did nothing.
This was hidden by the '|| true' that made it always pass.
Since the logic doesn't work, and it is not necessary, just drop it.
A comment in the pre-install.sh files said:

> Fix directories permissions on upgrade (different across maint scripts!)
> NB! USED FOR COMPATIBILITY ON UPGRADE FROM PREVIOUS VERSIONS OF PACKAGES.
> NB! In future package releases reseting permissions SHOULD BE REMOVED.

This has been there for many releases. So, let's just remove this.
Instead, we rely on the permissions that the st2 package provides,
which are defined in BUILD nfpm_content_* metadata.

This has the benefit of vastly simplifying the deb install scripts
as the upgrade stamp file is no longer required.
So, there is no longer a dependency between pre-install and post-install scripts.
@cognifloyd cognifloyd added this to the pants milestone Mar 7, 2025
@cognifloyd cognifloyd self-assigned this Mar 7, 2025
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Mar 7, 2025
@cognifloyd cognifloyd enabled auto-merge March 7, 2025 18:00
@cognifloyd cognifloyd requested a review from a team March 9, 2025 02:16
@cognifloyd cognifloyd disabled auto-merge March 9, 2025 03:25
@cognifloyd cognifloyd enabled auto-merge March 10, 2025 15:03
@cognifloyd cognifloyd merged commit 16478d9 into master Mar 10, 2025
79 of 80 checks passed
@cognifloyd cognifloyd deleted the packaging-scriptlets_cleanup branch March 10, 2025 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance pantsbuild refactor size/L PR that changes 100-499 lines. Requires some effort to review. st2-packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants