|
|
b444022 |
# If any of the following macros should be set otherwise,
|
|
|
b444022 |
# you can wrap any of them with the following conditions:
|
|
|
b444022 |
# - %%if 0%%{centos} == 7
|
|
|
b444022 |
# - %%if 0%%{?rhel} == 7
|
|
|
b444022 |
# - %%if 0%%{?fedora} == 23
|
|
|
b444022 |
# Or just test for particular distribution:
|
|
|
b444022 |
# - %%if 0%%{centos}
|
|
|
b444022 |
# - %%if 0%%{?rhel}
|
|
|
b444022 |
# - %%if 0%%{?fedora}
|
|
|
b444022 |
#
|
|
|
b444022 |
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
|
|
|
b444022 |
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
|
|
|
b444022 |
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
|
|
|
b444022 |
|
|
|
b444022 |
# Generate devel rpm
|
|
|
b444022 |
%global with_devel 1
|
|
|
b444022 |
# Build project from bundled dependencies
|
|
|
b444022 |
%global with_bundled 0
|
|
|
b444022 |
# Build with debug info rpm
|
|
|
b444022 |
%global with_debug 0
|
|
|
b444022 |
# Run tests in check section
|
|
|
b444022 |
%global with_check 1
|
|
|
b444022 |
# Generate unit-test rpm
|
|
|
b444022 |
%global with_unit_test 1
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_debug}
|
|
|
b444022 |
%global _dwz_low_mem_die_limit 0
|
|
|
b444022 |
%else
|
|
|
b444022 |
%global debug_package %{nil}
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
|
|
|
b444022 |
%global provider github
|
|
|
b444022 |
%global provider_tld com
|
|
|
b444022 |
%global project gocql
|
|
|
b444022 |
%global repo gocql
|
|
|
b444022 |
# https://github.com/gocql/gocql
|
|
|
b444022 |
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
|
|
b444022 |
%global import_path %{provider_prefix}
|
|
|
b020b4d |
%global commit 12e3a8c05db483441932e84ab6c35c339fb01de7
|
|
|
b020b4d |
%global commitdate 20180320
|
|
|
b444022 |
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
b444022 |
|
|
|
b444022 |
Name: golang-%{provider}-%{project}-%{repo}
|
|
|
b444022 |
Version: 0
|
|
|
46c0a9a |
Release: 0.2.%{commitdate}git%{shortcommit}%{?dist}
|
|
|
b444022 |
Summary: A fast and robust Cassandra client for Go (golang)
|
|
|
b444022 |
# Detected licences
|
|
|
b444022 |
# - BSD (3 clause) at 'LICENSE'
|
|
|
b444022 |
License: BSD
|
|
|
b444022 |
URL: https://%{provider_prefix}
|
|
|
b444022 |
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
|
|
|
b444022 |
|
|
|
b444022 |
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
|
|
|
b444022 |
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
|
|
|
b444022 |
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
|
|
b444022 |
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
|
|
b444022 |
|
|
|
b444022 |
|
|
|
b444022 |
|
|
|
b444022 |
%description
|
|
|
b444022 |
%{summary}
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_devel}
|
|
|
b444022 |
%package devel
|
|
|
b444022 |
Summary: %{summary}
|
|
|
b444022 |
BuildArch: noarch
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_check} && ! 0%{?with_bundled}
|
|
|
b444022 |
BuildRequires: golang(github.com/golang/snappy)
|
|
|
b444022 |
BuildRequires: golang(github.com/hailocab/go-hostpool)
|
|
|
b444022 |
BuildRequires: golang(gopkg.in/inf.v0)
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
Requires: golang(github.com/golang/snappy)
|
|
|
b444022 |
Requires: golang(github.com/hailocab/go-hostpool)
|
|
|
b444022 |
Requires: golang(gopkg.in/inf.v0)
|
|
|
b444022 |
|
|
|
b444022 |
Provides: golang(%{import_path}) = %{version}-%{release}
|
|
|
b444022 |
|
|
|
b444022 |
%description devel
|
|
|
b444022 |
%{summary}
|
|
|
b444022 |
|
|
|
b444022 |
This package contains library source intended for
|
|
|
b444022 |
building other packages which use import path with
|
|
|
b444022 |
%{import_path} prefix.
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
b444022 |
%package unit-test-devel
|
|
|
b444022 |
Summary: Unit tests for %{name} package
|
|
|
b444022 |
%if 0%{?with_check}
|
|
|
b444022 |
#Here comes all BuildRequires: PACKAGE the unit tests
|
|
|
b444022 |
#in %%check section need for running
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
# test subpackage tests code from devel subpackage
|
|
|
b444022 |
Requires: %{name}-devel = %{version}-%{release}
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_check} && ! 0%{?with_bundled}
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
|
|
|
b444022 |
%description unit-test-devel
|
|
|
b444022 |
%{summary}
|
|
|
b444022 |
|
|
|
b444022 |
This package contains unit tests for project
|
|
|
b444022 |
providing packages with %{import_path} prefix.
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%prep
|
|
|
b444022 |
%setup -q -n %{repo}-%{commit}
|
|
|
b444022 |
|
|
|
b444022 |
%build
|
|
|
b444022 |
%install
|
|
|
b444022 |
# source codes for building projects
|
|
|
b444022 |
%if 0%{?with_devel}
|
|
|
b444022 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
|
b444022 |
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
|
|
|
b444022 |
# find all *.go but no *_test.go files and generate devel.file-list
|
|
|
b444022 |
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
|
|
|
b444022 |
dirprefix=$(dirname $file)
|
|
|
b444022 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
|
|
b444022 |
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
|
b444022 |
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
|
|
|
b444022 |
|
|
|
b444022 |
while [ "$dirprefix" != "." ]; do
|
|
|
b444022 |
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
|
|
b444022 |
dirprefix=$(dirname $dirprefix)
|
|
|
b444022 |
done
|
|
|
b444022 |
done
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
# testing files for this project
|
|
|
b444022 |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
b444022 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
|
b444022 |
# find all *_test.go files and generate unit-test-devel.file-list
|
|
|
b444022 |
for file in $(find . -iname "*_test.go") ; do
|
|
|
b444022 |
dirprefix=$(dirname $file)
|
|
|
b444022 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
|
|
b444022 |
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
|
b444022 |
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
|
|
|
b444022 |
|
|
|
b444022 |
while [ "$dirprefix" != "." ]; do
|
|
|
b444022 |
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
|
|
b444022 |
dirprefix=$(dirname $dirprefix)
|
|
|
b444022 |
done
|
|
|
b444022 |
done
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_devel}
|
|
|
b444022 |
sort -u -o devel.file-list devel.file-list
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%check
|
|
|
b444022 |
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
b444022 |
%if ! 0%{?with_bundled}
|
|
|
b444022 |
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
|
b444022 |
%else
|
|
|
b444022 |
# No dependency directories so far
|
|
|
b444022 |
|
|
|
b444022 |
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%if ! 0%{?gotest:1}
|
|
|
b444022 |
%global gotest go test
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%gotest %{import_path}
|
|
|
b020b4d |
# CCM tests are integration tests.
|
|
|
b020b4d |
#%gotest %{import_path}/internal/ccm
|
|
|
b020b4d |
%gotest %{import_path}/internal/lru
|
|
|
46c0a9a |
# Murmur tests uses 64-bit constants, breaking 32-bit builds.
|
|
|
46c0a9a |
#%gotest %{import_path}/internal/murmur
|
|
|
b020b4d |
%gotest %{import_path}/internal/streams
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
#define license tag if not already defined
|
|
|
b444022 |
%{!?_licensedir:%global license %doc}
|
|
|
b444022 |
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_devel}
|
|
|
b444022 |
%files devel -f devel.file-list
|
|
|
b444022 |
%license LICENSE
|
|
|
b444022 |
%doc README.md AUTHORS CONTRIBUTING.md
|
|
|
b444022 |
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
b444022 |
%files unit-test-devel -f unit-test-devel.file-list
|
|
|
b444022 |
%license LICENSE
|
|
|
b444022 |
%doc README.md AUTHORS CONTRIBUTING.md
|
|
|
b444022 |
%endif
|
|
|
b444022 |
|
|
|
b444022 |
%changelog
|
|
|
46c0a9a |
* Fri Mar 23 2018 Ed Marshall <esm@logic.net> 0-0.2.20180320git12e3a8c
|
|
|
46c0a9a |
- Disable murmur test to fix 32-bit builds.
|
|
|
46c0a9a |
|
|
|
b020b4d |
* Fri Mar 23 2018 Ed Marshall <esm@logic.net> 0-0.1.20180320git12e3a8c
|
|
|
b020b4d |
- Updated to latest upstream.
|
|
|
b020b4d |
|
|
|
73440c1 |
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2.git1f87449
|
|
|
73440c1 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
|
|
73440c1 |
|
|
|
b444022 |
* Sat Mar 04 2017 Ed Marshall <esm@logic.net> - 0-0.1.git1f87449
|
|
|
b444022 |
- First package for Fedora
|