Blame golang-github-hashicorp-memberlist.spec

Fridolin Pokorny a0937f0
%if 0%{?fedora} || 0%{?rhel} == 6
Fridolin Pokorny a0937f0
%global with_devel 1
Fridolin Pokorny a0937f0
%global with_bundled 0
Fridolin Pokorny a0937f0
%global with_debug 0
Fridolin Pokorny 5dbebaf
# Test fails `constant 2147483648 overflows int' - a golang bug
Fridolin Pokorny 5dbebaf
%global with_check 0
Fridolin Pokorny a0937f0
%global with_unit_test 1
Fridolin Pokorny a0937f0
%else
Fridolin Pokorny a0937f0
%global with_devel 0
Fridolin Pokorny a0937f0
%global with_bundled 0
Fridolin Pokorny a0937f0
%global with_debug 0
Fridolin Pokorny a0937f0
%global with_check 0
Fridolin Pokorny a0937f0
%global with_unit_test 0
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
%if 0%{?with_debug}
Fridolin Pokorny a0937f0
%global _dwz_low_mem_die_limit 0
Fridolin Pokorny a0937f0
%else
1c5aa2e
%global debug_package   %{nil}
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
1c5aa2e
%global provider        github
1c5aa2e
%global provider_tld    com
1c5aa2e
%global project         hashicorp
1c5aa2e
%global repo            memberlist
1c5aa2e
# https://github.com/hashicorp/memberlist
Fridolin Pokorny a0937f0
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
Fridolin Pokorny a0937f0
%global import_path     %{provider_prefix}
Fridolin Pokorny 0cf5f0c
%global commit          28424fb38c7c3e30f366b72b1a55f690d318d8f3
1c5aa2e
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
1c5aa2e
1c5aa2e
Name:           golang-%{provider}-%{project}-%{repo}
1c5aa2e
Version:        0
b984d26
Release:        0.6.git%{shortcommit}%{?dist}
1c5aa2e
Summary:        Golang package for gossip based membership and failure detection
1c5aa2e
License:        MPLv2.0
Fridolin Pokorny a0937f0
URL:            https://%{provider_prefix}
Fridolin Pokorny a0937f0
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
1c5aa2e
4d099ee
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
4d099ee
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
4d099ee
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
4d099ee
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
1c5aa2e
1c5aa2e
%description
1c5aa2e
%{summary}
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
%if 0%{?with_devel}
1c5aa2e
%package devel
1c5aa2e
Summary:       %{summary}
Fridolin Pokorny a0937f0
BuildArch:     noarch
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
%if 0%{?with_check}
1c5aa2e
BuildRequires: golang(github.com/armon/go-metrics)
1c5aa2e
BuildRequires: golang(github.com/hashicorp/go-msgpack/codec)
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
1c5aa2e
Requires:      golang(github.com/armon/go-metrics)
1c5aa2e
Requires:      golang(github.com/hashicorp/go-msgpack/codec)
Fridolin Pokorny a0937f0
1c5aa2e
Provides:      golang(%{import_path}) = %{version}-%{release}
1c5aa2e
1c5aa2e
%description devel
1c5aa2e
%{summary}
1c5aa2e
1c5aa2e
This package contains library source intended for
Fridolin Pokorny a0937f0
building other packages which use import path with
Fridolin Pokorny a0937f0
%{import_path} prefix.
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
4d099ee
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny a0937f0
%package unit-test
Fridolin Pokorny a0937f0
Summary:         Unit tests for %{name} package
4d099ee
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
4d099ee
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
%if 0%{?with_check}
Fridolin Pokorny a0937f0
#Here comes all BuildRequires: PACKAGE the unit tests
Fridolin Pokorny a0937f0
#in %%check section need for running
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
# test subpackage tests code from devel subpackage
Fridolin Pokorny a0937f0
Requires:        %{name}-devel = %{version}-%{release}
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
%description unit-test
Fridolin Pokorny a0937f0
%{summary}
Fridolin Pokorny a0937f0
Fridolin Pokorny a0937f0
This package contains unit tests for project
Fridolin Pokorny a0937f0
providing packages with %{import_path} prefix.
Fridolin Pokorny a0937f0
%endif
1c5aa2e
1c5aa2e
%prep
1c5aa2e
%setup -q -n %{repo}-%{commit}
1c5aa2e
1c5aa2e
%build
1c5aa2e
1c5aa2e
%install
Fridolin Pokorny a0937f0
# source codes for building projects
Fridolin Pokorny a0937f0
%if 0%{?with_devel}
1c5aa2e
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
4d099ee
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
Fridolin Pokorny a0937f0
# find all *.go but no *_test.go files and generate devel.file-list
Fridolin Pokorny a0937f0
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
4d099ee
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
Fridolin Pokorny a0937f0
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Fridolin Pokorny a0937f0
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Fridolin Pokorny a0937f0
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
Fridolin Pokorny a0937f0
done
Fridolin Pokorny a0937f0
%endif
1c5aa2e
Fridolin Pokorny a0937f0
# testing files for this project
4d099ee
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny a0937f0
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
Fridolin Pokorny a0937f0
# find all *_test.go files and generate unit-test.file-list
Fridolin Pokorny a0937f0
for file in $(find . -iname "*_test.go"); do
4d099ee
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
Fridolin Pokorny a0937f0
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Fridolin Pokorny a0937f0
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Fridolin Pokorny a0937f0
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
1c5aa2e
done
Fridolin Pokorny a0937f0
%endif
1c5aa2e
4d099ee
%if 0%{?with_devel}
4d099ee
sort -u -o devel.file-list devel.file-list
4d099ee
%endif
4d099ee
1c5aa2e
%check
Fridolin Pokorny a0937f0
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
4d099ee
%if ! 0%{?with_bundled}
4d099ee
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
1c5aa2e
%else
4d099ee
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
1c5aa2e
%endif
4d099ee
4d099ee
%if ! 0%{?gotest:1}
4d099ee
%global gotest go test
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
4d099ee
%gotest %{import_path}
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
4d099ee
#define license tag if not already defined
4d099ee
%{!?_licensedir:%global license %doc}
4d099ee
Fridolin Pokorny a0937f0
%if 0%{?with_devel}
Fridolin Pokorny a0937f0
%files devel -f devel.file-list
4d099ee
%license LICENSE
Fridolin Pokorny a0937f0
%doc README.md todo.md
1c5aa2e
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
Fridolin Pokorny a0937f0
%endif
Fridolin Pokorny a0937f0
4d099ee
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny a0937f0
%files unit-test -f unit-test.file-list
4d099ee
%license LICENSE
Fridolin Pokorny a0937f0
%doc README.md todo.md
Fridolin Pokorny a0937f0
%endif
1c5aa2e
1c5aa2e
%changelog
b984d26
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.6.git28424fb
b984d26
- https://fedoraproject.org/wiki/Changes/golang1.6
b984d26
4af2371
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.5.git28424fb
4af2371
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
4af2371
Fridolin Pokorny 0cf5f0c
* Wed Jan 06 2016 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.4.git28424fb
Fridolin Pokorny 0cf5f0c
- Bump to upstream 28424fb38c7c3e30f366b72b1a55f690d318d8f3
Fridolin Pokorny 0cf5f0c
  related: #1250471
Fridolin Pokorny 0cf5f0c
4d099ee
* Sat Sep 12 2015 jchaloup <jchaloup@redhat.com> - 0-0.3.gitdad1009
4d099ee
- Update to spec-2.1
4d099ee
  related: #1250471
4d099ee
Fridolin Pokorny a0937f0
* Wed Aug 05 2015 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.1.gitdad1009
Fridolin Pokorny a0937f0
- Update spec file to spec-2.0
Fridolin Pokorny 5dbebaf
- Disable failing test - a golang bug
Fridolin Pokorny a0937f0
  resolves: #1250471
Fridolin Pokorny a0937f0
1c5aa2e
* Wed Apr 15 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.gitdad1009
1c5aa2e
- First package for Fedora
1c5aa2e
  resolves: #1212065
Fridolin Pokorny a0937f0
4d099ee