app-build/scripts/common.sh
Philip Peterson b3c34b1592 app-build: build in-house apps as RPMs for x86_64 and aarch64
Moved out of each app's repo (layer-wizard, dnf-package-store,
swap-watchdog), which each had a copy of the same build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:04:39 -09:00

20 lines
827 B
Bash
Executable file

# shellcheck shell=bash
# Shared by build-*.sh: runs in a Fedora container with the app's repo at
# /src, a cache that outlives the job at /cache, and RPMs going to /out.
set -euo pipefail
# The checkout and caches belong to other users than the container's root.
git_safe() { git config --global --add safe.directory '*'; }
# Packages the app with packaging/$NAME.spec. The spec gets version_,
# release_ and srcdir (/src), plus any extra --define pairs passed here.
package_rpm() {
local version=$1; shift
local release
release=$(date -u +%Y%m%d%H%M).git$(git -C /src rev-parse --short=7 HEAD)
rpmbuild -bb "/src/packaging/$NAME.spec" \
--define "_topdir /tmp/rpmbuild" \
--define "version_ $version" --define "release_ $release" --define "srcdir /src" \
"$@"
cp -v /tmp/rpmbuild/RPMS/*/*.rpm /out/
}