1f2732d
%if 0%{?fedora} || 0%{?rhel} == 6
1f2732d
%global with_devel 1
1f2732d
%global with_bundled 0
1f2732d
%global with_debug 0
1f2732d
%global with_check 1
1f2732d
%global with_unit_test 1
1f2732d
%else
1f2732d
%global with_devel 0
1f2732d
%global with_bundled 0
1f2732d
%global with_debug 0
1f2732d
%global with_check 0
1f2732d
%global with_unit_test 0
1f2732d
%endif
1f2732d
1f2732d
%if 0%{?with_debug}
1f2732d
%global _dwz_low_mem_die_limit 0
1f2732d
%else
997d26f
%global debug_package   %{nil}
1f2732d
%endif
1f2732d
997d26f
%global provider        github
997d26f
%global provider_tld    com
997d26f
%global project         tent
997d26f
%global repo            http-link-go
997d26f
# https://github.com/tent/http-link-go
1f2732d
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
1f2732d
%global import_path     %{provider_prefix}
997d26f
%global commit          ac974c61c2f990f4115b119354b5e0b47550e888
997d26f
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
997d26f
997d26f
Name:           golang-%{provider}-%{project}-%{repo}
997d26f
Version:        0
d637d49
Release:        0.11.git%{shortcommit}%{?dist}
997d26f
Summary:        HTTP Link parsing in Go
997d26f
License:        BSD
1f2732d
URL:            https://%{provider_prefix}
1f2732d
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
997d26f
1f2732d
# If go_arches not defined fall through to implicit golang archs
1f2732d
%if 0%{?go_arches:1}
1f2732d
ExclusiveArch:  %{go_arches}
1f2732d
%else
1f2732d
ExclusiveArch:   %{ix86} x86_64 %{arm}
1f2732d
%endif
1f2732d
# If gccgo_arches does not fit or is not defined fall through to golang
1f2732d
%ifarch 0%{?gccgo_arches}
1f2732d
BuildRequires:   gcc-go >= %{gccgo_min_vers}
997d26f
%else
1f2732d
BuildRequires:   golang
997d26f
%endif
997d26f
997d26f
%description
997d26f
%{summary}
997d26f
1f2732d
%if 0%{?with_devel}
997d26f
%package devel
997d26f
Summary:       %{summary}
1f2732d
BuildArch:     noarch
1f2732d
1f2732d
%if 0%{?with_check}
997d26f
BuildRequires: golang(launchpad.net/gocheck)
1f2732d
%endif
1f2732d
997d26f
Requires:      golang(launchpad.net/gocheck)
1f2732d
997d26f
Provides:      golang(%{import_path}) = %{version}-%{release}
997d26f
997d26f
%description devel
997d26f
%{summary}
997d26f
997d26f
This package contains library source intended for
1f2732d
building other packages which use import path with
1f2732d
%{import_path} prefix.
1f2732d
%endif
1f2732d
1f2732d
%if 0%{?with_unit_test}
1f2732d
%package unit-test
1f2732d
Summary:         Unit tests for %{name} package
1f2732d
# If go_arches not defined fall through to implicit golang archs
1f2732d
%if 0%{?go_arches:1}
1f2732d
ExclusiveArch:  %{go_arches}
1f2732d
%else
1f2732d
ExclusiveArch:   %{ix86} x86_64 %{arm}
1f2732d
%endif
1f2732d
# If gccgo_arches does not fit or is not defined fall through to golang
1f2732d
%ifarch 0%{?gccgo_arches}
1f2732d
BuildRequires:   gcc-go >= %{gccgo_min_vers}
1f2732d
%else
1f2732d
BuildRequires:   golang
1f2732d
%endif
1f2732d
1f2732d
%if 0%{?with_check}
1f2732d
#Here comes all BuildRequires: PACKAGE the unit tests
1f2732d
#in %%check section need for running
1f2732d
%endif
1f2732d
1f2732d
# test subpackage tests code from devel subpackage
1f2732d
Requires:        %{name}-devel = %{version}-%{release}
1f2732d
1f2732d
%description unit-test
1f2732d
%{summary}
1f2732d
1f2732d
This package contains unit tests for project
1f2732d
providing packages with %{import_path} prefix.
1f2732d
%endif
997d26f
997d26f
%prep
997d26f
%setup -q -n %{repo}-%{commit}
997d26f
997d26f
%build
997d26f
997d26f
%install
1f2732d
# source codes for building projects
1f2732d
%if 0%{?with_devel}
997d26f
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
1f2732d
# find all *.go but no *_test.go files and generate devel.file-list
1f2732d
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
1f2732d
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
1f2732d
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
1f2732d
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
1f2732d
done
1f2732d
%endif
997d26f
1f2732d
# testing files for this project
1f2732d
%if 0%{?with_unit_test}
1f2732d
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
1f2732d
# find all *_test.go files and generate unit-test.file-list
1f2732d
for file in $(find . -iname "*_test.go"); do
1f2732d
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
1f2732d
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
1f2732d
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
997d26f
done
1f2732d
%endif
997d26f
997d26f
%check
1f2732d
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
1f2732d
%ifarch 0%{?gccgo_arches}
1f2732d
function gotest { %{gcc_go_test} "$@"; }
1f2732d
%else
1f2732d
%if 0%{?golang_test:1}
1f2732d
function gotest { %{golang_test} "$@"; }
997d26f
%else
1f2732d
function gotest { go test "$@"; }
997d26f
%endif
1f2732d
%endif
1f2732d
1f2732d
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
1f2732d
gotest %{import_path}
1f2732d
%endif
1f2732d
1f2732d
%if 0%{?with_devel}
1f2732d
%files devel -f devel.file-list
c64c026
%{!?_licensedir:%global license %%doc}
c64c026
%license LICENSE
1f2732d
%doc README.md
997d26f
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
1f2732d
%dir %{gopath}/src/%{import_path}
1f2732d
%endif
1f2732d
1f2732d
%if 0%{?with_unit_test}
1f2732d
%files unit-test -f unit-test.file-list
c64c026
%{!?_licensedir:%global license %%doc}
c64c026
%license LICENSE
1f2732d
%doc README.md
1f2732d
%endif
997d26f
997d26f
%changelog
d637d49
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.11.gitac974c6
d637d49
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
d637d49
fb7a99f
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.10.gitac974c6
fb7a99f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
fb7a99f
eedffe6
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.9.gitac974c6
eedffe6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
eedffe6
c9e090c
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.8.gitac974c6
c9e090c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c9e090c
cf32bfd
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.7.gitac974c6
cf32bfd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
cf32bfd
39c71df
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.gitac974c6
39c71df
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
39c71df
d3e9069
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.5.gitac974c6
d3e9069
- https://fedoraproject.org/wiki/Changes/golang1.7
d3e9069
8683363
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.4.gitac974c6
8683363
- https://fedoraproject.org/wiki/Changes/golang1.6
8683363
b6854da
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.3.gitac974c6
b6854da
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
b6854da
1f2732d
* Tue Aug 11 2015 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.2.gitac974c6
1f2732d
- Update spec file to spec-2.0
1f2732d
  resolves: #1250515
1f2732d
997d26f
* Thu Apr 16 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.gitac974c6
997d26f
- First package for Fedora
997d26f
  resolves: #1214934
1f2732d