-
-
Notifications
You must be signed in to change notification settings - Fork 779
Packaging: Add basic BUILD metadata for rpm/deb packages #6325
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
Conversation
…rgets This should also be included in the output_path and possibly other fields.
| _pkg_description = """ | ||
| StackStorm Event-driven automation | ||
| Package is full standalone st2 installation including all components | ||
| in a pre-built venv. | ||
| """ |
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.
From:
See:
- https://www.pantsbuild.org/stable/reference/targets/nfpm_deb_package#description
- https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package#description
Also, the first line of the description is used for summary:
| _common_pkg_metadata = dict( | ||
| package_name="st2", | ||
| description=_pkg_description, | ||
| homepage="https://stackstorm.com", |
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.
From:
- deb: https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/packages/st2/debian/control#L11
- rpm: https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/rpmspec/st2pkg_toptags.spec#L17
(I used stackstorm.com instead of the github link because that makes more sense)
See:
| # https://jfearn.fedorapeople.org/en-US/RPM/4/html-single/RPM_Guide/index.html#idp3030720 | ||
| license="Apache-2.0", # TODO: nFPM is putting this under Copyright tag instead of License |
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.
From:
- deb: https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/packages/st2/debian/copyright#L14-L28
- rpm: https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/rpmspec/st2pkg_toptags.spec#L16
(I used the SPDX identifier instead of the non-standard "ASL 2.0")
See:
| # arch used to be "any", but that was not correct as the venv has compiled packages. | ||
| arch="amd64", # NOTE: parametrize this if adding support for arm64 or other arch. |
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.
From:
- deb: https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/packages/st2/debian/control#L16
(I usedamd64instead ofanyas explained in the comment. I can remove the comment if needed.) - rpm: not defined in st2-packages.git
Also, this uses the ARCH defined in golang which gets translated to the package-specific architecture. So, amd64 becomes x86_64 for rpm, but remains amd64 for deb. This page shows how that translation happens (though the doc is slightly incorrect here as amd64 does not get translated to x86_64 for deb files): https://nfpm.goreleaser.com/goarch-to-pkg/
See:
| version="", # injected by pants-plugins/release | ||
| # arch used to be "any", but that was not correct as the venv has compiled packages. | ||
| arch="amd64", # NOTE: parametrize this if adding support for arm64 or other arch. | ||
| platform="linux", |
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.
This is just needed for nfpm. I included it here to be explicit instead of relying on the default value linux. 🤷 We can drop this line if anyone doesn't like it here.
See:
| "Vcs-Git": "git://github.com/stackstorm/st2.git", | ||
| "Vcs-Browser": "https://github.com/stackstorm/st2", | ||
| }, | ||
| section="python", |
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.
| "Vcs-Browser": "https://github.com/stackstorm/st2", | ||
| }, | ||
| section="python", | ||
| priority="optional", |
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.
| def _distro(distro_id: str, **kwargs): | ||
| return parametrize( | ||
| distro_id, | ||
| distro_id=distro_id, |
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.
Here's the distro_id field added in #6324.
| # posttrans="", | ||
| # verify="", | ||
| ), | ||
| vendor="The StackStorm Project", |
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.
This is new. It was not in st2-packages.git. It is not used in Fedora, so we don't have to include it.
See: https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package#vendor
| ), | ||
| vendor="The StackStorm Project", | ||
| packager=_maintainer, | ||
| # group="System/Management", # was only useful for EL 5 and earlier |
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.
We no longer support EL 5 or earlier, so we should probably just drop this line instead of commenting it out. Right?
| # group="System/Management", # was only useful for EL 5 and earlier |
See: https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package#group
This PR is working towards doing packaging via pantsbuild. Eventually, I hope to archive and stop using st2-packages.git.
The pants nfpm backend was activated in #6321. This PR adds an
nfpm_deb_packagetarget and annfpm_rpm_packagetarget with basic metadata like packager, package description, homepage, etc. I added review comments to address each piece of this metadata, where it came from in st2-packages, and what documentation is relevant for this BUILD target field.st2/packaging/BUILD
Lines 33 to 34 in 2ef489b
st2/packaging/BUILD
Lines 61 to 62 in 2ef489b
Beyond this metdata, I also included the deb maintainer scripts and rpm scriptlets--the
pre-install,post-install,pre-remove, andpost-removescripts--added in these PRs:packaging/{rpm,deb}/scripts#6314To add them, the scripts have to be in
dependencies(deps on other BUILD targets--package deps will be in a later PR), and the script has to be registered in thescriptsfield:st2/packaging/BUILD
Lines 35 to 46 in 2ef489b
st2/packaging/BUILD
Lines 63 to 74 in 2ef489b
The scripts field is documented here:
Note that there are 3 more possible deb-specific scripts (
config,templates,rules) and 3 more possible rpm-specific scripts (pretrans,posttrans,verify). I left a comment so that we can add those later if we have a reason to do so.File Triggers
This section is informational. It is related to the deb maintainer scripts registered in this PR, so I mention it in this PR even though this PR does not implement file triggers.
In deb packages,
triggerswould tell dpkg to run our post-install script when, for example, the python binary is updated which would allow the post-install script to rebuild the venv. However, nFPM currently does not have support for that for rpm. For rpm, the underlying rpmpack library needs to be updated to support adding file triggers. To that end, I filed this feature request:As I mentioned in that issue, I can probably work on adding that to rpmpack at some point, but I need to finish the rest of the pants+packaging stuff for st2 first.