File golang-github-influxdb-influxdb.spec of Package golang-github-influxdb-influxdb

#
# spec file for package golang-github-influxdb-influxdb
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%global provider        github
%global provider_tld    com
%global project         influxdata
%global _project        influxdb
%global repo            influxdb
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path     %{provider_prefix}

Name:           golang-%{provider}-%{_project}-%{repo}
Version:        1.1.0
Release:        0
Summary:        Scalable datastore for metrics, events, and real-time analytics
License:        MIT
Group:          Development/Languages/Golang
Url:            https://%{provider_prefix}
Source0:        %{repo}-%{version}.tar.xz
Source1:        %{repo}.service
Source2:        %{repo}.tmpfiles
Source3:        rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  golang-packaging
BuildRequires:  golang-github-collectd-go-collectd
BuildRequires:  golang(github.com/BurntSushi/toml)
BuildRequires:  golang(github.com/bmizerany/pat)
BuildRequires:  golang(github.com/boltdb/bolt)
BuildRequires:  golang(github.com/dgryski/go-bits)
BuildRequires:  golang(github.com/dgryski/go-bitstream)
BuildRequires:  golang(github.com/gogo/protobuf/proto)
BuildRequires:  golang(github.com/golang/snappy)
BuildRequires:  golang(github.com/influxdata/usage-client/v1)
BuildRequires:  golang(github.com/jwilder/encoding/simple8b)
BuildRequires:  golang(github.com/kimor79/gollectd)
BuildRequires:  golang(github.com/paulbellamy/ratecounter)
BuildRequires:  golang(github.com/peterh/liner)
BuildRequires:  golang(github.com/rakyll/statik/fs)
BuildRequires:  golang(github.com/dgrijalva/jwt-go)
BuildRequires:  golang(github.com/retailnext/hllpp)

%{go_nostrip}
%{go_provides}

%description
InfluxDB is an open source distributed time series database with no external dependencies. It's useful for recording metrics, events, and performing analytics.

%package -n influxdb
Summary:        Scalable datastore for metrics, events, and real-time analytics
Group:          Productivity/Databases/Servers
Requires(pre):  pwdutils
AutoReqProv:    no

%{?systemd_requires}
%{go_exclusivearch}

%description -n influxdb
InfluxDB is an open source distributed time series database with no external dependencies. It's useful for recording metrics, events, and performing analytics.

%prep
%setup -q -n %{repo}-%{version}

%build
%goprep %{import_path}
%gobuild ./cmd/...
%gobuild ./stress/stress_test_server

%install
mkdir -p %{buildroot}%{_sysconfdir}/influxdb
install -D -m 644 etc/config.sample.toml %{buildroot}%{_sysconfdir}/influxdb/config.toml
mkdir -p %{buildroot}%{_localstatedir}/log/influxdb
mkdir -p %{buildroot}%{_localstatedir}/lib/influxdb
mkdir -p %{buildroot}%{_localstatedir}/lib/influxdb/{data,meta,hh}
mkdir -p %{buildroot}%{_sbindir}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/influxdb.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcinfluxdb
install -D -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/influxdb.conf
%goinstall
%gosrc
%gofilelist

%check
#gotest github.com/influxdata/influxdb/...

%pre -n influxdb
getent group influxdb >/dev/null || groupadd -r influxdb
getent passwd influxdb >/dev/null || useradd -r -g influxdb \
	-d %{_localstatedir}/lib/influxdb \
	-s /sbin/nologin \
	-c "user for InfluxDB database server" influxdb
%service_add_pre influxdb.service

%preun -n influxdb
%service_del_preun influxdb.service

%post -n influxdb
systemd-tmpfiles --create /usr/lib/tmpfiles.d/influxdb.conf || true
%service_add_post influxdb.service

%postun -n influxdb
%service_del_postun influxdb.service

%files -f file.lst
%defattr(-,root,root,-)
%doc README.md LICENSE

%files -n influxdb
%defattr(-,root,root,-)
%dir %{_sysconfdir}/influxdb
%config %{_sysconfdir}/influxdb/config.toml
%{_bindir}/influx
%{_bindir}/influx_inspect
%{_bindir}/influxd
%{_bindir}/influx_stress
%{_bindir}/stress_test_server
%{_bindir}/influx_tsm
%{_sbindir}/rcinfluxdb
%{_unitdir}/influxdb.service
%dir %{_tmpfilesdir}
%{_tmpfilesdir}/influxdb.conf
%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/log/influxdb
%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb
%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/meta
%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/data
%attr(0755, influxdb, influxdb) %dir %{_localstatedir}/lib/influxdb/hh

%changelog
openSUSE Build Service is sponsored by