|
| 1 | +# Relevant nFPM docs: |
| 2 | +# - https://www.pantsbuild.org/stable/reference/targets/nfpm_deb_package |
| 3 | +# - https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package |
| 4 | +# - arch: https://nfpm.goreleaser.com/goarch-to-pkg/ |
| 5 | + |
| 6 | +_pkg_description = """ |
| 7 | +StackStorm Event-driven automation |
| 8 | +Package is full standalone st2 installation including all components |
| 9 | +in a pre-built venv. |
| 10 | +""" |
| 11 | +_common_pkg_metadata = dict( |
| 12 | + package_name="st2", |
| 13 | + description=_pkg_description, |
| 14 | + homepage="https://stackstorm.com", |
| 15 | + # https://jfearn.fedorapeople.org/en-US/RPM/4/html-single/RPM_Guide/index.html#idp3030720 |
| 16 | + license="Apache-2.0", # TODO: nFPM is putting this under Copyright tag instead of License |
| 17 | + version="", # injected by pants-plugins/release |
| 18 | + # arch used to be "any", but that was not correct as the venv has compiled packages. |
| 19 | + arch="amd64", # NOTE: parametrize this if adding support for arm64 or other arch. |
| 20 | + platform="linux", |
| 21 | +) |
| 22 | +_maintainer = "StackStorm Engineering <opsadmin@stackstorm.com>" # TODO: update this |
| 23 | + |
| 24 | + |
| 25 | +def _distro(distro_id: str, **kwargs): |
| 26 | + return parametrize( |
| 27 | + distro_id, |
| 28 | + distro_id=distro_id, |
| 29 | + **kwargs, |
| 30 | + ) |
| 31 | + |
| 32 | + |
| 33 | +nfpm_deb_package( |
| 34 | + name="st2.deb", |
| 35 | + dependencies=[ |
| 36 | + "./deb/scripts", |
| 37 | + ], |
| 38 | + scripts=dict( |
| 39 | + preinstall="deb/scripts/pre-install.sh", |
| 40 | + postinstall="deb/scripts/post-install.sh", |
| 41 | + preremove="deb/scripts/pre-remove.sh", |
| 42 | + postremove="deb/scripts/post-remove.sh", |
| 43 | + # config="", |
| 44 | + # templates="", |
| 45 | + # rules="", |
| 46 | + ), |
| 47 | + maintainer=_maintainer, |
| 48 | + fields={ |
| 49 | + # https://www.debian.org/doc/debian-policy/ch-controlfields.html#source |
| 50 | + # We do not have an "st2" source package, so do not include "Source". |
| 51 | + # https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-vcs-fields |
| 52 | + "Vcs-Git": "git://github.com/stackstorm/st2.git", |
| 53 | + "Vcs-Browser": "https://github.com/stackstorm/st2", |
| 54 | + }, |
| 55 | + section="python", |
| 56 | + priority="optional", |
| 57 | + **_common_pkg_metadata, |
| 58 | + **_distro("focal"), |
| 59 | +) |
| 60 | + |
| 61 | +nfpm_rpm_package( |
| 62 | + name="st2.rpm", |
| 63 | + dependencies=[ |
| 64 | + "./rpm/scripts", |
| 65 | + ], |
| 66 | + scripts=dict( |
| 67 | + preinstall="rpm/scripts/pre-install.sh", |
| 68 | + postinstall="rpm/scripts/post-install.sh", |
| 69 | + preremove="rpm/scripts/pre-remove.sh", |
| 70 | + postremove="rpm/scripts/post-remove.sh", |
| 71 | + # pretrans="", |
| 72 | + # posttrans="", |
| 73 | + # verify="", |
| 74 | + ), |
| 75 | + vendor="The StackStorm Project", |
| 76 | + packager=_maintainer, |
| 77 | + # group="System/Management", # was only useful for EL 5 and earlier |
| 78 | + **_common_pkg_metadata, |
| 79 | + **_distro("el8", compression="xz"), |
| 80 | + **_distro("el9", compression="zstd:default"), |
| 81 | +) |
0 commit comments