bouquin-sqlcipher4/rpm/bouquin-sqlcipher4.spec
Miguel Jacq bbbedc6a5d
All checks were successful
CI / test (push) Successful in 2m11s
Trivy / test (push) Successful in 23s
Add rpm build
2025-12-24 14:37:51 +11:00

77 lines
2.2 KiB
RPMSpec

# Fedora 42 RPM spec using Fedora's pyproject RPM macros.
#
# IMPORTANT: your upstream pyproject.toml declares Poetry as the build backend
# and lists build-system requires such as conan and lipomerge. Debian packaging
# disables PEP517 and builds via setup.py.
#
# To keep the RPM build closer to Debian while still using %pyproject_* macros,
# this spec rewrites ONLY the [build-system] table at %prep time so that
# PEP517 uses setuptools.build_meta with minimal requirements.
#
# If you prefer zero PEP517 involvement, use the "-setup.spec" instead.
%global upstream_version 4.12.0
Name: bouquin-sqlcipher4
Version: %{upstream_version}
Release: 1%{?dist}.bouquin1
Summary: SQLCipher 4-backed sqlcipher module (Bouquin fork)
License: MIT
URL: https://git.mig5.net/mig5/bouquin-sqlcipher4
Source0: %{name}-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: make
BuildRequires: redhat-rpm-config
BuildRequires: openssl-devel
BuildRequires: pyproject-rpm-macros
BuildRequires: python3-devel
Provides: python3-sqlcipher4 = %{version}-%{release}
%description
Provides the `sqlcipher4` Python module compiled against a bundled SQLCipher 4
amalgamation, suitable for use by Bouquin. Built for internal distribution.
%prep
%autosetup -n bouquin-sqlcipher4
# Keep Python dist metadata in sync with the RPM Version.
sed -ri 's/version="[^"]+"/version="%{version}"/' setup.py
# Rewrite [build-system] to avoid Poetry backend + non-packaged build requirements.
%{python3} - <<'PY'
from pathlib import Path
import re
p = Path("pyproject.toml")
txt = p.read_text(encoding="utf-8")
pat = re.compile(r'(?ms)^\[build-system\]\n.*?(?=^\[|\Z)')
replacement = (
"[build-system]\n"
"requires = [\"setuptools>=45\", \"wheel\"]\n"
"build-backend = \"setuptools.build_meta\"\n\n"
)
p.write_text(pat.sub(replacement, txt), encoding="utf-8")
PY
%generate_buildrequires
export BOUQUIN_SYSTEM_OPENSSL=1
%pyproject_buildrequires
%build
export BOUQUIN_SYSTEM_OPENSSL=1
%pyproject_wheel
%install
export BOUQUIN_SYSTEM_OPENSSL=1
%pyproject_install
%pyproject_save_files sqlcipher4
%files -f %{pyproject_files}
%license LICENSE
%doc README.md
%changelog
* Wed Dec 24 2025 Miguel Jacq <mig@mig5.net> - %{upstream_version}
- New release