Fridolin Pokorny 5a93054
%if 0%{?fedora} || 0%{?rhel} == 6
Fridolin Pokorny 5a93054
%global with_devel 1
Fridolin Pokorny 5a93054
%global with_bundled 0
Fridolin Pokorny 5a93054
%global with_debug 0
Fridolin Pokorny 5a93054
%global with_check 1
Fridolin Pokorny 5a93054
%global with_unit_test 1
Fridolin Pokorny 5a93054
%else
Fridolin Pokorny 5a93054
%global with_devel 0
Fridolin Pokorny 5a93054
%global with_bundled 0
Fridolin Pokorny 5a93054
%global with_debug 0
Fridolin Pokorny 5a93054
%global with_check 0
Fridolin Pokorny 5a93054
%global with_unit_test 0
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
%if 0%{?with_debug}
Fridolin Pokorny 5a93054
%global _dwz_low_mem_die_limit 0
Fridolin Pokorny 5a93054
%else
b784ce2
%global debug_package   %{nil}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
b784ce2
%global provider        github
b784ce2
%global provider_tld    com
b784ce2
%global project         abbot
b784ce2
%global repo            go-http-auth
Fridolin Pokorny 5a93054
# https://github.com/abbot/go-http-auth
Fridolin Pokorny 5a93054
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
Fridolin Pokorny 5a93054
%global import_path     %{provider_prefix}
b784ce2
%global commit          c0ef4539dfab4d21c8ef20ba2924f9fc6f186d35
b784ce2
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
b784ce2
b784ce2
Name:           golang-%{provider}-%{project}-%{repo}
b784ce2
Version:        0
cb446c3
Release:        0.7.git%{shortcommit}%{?dist}
b784ce2
Summary:        Basic and Digest HTTP Authentication for golang http
b784ce2
License:        ASL 2.0
Fridolin Pokorny 5a93054
URL:            https://%{provider_prefix}
Fridolin Pokorny 5a93054
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Fridolin Pokorny 5a93054
bef75e1
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
bef75e1
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
bef75e1
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
bef75e1
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
b784ce2
b784ce2
%description
b784ce2
This is an implementation of HTTP Basic
b784ce2
and HTTP Digest authentication in Go language.
b784ce2
It is designed as a simple wrapper for http.RequestHandler functions.
b784ce2
Fridolin Pokorny 5a93054
%if 0%{?with_devel}
b784ce2
%package devel
Fridolin Pokorny 5a93054
Summary:       %{summary}
Fridolin Pokorny 5a93054
BuildArch:     noarch
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
%if 0%{?with_check}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
Provides:      golang(%{import_path}) = %{version}-%{release}
b784ce2
b784ce2
%description devel
Fridolin Pokorny 5a93054
%{summary}
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
This package contains library source intended for
Fridolin Pokorny 5a93054
building other packages which use import path with
Fridolin Pokorny 5a93054
%{import_path} prefix.
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
bef75e1
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny 5a93054
%package unit-test
Fridolin Pokorny 5a93054
Summary:         Unit tests for %{name} package
bef75e1
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
bef75e1
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
%if 0%{?with_check}
Fridolin Pokorny 5a93054
#Here comes all BuildRequires: PACKAGE the unit tests
Fridolin Pokorny 5a93054
#in %%check section need for running
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
# test subpackage tests code from devel subpackage
Fridolin Pokorny 5a93054
Requires:        %{name}-devel = %{version}-%{release}
b784ce2
Fridolin Pokorny 5a93054
%description unit-test
Fridolin Pokorny 5a93054
%{summary}
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
This package contains unit tests for project
Fridolin Pokorny 5a93054
providing packages with %{import_path} prefix.
Fridolin Pokorny 5a93054
%endif
b784ce2
b784ce2
%prep
b784ce2
%setup -q -n %{repo}-%{commit}
b784ce2
b784ce2
%build
b784ce2
b784ce2
%install
Fridolin Pokorny 5a93054
# source codes for building projects
Fridolin Pokorny 5a93054
%if 0%{?with_devel}
b784ce2
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
bef75e1
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
Fridolin Pokorny 5a93054
# find all *.go but no *_test.go files and generate devel.file-list
Fridolin Pokorny 5a93054
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
bef75e1
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
Fridolin Pokorny 5a93054
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Fridolin Pokorny 5a93054
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Fridolin Pokorny 5a93054
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
Fridolin Pokorny 5a93054
done
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
# testing files for this project
bef75e1
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny 5a93054
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
Fridolin Pokorny 5a93054
# find all *_test.go files and generate unit-test.file-list
Fridolin Pokorny 5a93054
for file in $(find . -iname "*_test.go"); do
bef75e1
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
Fridolin Pokorny 5a93054
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
Fridolin Pokorny 5a93054
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
Fridolin Pokorny 5a93054
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
Fridolin Pokorny 5a93054
done
6ff0fcd
cp -pav test.htdigest %{buildroot}/%{gopath}/src/%{import_path}/
6ff0fcd
echo "%%{gopath}/src/%%{import_path}/test.htdigest" >> unit-test.file-list
6ff0fcd
cp -pav test.htpasswd %{buildroot}/%{gopath}/src/%{import_path}/
6ff0fcd
echo "%%{gopath}/src/%%{import_path}/test.htpasswd" >> unit-test.file-list
Fridolin Pokorny 5a93054
%endif
b784ce2
bef75e1
%if 0%{?with_devel}
bef75e1
sort -u -o devel.file-list devel.file-list
bef75e1
%endif
bef75e1
b784ce2
%check
Fridolin Pokorny 5a93054
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
bef75e1
%if ! 0%{?with_bundled}
bef75e1
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
Fridolin Pokorny 5a93054
%else
bef75e1
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
Fridolin Pokorny 5a93054
%endif
bef75e1
bef75e1
%if ! 0%{?gotest:1}
bef75e1
%global gotest go test
Fridolin Pokorny 5a93054
%endif
b784ce2
bef75e1
%gotest %{import_path}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
bef75e1
#define license tag if not already defined
bef75e1
%{!?_licensedir:%global license %doc}
bef75e1
Fridolin Pokorny 5a93054
%if 0%{?with_devel}
Fridolin Pokorny 5a93054
%files devel -f devel.file-list
bef75e1
%license LICENSE
Fridolin Pokorny 5a93054
%doc README.md
b784ce2
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
bef75e1
%if 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny 5a93054
%files unit-test -f unit-test.file-list
bef75e1
%license LICENSE
Fridolin Pokorny 5a93054
%doc README.md
Fridolin Pokorny 5a93054
%endif
b784ce2
b784ce2
%changelog
cb446c3
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.7.gitc0ef453
cb446c3
- https://fedoraproject.org/wiki/Changes/golang1.6
cb446c3
c52123f
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.gitc0ef453
c52123f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
c52123f
bef75e1
* Sat Sep 12 2015 jchaloup <jchaloup@redhat.com> - 0-0.5.gitc0ef453
bef75e1
- Update to spec 2.1
bef75e1
  related: #1248477
bef75e1
6a58c56
* Mon Aug 17 2015 jchaloup <jchaloup@redhat.com> - 0-0.4.gitc0ef453
6a58c56
- Don't provide examples
6a58c56
  related: #1248477
6a58c56
13b2ae7
* Thu Jul 30 2015 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.3.gitc0ef453
Fridolin Pokorny 17fc3d1
- Move test.htpasswd and test.htdigest to test unit
Fridolin Pokorny 17fc3d1
  related: #1248477
Fridolin Pokorny 17fc3d1
Fridolin Pokorny 17fc3d1
* Thu Jul 30 2015 Fridolin Pokorny <fpokorny@redhat.com> - 0-0.2.gitc0ef453
Fridolin Pokorny 5a93054
- Update of spec file to spec-2.0
Fridolin Pokorny 5a93054
  resolves: #1248477
Fridolin Pokorny 5a93054
6cb068e
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.2.gitc0ef453
6cb068e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
6cb068e
b784ce2
* Thu Dec 18 2014 jchaloup <jchaloup@redhat.com> - 0-0.1.gitc0ef453
b784ce2
- First package for Fedora
b784ce2
  resolves: #1175673
b784ce2
bef75e1