0584b09
%if 0%{?fedora} || 0%{?rhel} == 6
0584b09
%global with_devel 1
0584b09
%global with_bundled 0
0584b09
%global with_debug 0
0584b09
%global with_check 1
0584b09
%global with_unit_test 1
0584b09
%else
0584b09
%global with_devel 0
0584b09
%global with_bundled 0
0584b09
%global with_debug 0
0584b09
%global with_check 0
0584b09
%global with_unit_test 0
0584b09
%endif
0584b09
0584b09
%if 0%{?with_debug}
0584b09
%global _dwz_low_mem_die_limit 0
0584b09
%else
48862f6
%global debug_package   %{nil}
0584b09
%endif
0584b09
6f02faf
%global provider        github
6f02faf
%global provider_tld    com
6f02faf
%global project         gorilla
6f02faf
%global repo            mux
6f02faf
# https://github.com/gorilla/mux
0584b09
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
0584b09
%global import_path     %{provider_prefix}
6f02faf
%global commit          8096f47503459bcc74d1f4c487b7e6e42e5746b5
41a3b1e
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
41a3b1e
6f02faf
Name:           golang-%{provider}-%{project}-%{repo}
41a3b1e
Version:        0
bb2fc58
Release:        0.19.git%{shortcommit}%{?dist}
41a3b1e
Summary:        A powerful URL router and dispatcher for golang
41a3b1e
License:        BSD
0584b09
URL:            https://%{provider_prefix}
0584b09
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
0584b09
bb2fc58
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
bb2fc58
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
bb2fc58
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
bb2fc58
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
41a3b1e
41a3b1e
%description
41a3b1e
Package gorilla/mux implements a request router and dispatcher.
41a3b1e
41a3b1e
The name mux stands for "HTTP request multiplexer". Like the standard
41a3b1e
http.ServeMux, mux.Router matches incoming requests against a list of
41a3b1e
registered routes and calls a handler for the route that matches the URL or
41a3b1e
other conditions.
41a3b1e
0584b09
%if 0%{?with_devel}
41a3b1e
%package devel
0584b09
Summary:       %{summary}
0584b09
BuildArch:     noarch
0584b09
0584b09
%if 0%{?with_check}
0584b09
BuildRequires: golang(github.com/gorilla/context)
0584b09
%endif
0584b09
0584b09
Requires:      golang(github.com/gorilla/context)
0584b09
0584b09
Provides:      golang(%{import_path}) = %{version}-%{release}
41a3b1e
41a3b1e
%description devel
922e0c7
Package gorilla/mux implements a request router and dispatcher.
922e0c7
922e0c7
The name mux stands for "HTTP request multiplexer". Like the standard
922e0c7
http.ServeMux, mux.Router matches incoming requests against a list of
922e0c7
registered routes and calls a handler for the route that matches the URL or
922e0c7
other conditions.
922e0c7
0584b09
This package contains library source intended for
0584b09
building other packages which use import path with
0584b09
%{import_path} prefix.
0584b09
%endif
0584b09
bb2fc58
%if 0%{?with_unit_test} && 0%{?with_devel}
0584b09
%package unit-test
0584b09
Summary:         Unit tests for %{name} package
bb2fc58
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
bb2fc58
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
0584b09
0584b09
%if 0%{?with_check}
0584b09
#Here comes all BuildRequires: PACKAGE the unit tests
0584b09
#in %%check section need for running
0584b09
%endif
0584b09
0584b09
# test subpackage tests code from devel subpackage
0584b09
Requires:        %{name}-devel = %{version}-%{release}
0584b09
0584b09
%description unit-test
0584b09
%{summary}
0584b09
0584b09
This package contains unit tests for project
0584b09
providing packages with %{import_path} prefix.
0584b09
%endif
922e0c7
41a3b1e
%prep
6f02faf
%setup -q -n %{repo}-%{commit}
41a3b1e
41a3b1e
%build
41a3b1e
41a3b1e
%install
0584b09
# source codes for building projects
0584b09
%if 0%{?with_devel}
0584b09
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
bb2fc58
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
0584b09
# find all *.go but no *_test.go files and generate devel.file-list
0584b09
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
bb2fc58
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
0584b09
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
0584b09
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
0584b09
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
0584b09
done
0584b09
%endif
0584b09
0584b09
# testing files for this project
bb2fc58
%if 0%{?with_unit_test} && 0%{?with_devel}
0584b09
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
0584b09
# find all *_test.go files and generate unit-test.file-list
0584b09
for file in $(find . -iname "*_test.go"); do
bb2fc58
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
0584b09
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
0584b09
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
0584b09
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
0584b09
done
0584b09
%endif
922e0c7
bb2fc58
%if 0%{?with_devel}
bb2fc58
sort -u -o devel.file-list devel.file-list
bb2fc58
%endif
bb2fc58
80f8226
%check
0584b09
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
bb2fc58
%if ! 0%{?with_bundled}
bb2fc58
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
0584b09
%else
bb2fc58
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
0584b09
%endif
bb2fc58
bb2fc58
%if ! 0%{?gotest:1}
bb2fc58
%global gotest go test
0584b09
%endif
0584b09
bb2fc58
%gotest %{import_path}
0584b09
%endif
41a3b1e
bb2fc58
#define license tag if not already defined
bb2fc58
%{!?_licensedir:%global license %doc}
bb2fc58
0584b09
%if 0%{?with_devel}
0584b09
%files devel -f devel.file-list
bb2fc58
%license LICENSE
0584b09
%doc README.md
6f02faf
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
0584b09
%endif
0584b09
bb2fc58
%if 0%{?with_unit_test} && 0%{?with_devel}
0584b09
%files unit-test -f unit-test.file-list
bb2fc58
%license LICENSE
0584b09
%doc README.md
0584b09
%endif
41a3b1e
41a3b1e
%changelog
bb2fc58
* Sat Sep 12 2015 jchaloup <jchaloup@redhat.com> - 0-0.19.git8096f47
bb2fc58
- Update to spec-2.1
bb2fc58
  related: #1249384
bb2fc58
0584b09
* Sun Aug 02 2015 jchaloup <jchaloup@redhat.com> - 0-0.18.git8096f47
0584b09
- Update spec file to spec-2.0
0584b09
  resolves: #1249384
0584b09
9ab77a2
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.17.git8096f47
9ab77a2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
9ab77a2
6f02faf
* Tue Apr 21 2015 jchaloup <jchaloup@redhat.com> - 0-0.16.git8096f47
6f02faf
- Bump to upstream 8096f47503459bcc74d1f4c487b7e6e42e5746b5
6f02faf
  related: #1001317
6f02faf
4a54ba0
* Thu Jul 31 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0-0.15.git
4a54ba0
- do not own dirs owned by golang
4a54ba0
- archfulness and defattr for el6 handled separately
4a54ba0
f7b5ecc
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.14.git136d54f
f7b5ecc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
f7b5ecc
b055a9c
* Sat May 31 2014 Lokesh Mandvekar <lsm5@redhat.com> 0-0.13.git
b055a9c
- update to commit 136d54f81f (required for docker 1.0
b055a9c
https://github.com/dotcloud/docker/issues/5908 )
b055a9c
80f8226
* Fri Jan 17 2014 Lokesh Mandvekar <lsm5@redhat.com> 0-0.12.gite718e93
80f8226
- exclusivearch for el6+
80f8226
- add check
80f8226
a8889de
* Fri Jan 17 2014 Lokesh Mandvekar <lsm5@redhat.com> 0-0.11.gite718e93
a8889de
- revert golang >= 1.2 version requirement
a8889de
f552aa6
* Wed Jan 15 2014 Lokesh Mandvekar <lsm5@redhat.com> 0-0.10.gite718e93
f552aa6
- require golang 1.2 and later
f552aa6
30e68ca
* Wed Oct 16 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.9.gite718e93
30e68ca
- double quotes removed from provides and br
30e68ca
bdd5546
* Tue Oct 08 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.8.gite718e93
bdd5546
- noarch for f19+ and rhel7+, exclusivearch otherwise
bdd5546
48862f6
* Mon Oct 07 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.7.gite718e93
48862f6
- exclusivearch as per golang package
48862f6
- debug_package nil
48862f6
922e0c7
* Sun Sep 22 2013 Matthew Miller <mattdm@fedoraproject.org> 0-0.6.gite718e93
922e0c7
- install just the source code for devel package
922e0c7
41a3b1e
* Tue Sep 17 2013 Lokesh Mandvekar <lsm5@redhat.com> 0-0.5.gite718e93
41a3b1e
- Version format changed
41a3b1e
- docdir changed
41a3b1e
- debuginfo no longer generated
41a3b1e
- package owns all directories in import_path
41a3b1e
41a3b1e
* Mon Sep 16 2013 Lokesh Mandvekar <lsm5@redhat.com> gite718e93-4
41a3b1e
- only devel package generated
41a3b1e
- Provides moved to devel package
41a3b1e
41a3b1e
* Tue Sep 10 2013 Lokesh Mandvekar <lsm5@redhat.com> gite718e93-3
41a3b1e
- Depends on golang("github.com/gorilla/context"), not golang directly
41a3b1e
- Pkg archives handled (thanks to Vincent Batts (vbatts@redhat.com)
41a3b1e
- Devel package generated
41a3b1e
41a3b1e
* Wed Aug 28 2013 Lokesh Mandvekar <lsm5@redhat.com> 0.0.1-2
41a3b1e
- Fixed permissions
41a3b1e
41a3b1e
* Mon Aug 26 2013 Lokesh Mandvekar <lsm5@redhat.com> 0.0.1-1
41a3b1e
- Initial fedora package
bb2fc58