Name: persistency Version: 0.1.0 Release: 2%{?dist} Summary: Thread-safe key-value storage library with JSON persistence License: Apache-2.0 # Disable automatic debuginfo package since Rust release builds strip symbols %global debug_package %{nil} %global _enable_debug_packages 0 %global _build_id_links none URL: https://github.com/eclipse-ecsp/persistency Source0: %{name}-%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: make BuildRequires: rust >= 1.70 BuildRequires: cargo BuildRequires: score-baselibs-devel BuildRequires: pkgconfig BuildRequires: libacl-devel BuildRequires: libcap-devel # Vendored Rust dependencies (for offline builds) Source1: %{name}-%{version}-vendor.tar.gz # Runtime dependencies Requires: score-baselibs %description A thread-safe key-value storage library implemented in both C++ and Rust, providing persistent storage with JSON-based serialization. Features include snapshot management, data integrity checks, and support for multiple data types. # C++ Library Package %package cpp Summary: C++ implementation of the key-value storage library Requires: score-baselibs%{?_isa} %description cpp C++ implementation of the thread-safe key-value storage library. Provides a robust API for persistent key-value operations with JSON backend storage, snapshot management, and data integrity verification. %package cpp-devel Summary: Development files for persistency C++ library Requires: %{name}-cpp%{?_isa} = %{version}-%{release} Requires: score-baselibs-devel%{?_isa} %description cpp-devel Development files and headers for the persistency C++ library. Required for building applications that use the C++ key-value storage API. # Rust Library Package %package rust Summary: Rust implementation of the key-value storage library Requires: glibc%{?_isa} %description rust Rust implementation of the thread-safe key-value storage library. Provides compiled Rust library files (.rlib) with the same functionality as the C++ version but with Rust's memory safety guarantees and zero-cost abstractions. %package rust-devel Summary: Development files for persistency Rust library Requires: %{name}-rust%{?_isa} = %{version}-%{release} Requires: rust >= 1.70 %description rust-devel Development files for the persistency Rust library. Includes source code and metadata required for building Rust applications that depend on the persistency crate. # Rust CLI Tool Package %package cli Summary: Command-line interface for key-value storage operations Requires: %{name}-rust%{?_isa} = %{version}-%{release} %description cli Command-line tool for interacting with the key-value storage system. Provides commands for setting, getting, removing keys, managing snapshots, and performing various storage operations from the shell. # Note: Demo packages are now provided separately by persistency-demo project %prep %autosetup -n %{name}-%{version} # Extract vendored dependencies %setup -q -T -D -a 1 # Configure cargo to use vendored dependencies mkdir -p .cargo cat > .cargo/config.toml << 'EOF' [source.crates-io] replace-with = "vendored-sources" [source."git+https://github.com/qorix-group/testing_tools.git?tag=v0.2.0"] git = "https://github.com/qorix-group/testing_tools.git" tag = "v0.2.0" replace-with = "vendored-sources" [source.vendored-sources] directory = "vendor" EOF %build # Build C++ library with Makefile cd src/cpp make cd ../.. # Note: C++ and Rust demos are now in separate persistency-demo package # Build Rust library and CLI export CARGO_HOME=.cargo cargo build --release # Note: Rust demo build removed - now in separate persistency-demo package %install # Install C++ library manually (Makefile approach) cd src/cpp # Install libraries mkdir -p %{buildroot}%{_libdir} install -m 644 libkvs_cpp.a %{buildroot}%{_libdir}/ install -m 644 libkvs_internal.a %{buildroot}%{_libdir}/ install -m 644 libkvsvalue.a %{buildroot}%{_libdir}/ # Install headers mkdir -p %{buildroot}%{_includedir}/kvs install -m 644 src/kvs.hpp %{buildroot}%{_includedir}/kvs/ install -m 644 src/kvsbuilder.hpp %{buildroot}%{_includedir}/kvs/ install -m 644 src/kvsvalue.hpp %{buildroot}%{_includedir}/kvs/ # Install internal headers mkdir -p %{buildroot}%{_includedir}/kvs/internal install -m 644 src/internal/error.hpp %{buildroot}%{_includedir}/kvs/internal/ install -m 644 src/internal/kvs_helper.hpp %{buildroot}%{_includedir}/kvs/internal/ cd ../.. # Install Rust components export CARGO_HOME=.cargo # Install Rust CLI binary mkdir -p %{buildroot}%{_bindir} install -D -m 755 target/release/kvs_tool %{buildroot}%{_bindir}/kvs-tool # Note: Demo binaries are provided by separate persistency-demo package # For Rust libraries, we use cargo install approach export CARGO_INSTALL_ROOT=%{buildroot}%{_prefix} mkdir -p %{buildroot}%{_datadir}/cargo/registry # Install Rust library - compiled artifacts mkdir -p %{buildroot}%{_libdir}/rust # Install the compiled Rust library files find target/release/deps -name "librust_kvs-*.rlib" -exec install -m 644 {} %{buildroot}%{_libdir}/rust/ \; # For Rust development - install source code and metadata mkdir -p %{buildroot}%{_datadir}/rust/crates/%{name}-rust-%{version} cp -r src/rust/rust_kvs/* %{buildroot}%{_datadir}/rust/crates/%{name}-rust-%{version}/ # Create Cargo.toml for the installed crate (for development) cat > %{buildroot}%{_datadir}/rust/crates/%{name}-rust-%{version}/Cargo.toml << 'EOF' [package] name = "rust_kvs" version = "%{version}" edition = "2021" [dependencies] adler32 = "1.2.0" tinyjson = "2.5.1" [dev-dependencies] tempfile = "3.20" EOF # Create registry metadata for development mkdir -p %{buildroot}%{_datadir}/cargo/registry/cache mkdir -p %{buildroot}%{_datadir}/cargo/registry/src # Create pkg-config file for C++ library mkdir -p %{buildroot}%{_libdir}/pkgconfig cat > %{buildroot}%{_libdir}/pkgconfig/persistency-cpp.pc << 'EOF' prefix=%{_prefix} exec_prefix=${prefix} libdir=%{_libdir} includedir=%{_includedir} Name: persistency-cpp Description: Thread-safe key-value storage library (C++) Version: %{version} Requires: score-baselibs Libs: -L${libdir} -lkvs_cpp -lkvs_internal -lkvsvalue Cflags: -I${includedir} EOF # Install documentation and license files manually mkdir -p %{buildroot}%{_docdir}/persistency-cpp cp README.md %{buildroot}%{_docdir}/persistency-cpp/ mkdir -p %{buildroot}%{_licensedir}/persistency-cpp cp LICENSE %{buildroot}%{_licensedir}/persistency-cpp/ mkdir -p %{buildroot}%{_docdir}/persistency-rust cp README.md %{buildroot}%{_docdir}/persistency-rust/ mkdir -p %{buildroot}%{_licensedir}/persistency-rust cp LICENSE %{buildroot}%{_licensedir}/persistency-rust/ mkdir -p %{buildroot}%{_licensedir}/persistency-cli cp LICENSE %{buildroot}%{_licensedir}/persistency-cli/ # Note: Demo installation removed - demos are now in separate persistency-demo package %check # C++ tests (if enabled) # cd src/cpp/build && make test # Rust tests export CARGO_HOME=.cargo cargo test --release %files cpp %{_libdir}/libkvs_cpp.a %{_libdir}/libkvs_internal.a %{_libdir}/libkvsvalue.a %{_docdir}/persistency-cpp/ %{_licensedir}/persistency-cpp/ %files cpp-devel %{_includedir}/kvs/ %{_libdir}/pkgconfig/persistency-cpp.pc %files rust %{_libdir}/rust/ %{_docdir}/persistency-rust/ %{_licensedir}/persistency-rust/ %files rust-devel %{_datadir}/rust/crates/%{name}-rust-%{version}/ %{_datadir}/cargo/registry/ %files cli %{_bindir}/kvs-tool %{_licensedir}/persistency-cli/ # Note: Demo packages removed - now provided by separate persistency-demo project %changelog * Wed Nov 26 2025 Pierre-Yves Chibon - 0.1.0-2 - Fix: Install internal headers required by public headers - Add installation of internal/error.hpp and internal/kvs_helper.hpp - These headers are required by kvs.hpp but were not being installed - Remove demo packages (moved to separate persistency-demo project) * Tue Nov 25 2025 Pierre-Yves Chibon - 0.1.0-1 - Initial package creation - Separate C++ and Rust implementations - CLI tool as separate subpackage - Thread-safe key-value storage with JSON persistence - Snapshot management and data integrity features