File influxdb.spec of Package influxdb

#
# spec file for package obs-service-format_spec_file
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

Name:           influxdb
Version:        3.4.1~0
Release:        0
Summary:        A database to collect, process, transform, and store event and time series data
License:        MIT
Url:            https://github.com/influxdata/influxdb
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        cargo_config
Source3:        influxdb.service
Source4:        influxdb-user.conf
BuildRequires:  cargo-packaging
BuildRequires:  protobuf-devel
BuildRequires:  python3-devel
BuildRequires:  sysuser-tools
ExclusiveArch:  %{rust_tier1_arches}

%define bin_name influxdb3

%description
InfluxDB Core is a database built to collect, process, transform, and store event and time
series data. It is ideal for use cases that require real-time ingest and fast query response
times to build user interfaces, monitoring, and automation solutions.

%prep
%autosetup -p1 -a1

%build
%sysusers_generate_pre %{SOURCE4} %{name}

# disable lto to reduce build memory footprint
sed -i 's/lto = "fat"/lto = false/g' Cargo.toml
sed -i 's/pub const NUM_DBS_LIMIT: usize = 5;/pub const NUM_DBS_LIMIT: usize = 100;/g' influxdb3_catalog/src/catalog/versions/v1.rs
sed -i 's/pub const NUM_DBS_LIMIT: usize = 5;/pub const NUM_DBS_LIMIT: usize = 100;/g' influxdb3_catalog/src/catalog/versions/v2.rs

export RUST_BACKTRACE=full
export GIT_HASH=2da1bd0209646f11e12673cfe91ee4fb487338d5
export GIT_HASH_SHORT=2da1bd0209
%{cargo_build}

%install
install -D -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{bin_name} %{buildroot}%{_bindir}/%{bin_name}
mkdir -p %{buildroot}%{_localstatedir}/lib/influxdb
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/influxdb.service
install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/influxdb-user.conf

%check

%pre -f %{name}.pre
%service_add_pre influxdb.service

%preun
%service_del_preun influxdb.service

%post
%service_add_post influxdb.service

%postun
%service_del_postun influxdb.service

%files
%{_bindir}/%{bin_name}
%license LICENSE-MIT
%doc README.md
%{_unitdir}/influxdb.service
%{_sysusersdir}/influxdb-user.conf
%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb

%changelog
openSUSE Build Service is sponsored by