a24076d
# If any of the following macros should be set otherwise,
a24076d
# you can wrap any of them with the following conditions:
a24076d
# - %%if 0%%{centos} == 7
a24076d
# - %%if 0%%{?rhel} == 7
a24076d
# - %%if 0%%{?fedora} == 23
a24076d
# Or just test for particular distribution:
a24076d
# - %%if 0%%{centos}
a24076d
# - %%if 0%%{?rhel}
a24076d
# - %%if 0%%{?fedora}
a24076d
#
a24076d
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
a24076d
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
a24076d
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
a24076d
a24076d
# Generate devel rpm
8c174fd
%global with_devel 1
a24076d
# Build project from bundled dependencies
8c174fd
%global with_bundled 0
a24076d
# Build with debug info rpm
8c174fd
%global with_debug 0
a24076d
# Run tests in check section
8c174fd
# cyclic dependency between golang-github-smartystreets-goconvey and
8c174fd
# golang-github-smartystreets-assertions
8c174fd
%global with_check 0
a24076d
# Generate unit-test rpm
8c174fd
%global with_unit_test 1
8c174fd
8c174fd
%if 0%{?with_debug}
8c174fd
%global _dwz_low_mem_die_limit 0
8c174fd
%else
4503014
%global debug_package   %{nil}
8c174fd
%endif
8c174fd
4503014
%global provider        github
4503014
%global provider_tld    com
4503014
%global project         smartystreets
4503014
%global repo            goconvey
4503014
# https://github.com/smartystreets/goconvey
8c174fd
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
8c174fd
%global import_path     %{provider_prefix}
2d95775
%global commit          bf58a9a1291224109919756b4dcc469c670cc7e4
4503014
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
4503014
4503014
Name:           golang-%{provider}-%{project}-%{repo}
2d95775
Version:        1.6.1
a24076d
Release:        0.3.git%{shortcommit}%{?dist}
4503014
Summary:        Behavioral testing in the browser, integrates with go test
4503014
License:        MIT
8c174fd
URL:            https://%{provider_prefix}
8c174fd
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
4503014
2d95775
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
a24076d
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
2d95775
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
2d95775
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
4503014
4503014
%description
4503014
%{summary}
4503014
8c174fd
%if 0%{?with_devel}
4503014
%package devel
4503014
Summary:       %{summary}
8c174fd
BuildArch:     noarch
8c174fd
8c174fd
%if 0%{?with_check}
4503014
# cyclic dependency between golang-github-smartystreets-goconvey and
4503014
# golang-github-smartystreets-assertions
8da77f8
BuildRequires: golang(github.com/jtolds/gls)
8da77f8
BuildRequires: golang(github.com/smartystreets/assertions)
8da77f8
%endif
8da77f8
4503014
Requires:      golang(github.com/jtolds/gls)
4503014
Requires:      golang(github.com/smartystreets/assertions)
a24076d
4503014
Provides:      golang(%{import_path}/convey) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/convey/gotest) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/convey/reporting) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/api) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/contract) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/executor) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/messaging) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/parser) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/system) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/watch) = %{version}-%{release}
4503014
Provides:      golang(%{import_path}/web/server/watch/integration_testing/sub) = %{version}-%{release}
4503014
4503014
%description devel
4503014
%{summary}
4503014
4503014
This package contains library source intended for
8c174fd
building other packages which use import path with
8c174fd
%{import_path} prefix.
8c174fd
%endif
8c174fd
8c174fd
%if 0%{?with_unit_test}
8c174fd
%package unit-test
8c174fd
Summary:         Unit tests for %{name} package
8c174fd
8c174fd
%if 0%{?with_check}
8c174fd
#Here comes all BuildRequires: PACKAGE the unit tests
8c174fd
#in %%check section need for running
8c174fd
%endif
8c174fd
8c174fd
# test subpackage tests code from devel subpackage
8c174fd
Requires:        %{name}-devel = %{version}-%{release}
8c174fd
8c174fd
%description unit-test
8c174fd
%{summary}
8c174fd
8c174fd
This package contains unit tests for project
8c174fd
providing packages with %{import_path} prefix.
8c174fd
%endif
4503014
4503014
%prep
4503014
%setup -q -n %{repo}-%{commit}
4503014
4503014
%build
4503014
4503014
%install
8c174fd
# source codes for building projects
8c174fd
%if 0%{?with_devel}
4503014
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
2d95775
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
8c174fd
# find all *.go but no *_test.go files and generate devel.file-list
8c174fd
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
2d95775
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
8c174fd
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
8c174fd
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
8c174fd
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
4503014
done
8c174fd
%endif
4503014
8c174fd
# testing files for this project
8c174fd
%if 0%{?with_unit_test}
8c174fd
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
8c174fd
# find all *_test.go files and generate unit-test.file-list
8c174fd
for file in $(find . -iname "*_test.go"); do
2d95775
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
8c174fd
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
8c174fd
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
8c174fd
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
8c174fd
done
8c174fd
%endif
4503014
2d95775
%if 0%{?with_devel}
2d95775
sort -u -o devel.file-list devel.file-list
2d95775
%endif
2d95775
8c174fd
%check
8c174fd
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
2d95775
%if ! 0%{?with_bundled}
2d95775
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
4503014
%else
2d95775
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
8c174fd
%endif
2d95775
2d95775
%if ! 0%{?gotest:1}
2d95775
%global gotest go test
4503014
%endif
8c174fd
2d95775
%gotest %{import_path}/convey
2d95775
%gotest %{import_path}/convey/reporting
2d95775
%gotest %{import_path}/web/server/api
2d95775
%gotest %{import_path}/web/server/executor
2d95775
%gotest %{import_path}/web/server/parser
2d95775
%gotest %{import_path}/web/server/system
2d95775
%gotest %{import_path}/web/server/watch
2d95775
%gotest %{import_path}/web/server/watch/integration_testing/sub
8c174fd
%endif
8c174fd
2d95775
#define license tag if not already defined
2d95775
%{!?_licensedir:%global license %doc}
2d95775
8c174fd
%if 0%{?with_devel}
8c174fd
%files devel -f devel.file-list
2d95775
%license LICENSE.md
8c174fd
%doc README.md CONTRIBUTING.md
4503014
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
8c174fd
%endif
8c174fd
8c174fd
%if 0%{?with_unit_test}
8c174fd
%files unit-test -f unit-test.file-list
2d95775
%license LICENSE.md
8c174fd
%doc README.md CONTRIBUTING.md
8c174fd
%endif
4503014
4503014
%changelog
a24076d
* Thu Jan 12 2017 Jan Chaloupka <jchaloup@redhat.com> - 1.6.1-0.3.gitbf58a9a
a24076d
- Polish the spec file
a24076d
  related: #1250511
a24076d
3c60302
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.1-0.2.gitbf58a9a
3c60302
- https://fedoraproject.org/wiki/Changes/golang1.7
3c60302
2d95775
* Thu Apr 14 2016 jchaloup <jchaloup@redhat.com> - 1.6.1-0.1.gitbf58a9a
2d95775
- Bump to upstream bf58a9a1291224109919756b4dcc469c670cc7e4
2d95775
  Polish the spec file
2d95775
  related: #1250511
2d95775
6d89bc1
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.5.git43652d6
6d89bc1
- https://fedoraproject.org/wiki/Changes/golang1.6
6d89bc1
ca5f6f0
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.4.git43652d6
ca5f6f0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
ca5f6f0
8da77f8
* Mon Aug 17 2015 jchaloup <jchaloup@redhat.com> - 0-0.3.git43652d6
8da77f8
- Add missing BRs
8da77f8
  related: #1250511
8da77f8
8c174fd
* Mon Aug 10 2015 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.2.git43652d6
8c174fd
- Update spec file to spec-2.0
8c174fd
  resolves: #1250511
8c174fd
4503014
* Thu Apr 16 2015 jchaloup <jchaloup@redhat.com> - 0-0.1.git43652d6
4503014
- First package for Fedora
4503014
  resolves: #1214862
8c174fd