Blob Blame History Raw
%if 0%{?fedora} || 0%{?rhel} == 6
%global with_devel 1
%global with_bundled 0
%global with_debug 0
# tests are skiped as there are unresolved dependencies
%global with_check 0
%global with_unit_test 1
%else
%global with_devel 0
%global with_bundled 0
%global with_debug 0
%global with_check 0
%global with_unit_test 0
%endif

%if 0%{?with_debug}
%global _dwz_low_mem_die_limit 0
%else
%global debug_package   %{nil}
%endif

%define copying() \
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
%license %{*} \
%else \
%doc %{*} \
%endif

%global isgccgoarch 0
%if 0%{?gccgo_arches:1}
%ifarch %{gccgo_arches}
%global isgccgoarch 1
%endif
%endif

%global provider        github
%global provider_tld    com
%global project         influxdb
%global repo            influxdb
# https://github.com/influxdb/influxdb
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path     %{provider_prefix}
%global commit          9485e99796c53635fbf179b3e973c363937de00b
%global shortcommit     %(c=%{commit}; echo ${c:0:7})

Name:           golang-%{provider}-%{project}-%{repo}
Version:        0.8.5
Release:        0.5.git%{shortcommit}%{?dist}
Summary:        Scalable datastore for metrics, events, and real-time analytics
License:        MIT
URL:            https://%{provider_prefix}
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz

# If go_arches not defined fall through to implicit golang archs
%if 0%{?go_arches:1}
ExclusiveArch:  %{go_arches}
%else
ExclusiveArch:   %{ix86} x86_64 %{arm}
%endif
# If gccgo_arches does not fit or is not defined fall through to golang
%if %{isgccgoarch}
BuildRequires:   gcc-go >= %{gccgo_min_vers}
%else
BuildRequires:   golang
%endif

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

It has a built-in HTTP API so you don't have to write any server side code to
get up and running.

InfluxDB is designed to be scalable, simple to install and manage, and fast to
get data in and out.

It aims to answer queries in real-time. That means every data point is indexed
as it comes in and is immediately available in queries that should return
in < 100ms.

%if 0%{?with_devel}
%package datastore
Summary:        Golang datastore libs for influxdb
BuildArch:      noarch

%if 0%{?with_check}
BuildRequires:  golang(code.google.com/p/goprotobuf/proto)
BuildRequires:  golang(code.google.com/p/log4go)
BuildRequires:  golang(github.com/BurntSushi/toml)
BuildRequires:  golang(github.com/influxdb/gomdb)
BuildRequires:  golang(github.com/jmhodges/levigo)
#github.com/influxdb/rocksdb rocksdb not packaged in Fedora
#github.com/influxdb/hyperleveldb-go hyperleveldb not packages in Fedora
#launchpad.net/gocheck for tests but there is no check so far
%endif

Requires:  golang(code.google.com/p/goprotobuf/proto)
Requires:  golang(code.google.com/p/log4go)
Requires:  golang(github.com/BurntSushi/toml)
Requires:  golang(github.com/influxdb/gomdb)
Requires:  golang(github.com/jmhodges/levigo)

Provides:       golang(%{import_path}/datastore) = %{version}-%{release}
Provides:       golang(%{import_path}/datastore/storage) = %{version}-%{release}

%description datastore
%{%description}

This package contains datastore part of influxdb.
Hyperleveldb and rocksdb are not included is they are not packaged in Fedora.

%package client
Summary:        Golang client libs for influxdb
BuildArch:      noarch

%if 0%{?with_check}
%endif

Provides:       golang(%{import_path}/client) = %{version}-%{release}

%description client
%{%description}

This package contains client part of influxdb.

%package devel
Summary:       %{summary}
BuildArch:     noarch

%if 0%{?with_check}
BuildRequires:  golang(code.google.com/p/log4go)
BuildRequires:  golang(github.com/bmizerany/pat)
BuildRequires:  golang(github.com/influxdb/go-cache)
BuildRequires:  golang(github.com/BurntSushi/toml)
BuildRequires:  golang(github.com/influxdb/gomdb)
BuildRequires:  golang(github.com/jmhodges/levigo)
BuildRequires:  golang(code.google.com/p/goprotobuf/proto)
BuildRequires:  golang(github.com/stretchr/testify/assert)
BuildRequires:  golang(github.com/stretchr/testify/mock)
BuildRequires:  golang(github.com/rakyll/statik/fs)
BuildRequires:  golang(github.com/dgnorton/goback)
BuildRequires:  golang(github.com/kimor79/gollectd)
%endif

Requires:       golang(%{import_path}/client) = %{version}-%{release}
Requires:       golang(%{import_path}/datastore) = %{version}-%{release}
Requires:       golang(code.google.com/p/log4go)
Requires:       golang(github.com/bmizerany/pat)
Requires:       golang(github.com/influxdb/go-cache)
Requires:       golang(github.com/BurntSushi/toml)
Requires:       golang(github.com/influxdb/gomdb)
Requires:       golang(github.com/jmhodges/levigo)
Requires:       golang(code.google.com/p/goprotobuf/proto)
Requires:       golang(github.com/stretchr/testify/assert)
Requires:       golang(github.com/stretchr/testify/mock)
Requires:       golang(github.com/rakyll/statik/fs)
Requires:       golang(github.com/dgnorton/goback)
Requires:       golang(github.com/kimor79/gollectd)

Provides:       golang(%{import_path}/admin) = %{version}-%{release}
Provides:       golang(%{import_path}/api) = %{version}-%{release}
Provides:       golang(%{import_path}/api/collectd) = %{version}-%{release}
Provides:       golang(%{import_path}/api/graphite) = %{version}-%{release}
Provides:       golang(%{import_path}/api/http) = %{version}-%{release}
Provides:       golang(%{import_path}/api/udp) = %{version}-%{release}
Provides:       golang(%{import_path}/checkers) = %{version}-%{release}
Provides:       golang(%{import_path}/cluster) = %{version}-%{release}
Provides:       golang(%{import_path}/common) = %{version}-%{release}
Provides:       golang(%{import_path}/configuration) = %{version}-%{release}
Provides:       golang(%{import_path}/coordinator) = %{version}-%{release}
Provides:       golang(%{import_path}/daemon) = %{version}-%{release}
Provides:       golang(%{import_path}/engine) = %{version}-%{release}
Provides:       golang(%{import_path}/integration) = %{version}-%{release}
Provides:       golang(%{import_path}/integration/helpers) = %{version}-%{release}
Provides:       golang(%{import_path}/metastore) = %{version}-%{release}
Provides:       golang(%{import_path}/parser) = %{version}-%{release}
Provides:       golang(%{import_path}/protocol) = %{version}-%{release}
Provides:       golang(%{import_path}/server) = %{version}-%{release}
Provides:       golang(%{import_path}/tools/benchmark-multi-series) = %{version}-%{release}
Provides:       golang(%{import_path}/tools/benchmark-storage) = %{version}-%{release}
Provides:       golang(%{import_path}/tools/benchmark) = %{version}-%{release}
Provides:       golang(%{import_path}/wal) = %{version}-%{release}

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

It has a built-in HTTP API so you don't have to write any server side code to
get up and running.

InfluxDB is designed to be scalable, simple to install and manage, and fast to
get data in and out.

It aims to answer queries in real-time. That means every data point is indexed
as it comes in and is immediately available in queries that should return
in < 100ms.

This package contains library source intended for
building other packages which use import path with
%{import_path} prefix.
%endif

%if 0%{?with_unit_test}
%package unit-test
Summary:         Unit tests for %{name} package
# If go_arches not defined fall through to implicit golang archs
%if 0%{?go_arches:1}
ExclusiveArch:  %{go_arches}
%else
ExclusiveArch:   %{ix86} x86_64 %{arm}
%endif
# If gccgo_arches does not fit or is not defined fall through to golang
%if %{isgccgoarch}
BuildRequires:   gcc-go >= %{gccgo_min_vers}
%else
BuildRequires:   golang
%endif

%if 0%{?with_check}
#Here comes all BuildRequires: PACKAGE the unit tests
#in %%check section need for running
%endif

# test subpackage tests code from devel subpackage
Requires:        %{name}-devel = %{version}-%{release}

%description unit-test
%{summary}

This package contains unit tests for project
providing packages with %{import_path} prefix.
%endif

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

%build

%install
# source codes for building projects
%if 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
# find all *.go but no *_test.go files and generate devel.file-list
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep -v "^./client" | grep -v "^./datastore" | grep -v "./_vendor") ; do
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
done
# find all *.go but no *_test.go files and generate devel.file-list
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep "^./client") ; do
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
    echo "%%{gopath}/src/%%{import_path}/$file" >> client_devel.file-list
done
# find all *.go but no *_test.go files and generate devel.file-list
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep "^./datastore") ; do
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
    echo "%%{gopath}/src/%%{import_path}/$file" >> datastore_devel.file-list
done
%endif

# testing files for this project
%if 0%{?with_unit_test}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
# find all *_test.go files and generate unit-test.file-list
for file in $(find . -iname "*_test.go" | grep -v "./_vendor"); do
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
done
%endif

%check
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
%if %{isgccgoarch}
function gotest { %{gcc_go_test} "$@"; }
%else
%if 0%{?golang_test:1}
function gotest { %{golang_test} "$@"; }
%else
function gotest { go test "$@"; }
%endif
%endif

export GOPATH=%{buildroot}/%{gopath}:%{gopath}
gotest %{import_path}/admin
gotest %{import_path}/api/collectd
gotest %{import_path}/api/http
gotest %{import_path}/cluster
gotest %{import_path}/common
gotest %{import_path}/configuration
gotest %{import_path}/coordinator
gotest %{import_path}/datastore
gotest %{import_path}/engine
gotest %{import_path}/integration
gotest %{import_path}/parser
gotest %{import_path}/protocol
gotest %{import_path}/wal
%endif

%if 0%{?with_devel}
%files client -f client_devel.file-list
%copying LICENSE
%doc CHANGELOG.md README.md Makefile.in Gemfile
%dir %{gopath}/src/%{import_path}/client

%files datastore -f datastore_devel.file-list
%copying LICENSE
%doc CHANGELOG.md README.md Makefile.in Gemfile
%dir %{gopath}/src/%{import_path}/datastore

%files devel -f devel.file-list
%copying LICENSE
%doc CHANGELOG.md README.md
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%dir %{gopath}/src/%{import_path}
%endif

%if 0%{?with_unit_test}
%files unit-test -f unit-test.file-list
%copying LICENSE
%doc CHANGELOG.md README.md
%endif

%changelog
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.5-0.5.git9485e99
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Aug 24 2015 jchaloup <jchaloup@redhat.com> - 0.8.5-0.4.git9485e99
- Update spec file to spec-2.0
  resolves: #1250485

* Mon Aug 17 2015 jchaloup <jchaloup@redhat.com> - 0.8.5-0.3.git9485e99
- Update BR/R
  related: #1161618

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.5-0.2.git9485e99
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Jan 06 2015 jchaloup <jchaloup@redhat.com> - 0.8.5-0.1.git9485e99
- Update to 0.8.5
  resolves: #1161618

* Sun Nov 09 2014 jchaloup <jchaloup@redhat.com> - 0.8.0-0.5.rc4.git67f9869
- Choose the correct architecture
  related: #1141892
- Bump to upstream b611d020cd78886232cfa6c2ea0606b49d307ed2
  resolves: #1161618

* Tue Oct 14 2014 jchaloup <jchaloup@redhat.com> - 0.8.0-0.4.rc4.git67f9869
- Adding BR on gomdb

* Thu Oct 09 2014 jchaloup <jchaloup@redhat.com> - 0.8.0-0.3.rc4.git67f9869
- Add subpackages (client for kubernetes, datastore for databases, devel for all)
- Add dependencies (not all of them yet)
- Test still missing (missing deps and databases in Fedora), at least add them partionally later

* Mon Sep 29 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.8.0-0.2.rc4.git67f9869
- Resolves: rhbz#1141892 - initial package upload
- preserve timestamps of source copied
- gopath is provided by the golang rpm

* Wed Aug 06 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.8.0-0.1.rc4.git67f9869
- First package for Fedora.