summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-08-05 11:57:25 +0200
committerRemi Collet <remi@php.net>2025-08-05 11:57:25 +0200
commit00f941c88b62713a67074add2558024050b79a11 (patch)
tree3979567a11e6786ab325c43b1b5bb22b0d998ed8
initial package
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rwxr-xr-xmakedeps.sh19
-rwxr-xr-xmakesrc.sh20
-rw-r--r--valkey-bloom.spec98
5 files changed, 150 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..91b0fd5
--- /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..99ce444
--- /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 $NAME-$VERSION.tgz ]; then
+ echo "+ Unpack"
+ tar xf $NAME-$VERSION.tgz
+
+ pushd $MODULE-$VERSION
+ echo "+ Fetch"
+ cargo vendor mycargo
+
+ echo "+ Pack"
+ tar czf ../$NAME-deps-$VERSION.tgz mycargo
+ popd
+else
+ echo $NAME-$VERSION.tgz missing
+fi
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..1a12fe7
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_vend/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_proj/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+
+echo "Cloning..."
+rm -rf $PROJECT-$VERSION
+git clone --branch $VERSION --recursive https://github.com/$OWNER/$PROJECT.git $PROJECT-$VERSION
+
+echo "Archiving..."
+tar czf $NAME-$VERSION.tgz --exclude-vcs $PROJECT-$VERSION
+
+echo "Cleaning..."
+rm -rf $PROJECT-$VERSION
+
+echo "Done."
diff --git a/valkey-bloom.spec b/valkey-bloom.spec
new file mode 100644
index 0000000..5f76dc1
--- /dev/null
+++ b/valkey-bloom.spec
@@ -0,0 +1,98 @@
+# remirepo/fedora spec file for valkey-bloom
+#
+# 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
+#
+
+%global cfgname bloom.conf
+%global libname bloom.so
+# Github forge
+%global gh_vend valkey-io
+%global gh_proj valkey-bloom
+%global forgeurl https://github.com/%{gh_vend}/%{gh_proj}
+#global commit afe5de4ce52bb2b80af565a6f297bf330a65d0d8
+%global tag %{version}
+# for EL-8 to avoid TAG usage
+%global archivename %{gh_proj}-%{version}
+
+Name: valkey-bloom
+Version: 1.0.0
+Release: 1%{?dist}
+Summary: Probabilistic data structures
+# this module is BSD-3-Clause
+# rust lilbraries are Apache-2.0, MIT, BSD-2-CLAUSE
+License: BSD-3-Clause AND BSD-2-CLAUSE AND Apache-2.0 AND MIT
+URL: %{forgeurl}
+Source0: %{name}-%{version}.tgz
+Source1: makesrc.sh
+# get full git snapshot with submodules
+Source2: %{name}-deps-%{version}.tgz
+Source3: makedeps.sh
+
+BuildRequires: valkey-devel >= 8.0
+BuildRequires: cargo-rpm-macros >= 24
+BuildRequires: cargo >= 1.82
+BuildRequires: rust >= 1.82
+BuildRequires: clang-devel
+
+Requires: valkey(modules_abi)%{?_isa} = %{valkey_modules_abi}
+Requires: valkey >= 8.0
+Supplements: valkey
+
+
+%description
+Valkey-Bloom (BSD-3-Clause) is a Rust based Valkey-Module which brings a Bloom
+Filter (Module) data type into Valkey and supports versions >= 8.0.
+
+With this, users can create bloom filters (space efficient probabilistic
+data structures) to add elements, check whether elements exists, auto scale
+their filters, customize bloom filter properties, perform RDB Save and load
+operations, etc.
+
+
+%prep
+%setup -q -n %{gh_proj}-%{version} -a2
+
+: Configuration file
+cat << EOF | tee %{cfgname}
+# %{gh_proj}
+loadmodule %{valkey_modules_dir}/%{libname}
+EOF
+
+: Create cargo configuration to use vendor directory
+%cargo_prep -v $PWD/mycargo
+cat .cargo/config.toml
+
+: Required rust version
+grep -h rust-version mycargo/*/Cargo.toml Cargo.toml | sort -u | tail -n 8
+
+: Bundled projects Licenses
+for proj in mycargo/*; do
+ for lic in $proj/LICENSE*; do
+ [ -f $lic ] && cp $lic $(basename $lic).$(basename $proj)
+ done
+done
+
+
+%build
+%cargo_build
+
+
+%install
+install -Dpm755 target/rpm/*%{libname} %{buildroot}%{valkey_modules_dir}/%{libname}
+install -Dpm640 %{cfgname} %{buildroot}%{valkey_modules_cfg}/%{cfgname}
+
+
+%files
+%license LICENSE*
+%doc *.md
+%attr(0640, valkey, root) %config(noreplace) %{valkey_modules_cfg}/%{cfgname}
+%{valkey_modules_dir}/%{libname}
+
+
+%changelog
+* Tue Aug 5 2025 Remi Collet <remi@remirepo.net> - 1.0.0-1
+- initial package