Skip to content

Commit e80e54d

Browse files
committed
feat: enhance RPM packaging support for prerelease versions and update maintainer information
1 parent 1f5c441 commit e80e54d

6 files changed

Lines changed: 47 additions & 16 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ Download them from https://dlib.net/files/ once, then store them in a shared loc
7878

7979
#### Automated releases
8080

81-
- Push a tag that matches `v<MAJOR>.<MINOR>.<PATCH>` (for example `git tag v0.3.0 && git push origin v0.3.0`).
82-
- The `Release Debian Packages` workflow builds both Debian and Ubuntu `.deb` files via `build/package-deb.sh`, using the numeric portion of the tag as the package version.
81+
- Push a tag that matches `v<MAJOR>.<MINOR>.<PATCH>` or `v<MAJOR>.<MINOR>.<PATCH>-<prerelease>` (for example `git tag v0.3.0 && git push origin v0.3.0` or `git tag v0.3.0-rc1 && git push origin v0.3.0-rc1`).
82+
- The `Release Packages` workflow builds both Debian and Ubuntu `.deb` files via `build/package-deb.sh` and Fedora `.rpm` files via `build/package-rpm.sh`, using the tag without the leading `v` as the package version.
83+
- For RPM prereleases, the generated artifact name keeps the original semver, but the spec normalizes it internally to `Version=<core>` and `Release=0.<release>.<prerelease>` so `rpmbuild` accepts RC tags and upgrade ordering remains correct.
8384
- When the workflow finishes, GitHub Releases contains `chissu-pam_<version>_debian_amd64.deb`, `chissu-pam_<version>_ubuntu_amd64.deb`, and `chissu-pam_<version>_<distro>_x86_64.rpm` assets attached to that tag. Release notes are auto-generated; edit them manually if more detail is needed.
8485
- If the workflow fails, fix the issue and click “Re-run jobs” for the tag; assets are replaced when uploads succeed.
8586

build/package-deb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ if [[ -z "$VERSION" ]]; then
9898
exit 1
9999
fi
100100

101-
MAINTAINER="${CHISSU_PAM_MAINTAINER:-Chissu Maintainers https://github/sett4/chissu-pam}"
101+
MAINTAINER="${CHISSU_PAM_MAINTAINER:-sett4 <noreply@example.org>}"
102102
DATERFC=$(date -R)
103103
DEB_VERSION="${VERSION}-${REVISION}"
104104
WORK_ROOT="$REPO_ROOT/build/package/work/$DISTRO"

build/package-rpm.sh

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ VERSION=""
2525
RELEASE="1"
2626
ARCH="x86_64"
2727
SKIP_BUILD=0
28+
RPM_VERSION=""
29+
RPM_RELEASE=""
2830
if [[ ! -f "$LIB_PATH" ]]; then
2931
echo "Missing shared installer library at $LIB_PATH" >&2
3032
exit 1
@@ -88,12 +90,35 @@ if [[ -z "$VERSION" ]]; then
8890
exit 1
8991
fi
9092

91-
command -v rpmbuild >/dev/null || { echo "rpmbuild not found" >&2; exit 1; }
92-
9393
log() {
9494
echo "[package-rpm] $*"
9595
}
9696

97+
normalize_rpm_version() {
98+
local input="$1"
99+
local core prerelease
100+
101+
if [[ "$input" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-([0-9A-Za-z.]+))?$ ]]; then
102+
core="${BASH_REMATCH[1]}"
103+
prerelease="${BASH_REMATCH[3]:-}"
104+
else
105+
echo "Unsupported version format for RPM packaging: $input" >&2
106+
echo "Expected <major>.<minor>.<patch> or <major>.<minor>.<patch>-<prerelease>" >&2
107+
exit 1
108+
fi
109+
110+
RPM_VERSION="$core"
111+
if [[ -n "$prerelease" ]]; then
112+
RPM_RELEASE="0.${RELEASE}.${prerelease}"
113+
else
114+
RPM_RELEASE="$RELEASE"
115+
fi
116+
}
117+
118+
normalize_rpm_version "$VERSION"
119+
120+
command -v rpmbuild >/dev/null || { echo "rpmbuild not found" >&2; exit 1; }
121+
97122
require_build_deps() {
98123
missing=()
99124
for pkg in "${BUILD_DEPS[@]}"; do
@@ -167,8 +192,8 @@ cp "$REPO_ROOT/LICENSE" "$STAGING_ROOT/LICENSE"
167192

168193
log "Rendering spec"
169194
sed \
170-
-e "s/__VERSION__/$VERSION/g" \
171-
-e "s/__RELEASE__/$RELEASE/g" \
195+
-e "s/__VERSION__/$RPM_VERSION/g" \
196+
-e "s/__RELEASE__/$RPM_RELEASE/g" \
172197
-e "s/__ARCH__/$ARCH/g" \
173198
"$SPEC_TEMPLATE" > "$SPEC_PATH"
174199

build/package/rpm/chissu-pam.spec.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Release: __RELEASE__%{?dist}
66
Summary: Infrared-ready facial authentication CLI + PAM helper
77

88
License: LGPL-2.1+
9-
URL: https://github.com/sett/chissu-pam
9+
URL: https://github.com/sett4/chissu-pam
1010
Source0: %{name}-%{version}.tar.gz
1111
BuildArch: __ARCH__
1212
Requires: dlib, openblas, lapack, gtk3, systemd-libs, curl, bzip2, authselect
@@ -25,7 +25,7 @@ enroll embeddings and wire PAM stacks without compiling from source.
2525
%install
2626
rm -rf "%{buildroot}"
2727
mkdir -p "%{buildroot}"
28-
cp -pr artifacts/* "%{buildroot}/"
28+
cp -a artifacts/. "%{buildroot}/"
2929

3030
%files
3131
%license LICENSE

openspec/specs/packaging-rpm/spec.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ The repository MUST ship a helper that produces RPM packages via the standard `r
1212
- **AND** it renders a `.spec` file plus `%post`/`%postun` hooks, then invokes `rpmbuild -bb` so that an `.rpm` is emitted into `dist/` with the distro + architecture encoded in the filename (e.g., `chissu-pam-<version>.<distro>.x86_64.rpm`)
1313
- **AND** runtime dependencies include `dlib`, `openblas`, `lapack`, `gtk3`, `libudev`, `curl`, and `bzip2`
1414

15+
#### Scenario: Maintainer builds prerelease RPM package
16+
- **GIVEN** a maintainer runs `build/package-rpm.sh --distro fedora --version 1.2.3-rc1`
17+
- **THEN** the generated RPM metadata uses `Version: 1.2.3`
18+
- **AND** it encodes the prerelease label in `Release` as `0.<release>.rc1` so the build is valid and upgrades cleanly to the final `1.2.3` package
19+
1520
### Requirement: Install-Time Model Download
1621
RPM packages MUST avoid bundling the dlib weights and instead download them during installation.
1722

@@ -51,5 +56,5 @@ The RPM packaging workflow SHALL consume the shared installer templates/library
5156
#### Scenario: RPM build pulls shared config and hooks
5257
- **WHEN** `build/package-rpm.sh` stages package files
5358
- **THEN** it copies the generated config template and any shared hook scripts from the common asset output
59+
- **AND** it preserves dotfiles such as placeholder `.keep` entries when copying staged assets into `%{buildroot}`
5460
- **AND** it does not re-define prerequisite package lists or dlib download URLs independently (it reuses the shared library/templates).
55-

openspec/specs/release-automation/spec.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
TBD - created by archiving change add-release-deb-workflow. Update Purpose after archive.
55
## Requirements
66
### Requirement: Tag-triggered Deb Packages
7-
GitHub Actions MUST produce Debian-compatible packages whenever a semver tag is pushed.
7+
GitHub Actions MUST produce Debian-compatible packages whenever a supported semver tag is pushed.
88

99
#### Scenario: Tag push builds packages
10-
- **GIVEN** a tag named `v1.2.3` (pattern `v<major>.<minor>.<patch>`) is pushed to the repository
10+
- **GIVEN** a tag named `v1.2.3` or `v1.2.3-rc1` (pattern `v<major>.<minor>.<patch>[-<prerelease>]`) is pushed to the repository
1111
- **THEN** a workflow runs on `ubuntu-latest`, checks out the code, installs packaging dependencies (`debhelper`, `dpkg-dev`, `curl`, `bzip2`, etc.), ensures `CARGO_HOME="$(pwd)/.cargo-home"`, and invokes `build/package-deb.sh --distro debian` and `--distro ubuntu`
1212
- **AND** the workflow archives the resulting `.deb` artifacts from `dist/`
1313

@@ -25,14 +25,15 @@ Maintainers MUST have documentation explaining how to trigger and verify the aut
2525

2626
#### Scenario: README describes tagging flow
2727
- **WHEN** a maintainer reads the release section
28-
- **THEN** they learn to push a `v<MAJOR>.<MINOR>.<PATCH>` tag, wait for the workflow, and confirm `.deb` assets on GitHub Releases, including notes about required permissions and how to re-run a failed job.
28+
- **THEN** they learn to push a `v<MAJOR>.<MINOR>.<PATCH>` or `v<MAJOR>.<MINOR>.<PATCH>-<prerelease>` tag, wait for the workflow, and confirm `.deb`/`.rpm` assets on GitHub Releases, including notes about required permissions and how to re-run a failed job.
2929

3030
### Requirement: Tag-triggered RPM Packages
31-
The GitHub Actions release workflow MUST produce RPM artifacts whenever a `v<MAJOR>.<MINOR>.<PATCH>` tag is pushed.
31+
The GitHub Actions release workflow MUST produce RPM artifacts whenever a supported semver tag is pushed.
3232

3333
#### Scenario: Tag push builds RPMs
34-
- **WHEN** the release workflow runs for tag `v1.2.3`
34+
- **WHEN** the release workflow runs for tag `v1.2.3` or `v1.2.3-rc1`
3535
- **THEN** it installs the necessary RPM tooling (`rpm-build`, `createrepo_c`, etc.) and executes `build/package-rpm.sh` for each supported distro, storing the resulting `.rpm` files under `dist/`
36+
- **AND** prerelease tags are normalized for RPM metadata by storing the core semver in `Version` and moving the prerelease label into `Release`
3637
- **AND** failures building the RPM cause the workflow to fail so releases are never missing RPM assets silently
3738

3839
### Requirement: RPM Release Assets
@@ -42,4 +43,3 @@ GitHub Releases MUST include the RPM artifacts beside the `.deb` files.
4243
- **WHEN** the workflow publishes assets for tag `v1.2.3`
4344
- **THEN** it uploads each generated `.rpm` file (e.g., `chissu-pam-1.2.3.fedora.x86_64.rpm`) to the tag’s GitHub Release via the same step that publishes `.deb` files
4445
- **AND** the workflow surfaces an error if any `.rpm` upload fails so maintainers can rerun the job
45-

0 commit comments

Comments
 (0)