diff options
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | makedeps.sh | 19 | ||||
-rw-r--r-- | redis-json.spec | 126 |
4 files changed, 158 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f0400 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.bz2 +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e65467 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../common/Makefile + diff --git a/makedeps.sh b/makedeps.sh new file mode 100755 index 0000000..352df0d --- /dev/null +++ b/makedeps.sh @@ -0,0 +1,19 @@ +#!/bin/sh +NAME=$(sed -n '/^Name:/{s/.* //;p}' *.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +MODULE=$(sed -n '/^%global gh_proj/{s/.* //;p}' $NAME.spec) + +if [ -f $MODULE-$VERSION.tar.gz ]; then + echo "+ Unpack" + tar xf $MODULE-$VERSION.tar.gz + + pushd $MODULE-$VERSION + echo "+ Fetch" + cargo vendor mycargo + + echo "+ Pack" + tar czf ../$MODULE-deps-$VERSION.tgz mycargo + popd +else + echo $MODULE-$VERSION.tar.gz missing +fi diff --git a/redis-json.spec b/redis-json.spec new file mode 100644 index 0000000..a87e32b --- /dev/null +++ b/redis-json.spec @@ -0,0 +1,126 @@ +# remirepo/fedora spec file for redis-json +# +# SPDX-FileCopyrightText: Copyright 2025 Remi Collet +# SPDX-License-Identifier: CECILL-2.1 +# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +# +# Please, preserve the changelog entries +# + +# Github forge +%global gh_vend RedisJSON +%global gh_proj RedisJSON +%global forgeurl https://github.com/%{gh_vend}/%{gh_proj} +#global commit afe5de4ce52bb2b80af565a6f297bf330a65d0d8 +%global tag v%{version} +# for EL-8 to avoid TAG usage +%global archivename %{gh_proj}-%{version} + +Name: redis-json +Version: 8.0.1 +%forgemeta +Release: 1%{?dist} +Summary: JSON as native data type +# Starting with Redis 8, RedisJSON is licensed under your choice of: +# (i) Redis Source Available License 2.0 (RSALv2); +# (ii) the Server Side Public License v1 (SSPLv1); or +# (iii) the GNU Affero General Public License version 3 (AGPLv3). +License: AGPL-3.0-only +URL: %{forgeurl} +Source0: %{forgesource} +Source1: makedeps.sh +Source2: %{gh_proj}-deps-%{version}.tgz + +BuildRequires: redis-devel +%if 0%{?fedora} || 0%{?rhel} >= 9 +BuildRequires: cargo-rpm-macros >= 24 +%endif +BuildRequires: cargo >= 1.73 +BuildRequires: rust >= 1.73 +BuildRequires: clang-devel + +Provides: redis(modules_abi)%{?_isa} = %{redis_modules_abi} +Requires: (redis >= 8.0 with redis < 8.1) +Supplements: redis + + +%description +RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange +Standard as a native data type. It allows storing, updating, and fetching JSON +values from Redis keys (documents). + +%prep +%setup -q -a2 -n %{gh_proj}-%{version} + +: Configuration file +cat << EOF | tee json.conf +# %{gh_proj} +loadmodule %{redis_modules_dir}/librejson.so +EOF + +: Create cargo configuration to use vendor directory +cat << EOF | tee .cargo/config.toml +[build] +jobs = %(echo %{?_smp_mflags} | sed 's/\-j//') +rustc = "%{_bindir}/rustc" + +[profile.rpm] +inherits = "release" +opt-level = 3 +codegen-units = 1 +debug = 2 +strip = "none" + +[env] +CFLAGS = "%{build_cflags}" +CXXFLAGS = "%{build_cxxflags}" +LDFLAGS = "%{build_ldflags}" + +[term] +verbose = true + +[source.crates-io] +replace-with = "vendored-sources" + +[source."git+https://github.com/RedisJSON/ijson?rev=881b96e7941b8dc335863746ac108f6d9ed0b98a"] +git = "https://github.com/RedisJSON/ijson" +rev = "881b96e7941b8dc335863746ac108f6d9ed0b98a" +replace-with = "vendored-sources" + +[source."git+https://github.com/RedisLabsModules/redismodule-rs?tag=v2.1.2"] +git = "https://github.com/RedisLabsModules/redismodule-rs" +tag = "v2.1.2" +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "$PWD/mycargo" +EOF + +: Required rust version +grep -h rust-version mycargo/*/Cargo.toml Cargo.toml | sort -u | tail -n 8 + + +%build +%if 0%{?fedora} || 0%{?rhel} >= 9 +%cargo_build +%else +cargo build %{?_smp_mflags} --profile rpm +%endif + + +%install +install -Dpm755 target/rpm/librejson.so %{buildroot}%{redis_modules_dir}/librejson.so +install -Dpm640 json.conf %{buildroot}%{redis_modules_cfg}/json.conf + + +%files +%license LICENSE.txt +%license licenses/AGPLv3.txt +%doc *.md +%attr(0640, redis, root) %config(noreplace) %{redis_modules_cfg}/json.conf +%{redis_modules_dir}/librejson.so + + +%changelog +* Wed Jul 23 2025 Remi Collet <remi@remirepo.net> - 8.0.1-1 +- initial package |