Blame golang-github-bradfitz-http2.spec

b51956e
%if 0%{?fedora} || 0%{?rhel} == 6
b51956e
%global with_devel 1
b51956e
%global with_bundled 0
b51956e
%global with_debug 0
b51956e
%global with_check 1
b51956e
%global with_unit_test 1
b51956e
%else
b51956e
%global with_devel 0
b51956e
%global with_bundled 0
b51956e
%global with_debug 0
b51956e
%global with_check 0
b51956e
%global with_unit_test 0
b51956e
%endif
b51956e
b51956e
%if 0%{?with_debug}
b51956e
%global _dwz_low_mem_die_limit 0
b51956e
%else
b51956e
%global debug_package   %{nil}
b51956e
%endif
b51956e
b51956e
%global provider        github
b51956e
%global provider_tld    com
b51956e
%global project         bradfitz
b51956e
%global repo            http2
b51956e
# https://github.com/bradfitz/http2
b51956e
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
b51956e
%global import_path     %{provider_prefix}
b51956e
%global commit          f8202bc903bda493ebba4aa54922d78430c2c42f
b51956e
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
b51956e
b51956e
Name:           golang-%{provider}-%{project}-%{repo}
b51956e
Version:        0
54ca1ef
Release:        0.2.git%{shortcommit}%{?dist}
b51956e
Summary:        HTTP/2 support for Go (in active development)
b51956e
License:        BSD
b51956e
URL:            https://%{provider_prefix}
b51956e
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
b51956e
54ca1ef
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
54ca1ef
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
54ca1ef
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
54ca1ef
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
b51956e
b51956e
%description
b51956e
%{summary}
b51956e
b51956e
%if 0%{?with_devel}
b51956e
%package devel
b51956e
Summary:       %{summary}
b51956e
BuildArch:     noarch
b51956e
b51956e
%if 0%{?with_check}
b51956e
%endif
b51956e
b51956e
Provides:      golang(%{import_path}) = %{version}-%{release}
b51956e
Provides:      golang(%{import_path}/hpack) = %{version}-%{release}
b51956e
b51956e
%description devel
b51956e
%{summary}
b51956e
b51956e
This package contains library source intended for
b51956e
building other packages which use import path with
b51956e
%{import_path} prefix.
b51956e
%endif
b51956e
54ca1ef
%if 0%{?with_unit_test} && 0%{?with_devel}
b51956e
%package unit-test
b51956e
Summary:         Unit tests for %{name} package
54ca1ef
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
54ca1ef
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
b51956e
b51956e
%if 0%{?with_check}
b51956e
#Here comes all BuildRequires: PACKAGE the unit tests
b51956e
#in %%check section need for running
b51956e
%endif
b51956e
b51956e
# test subpackage tests code from devel subpackage
b51956e
Requires:        %{name}-devel = %{version}-%{release}
b51956e
b51956e
%description unit-test
b51956e
%{summary}
b51956e
b51956e
This package contains unit tests for project
b51956e
providing packages with %{import_path} prefix.
b51956e
%endif
b51956e
b51956e
%prep
b51956e
%setup -q -n %{repo}-%{commit}
b51956e
b51956e
%build
b51956e
b51956e
%install
b51956e
# source codes for building projects
b51956e
%if 0%{?with_devel}
b51956e
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
54ca1ef
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
b51956e
# find all *.go but no *_test.go files and generate unit-test.file-list
b51956e
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
54ca1ef
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
b51956e
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
e8888e4
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
b51956e
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
b51956e
done
b51956e
%endif
b51956e
b51956e
# testing files for this project
54ca1ef
%if 0%{?with_unit_test} && 0%{?with_devel}
b51956e
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
b51956e
cp -rpav testdata %{buildroot}/%{gopath}/src/%{import_path}/.
b51956e
echo "%%{gopath}/src/%%{import_path}/testdata" >> unit-test.file-list
b51956e
# find all *_test.go files and generate unit-test.file-list
b51956e
for file in $(find . -iname "*_test.go"); do
54ca1ef
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
b51956e
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
e8888e4
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
b51956e
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
b51956e
done
b51956e
%endif
b51956e
54ca1ef
%if 0%{?with_devel}
54ca1ef
sort -u -o devel.file-list devel.file-list
54ca1ef
%endif
54ca1ef
b51956e
%check
b51956e
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
54ca1ef
%if ! 0%{?with_bundled}
54ca1ef
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
b51956e
%else
54ca1ef
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
b51956e
%endif
54ca1ef
54ca1ef
%if ! 0%{?gotest:1}
54ca1ef
%global gotest go test
b51956e
%endif
b51956e
54ca1ef
%gotest %{import_path}
54ca1ef
%gotest %{import_path}/hpack
b51956e
%endif
b51956e
54ca1ef
#define license tag if not already defined
54ca1ef
%{!?_licensedir:%global license %doc}
54ca1ef
b51956e
%if 0%{?with_devel}
b51956e
%files devel -f devel.file-list
54ca1ef
%license LICENSE
b51956e
%doc README AUTHORS CONTRIBUTORS HACKING
b51956e
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
b51956e
%endif
b51956e
54ca1ef
%if 0%{?with_unit_test} && 0%{?with_devel}
b51956e
%files unit-test -f unit-test.file-list
54ca1ef
%license LICENSE
b51956e
%doc README AUTHORS CONTRIBUTORS HACKING
b51956e
%endif
b51956e
b51956e
%changelog
54ca1ef
* Sat Sep 12 2015 jchaloup <jchaloup@redhat.com> - 0-0.2.gitf8202bc
54ca1ef
- Update to spec-2.1
54ca1ef
  related: #1246033
54ca1ef
b51956e
* Tue Jul 28 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.gitf8202bc
b51956e
- First package for Fedora
b51956e
  resolves: #1246033
54ca1ef