Blame golang-gopkg-retry-v1.spec

Simon Fels 9ca6cf2
# If any of the following macros should be set otherwise,
Simon Fels 9ca6cf2
# you can wrap any of them with the following conditions:
Simon Fels 9ca6cf2
# - %%if 0%%{centos} == 7
Simon Fels 9ca6cf2
# - %%if 0%%{?rhel} == 7
Simon Fels 9ca6cf2
# - %%if 0%%{?fedora} == 23
Simon Fels 9ca6cf2
# Or just test for particular distribution:
Simon Fels 9ca6cf2
# - %%if 0%%{centos}
Simon Fels 9ca6cf2
# - %%if 0%%{?rhel}
Simon Fels 9ca6cf2
# - %%if 0%%{?fedora}
Simon Fels 9ca6cf2
#
Simon Fels 9ca6cf2
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
Simon Fels 9ca6cf2
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
Simon Fels 9ca6cf2
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
# Generate devel rpm
Simon Fels 9ca6cf2
%global with_devel 1
Simon Fels 9ca6cf2
# Build project from bundled dependencies
Simon Fels 9ca6cf2
%global with_bundled 0
Simon Fels 9ca6cf2
# Build with debug info rpm
Simon Fels 9ca6cf2
%global with_debug 0
Simon Fels 9ca6cf2
# Run tests in check section
Simon Fels 9ca6cf2
%global with_check 0
Simon Fels 9ca6cf2
# Generate unit-test rpm
Simon Fels 9ca6cf2
%global with_unit_test 0
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if 0%{?with_debug}
Simon Fels 9ca6cf2
%global _dwz_low_mem_die_limit 0
Simon Fels 9ca6cf2
%else
Simon Fels 9ca6cf2
%global debug_package   %{nil}
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%global provider        github
Simon Fels 9ca6cf2
%global provider_tld    com
Simon Fels 9ca6cf2
%global project         go-retry
Simon Fels 9ca6cf2
%global repo            retry
Simon Fels 9ca6cf2
# https://github.com/go-retry/retry
Simon Fels 9ca6cf2
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
Simon Fels 9ca6cf2
%global import_path     gopkg.in/retry.v1
Simon Fels 9ca6cf2
%global commit          c09f6b86ba4d5d2cf5bdf0665364aec9fd4815db
Simon Fels 9ca6cf2
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
Simon Fels 9ca6cf2
%global gimport_path    github.com/go-retry/retry
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
Name:           golang-gopkg-%{repo}
Simon Fels 9ca6cf2
Version:        1
Simon Fels 9ca6cf2
Release:        0.1.git%{shortcommit}%{?dist}
Simon Fels 9ca6cf2
Summary:        Provides a framework for retrying actions
Simon Fels 9ca6cf2
License:        BSD
Simon Fels 9ca6cf2
URL:            https://%{provider_prefix}
Simon Fels 9ca6cf2
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
Simon Fels 9ca6cf2
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
Simon Fels 9ca6cf2
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
Simon Fels 9ca6cf2
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%description
Simon Fels 9ca6cf2
%{summary}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if 0%{?with_devel}
Simon Fels 9ca6cf2
%package devel
Simon Fels 9ca6cf2
Summary:       %{summary}
Simon Fels 9ca6cf2
BuildArch:     noarch
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
Provides:      golang(%{import_path}) = %{version}-%{release}
Simon Fels 9ca6cf2
Provides:      golang(%{import_path_sec}) = %{version}-%{release}
Simon Fels 9ca6cf2
Provides:      golang(%{mimport_path}) = %{version}-%{release}
Simon Fels 9ca6cf2
Provides:      golang(%{gimport_path}) = %{version}-%{release}
Simon Fels 9ca6cf2
Obsoletes:     golang-launchpad-gocheck-devel
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%description devel
Simon Fels 9ca6cf2
%{summary}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
This package contains library source intended for
Simon Fels 9ca6cf2
building other packages which use import path with
Simon Fels 9ca6cf2
%{import_path} prefix.
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if 0%{?with_unit_test}
Simon Fels 9ca6cf2
%package unit-test
Simon Fels 9ca6cf2
Summary:         Unit tests for %{name} package
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if 0%{?with_check}
Simon Fels 9ca6cf2
#Here comes all BuildRequires: PACKAGE the unit tests
Simon Fels 9ca6cf2
#in %%check section need for running
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
# test subpackage tests code from devel subpackage
Simon Fels 9ca6cf2
Requires:        %{name}-devel = %{version}-%{release}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%description unit-test
Simon Fels 9ca6cf2
%{summary}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
This package contains unit tests for project
Simon Fels 9ca6cf2
providing packages with %{import_path} prefix.
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%prep
Simon Fels 9ca6cf2
%setup -q -n %{repo}-%{commit}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%build
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%install
Simon Fels 9ca6cf2
# source codes for building projects
Simon Fels 9ca6cf2
%if 0%{?with_devel}
Simon Fels 9ca6cf2
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
Simon Fels 9ca6cf2
install -d -p %{buildroot}/%{gopath}/src/%{import_path_sec}/
Simon Fels 9ca6cf2
install -d -p %{buildroot}/%{gopath}/src/%{gimport_path}/
Simon Fels 9ca6cf2
# find all *.go but no *_test.go files and generate devel.file-list
Simon Fels 9ca6cf2
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
Simon Fels 9ca6cf2
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Simon Fels 9ca6cf2
    cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Simon Fels 9ca6cf2
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
    install -d -p %{buildroot}/%{gopath}/src/%{import_path_sec}/$(dirname $file)
Simon Fels 9ca6cf2
    cp $file %{buildroot}/%{gopath}/src/%{import_path_sec}/$file
Simon Fels 9ca6cf2
    echo "%%{gopath}/src/%%{import_path_sec}/$file" >> devel.file-list
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
    install -d -p %{buildroot}/%{gopath}/src/%{gimport_path}/$(dirname $file)
Simon Fels 9ca6cf2
    cp $file %{buildroot}/%{gopath}/src/%{gimport_path}/$file
Simon Fels 9ca6cf2
    echo "%%{gopath}/src/%%{gimport_path}/$file" >> devel.file-list
Simon Fels 9ca6cf2
done
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
# testing files for this project
Simon Fels 9ca6cf2
%if 0%{?with_unit_test}
Simon Fels 9ca6cf2
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
Simon Fels 9ca6cf2
# find all *_test.go files and generate unit-test.file-list
Simon Fels 9ca6cf2
for file in $(find . -iname "*_test.go"); do
Simon Fels 9ca6cf2
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Simon Fels 9ca6cf2
    cp $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Simon Fels 9ca6cf2
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
Simon Fels 9ca6cf2
done
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%check
Simon Fels 9ca6cf2
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
Simon Fels 9ca6cf2
%if ! 0%{?with_bundled}
Simon Fels 9ca6cf2
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
Simon Fels 9ca6cf2
%else
Simon Fels 9ca6cf2
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if ! 0%{?gotest:1}
Simon Fels 9ca6cf2
%global gotest go test
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%gotest %{import_path}
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
#define license tag if not already defined
Simon Fels 9ca6cf2
%{!?_licensedir:%global license %doc}
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if 0%{?with_devel}
Simon Fels 9ca6cf2
%files devel -f devel.file-list
Simon Fels 9ca6cf2
%license LICENSE
Simon Fels 9ca6cf2
%doc README.md
Simon Fels 9ca6cf2
%dir %{gopath}/src/%{import_path}
Simon Fels 9ca6cf2
%dir %{gopath}/src/%{import_path_sec}
Simon Fels 9ca6cf2
%dir %{gopath}/src/%{gimport_path}
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%if 0%{?with_unit_test}
Simon Fels 9ca6cf2
%files unit-test -f unit-test.file-list
Simon Fels 9ca6cf2
%license LICENSE
Simon Fels 9ca6cf2
%doc README.md
Simon Fels 9ca6cf2
%endif
Simon Fels 9ca6cf2
Simon Fels 9ca6cf2
%changelog
Simon Fels 9ca6cf2
* Wed Mar 22 2017 Simon Fels <morphis@gravedo.de> - 0-0.1.gitb6dae1d
Simon Fels 9ca6cf2
- First package for Fedora
Simon Fels 9ca6cf2