Blame golang-github-abbot-go-http-auth.spec

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
Fridolin Pokorny 5a93054
%define copying() \
Fridolin Pokorny 5a93054
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
Fridolin Pokorny 5a93054
%license %{*} \
Fridolin Pokorny 5a93054
%else \
Fridolin Pokorny 5a93054
%doc %{*} \
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
13b2ae7
Release:        0.3.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
Fridolin Pokorny 5a93054
# If go_arches not defined fall through to implicit golang archs
Fridolin Pokorny 5a93054
%if 0%{?go_arches:1}
Fridolin Pokorny 5a93054
ExclusiveArch:  %{go_arches}
Fridolin Pokorny 5a93054
%else
Fridolin Pokorny 5a93054
ExclusiveArch:   %{ix86} x86_64 %{arm}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
# If gccgo_arches does not fit or is not defined fall through to golang
Fridolin Pokorny 5a93054
%ifarch 0%{?gccgo_arches}
Fridolin Pokorny 5a93054
BuildRequires:   gcc-go >= %{gccgo_min_vers}
b784ce2
%else
Fridolin Pokorny 5a93054
BuildRequires:   golang
b784ce2
%endif
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}
Fridolin Pokorny 5a93054
Provides:      golang(%{import_path}/examples) = %{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
Fridolin Pokorny 5a93054
%if 0%{?with_unit_test}
Fridolin Pokorny 5a93054
%package unit-test
Fridolin Pokorny 5a93054
Summary:         Unit tests for %{name} package
Fridolin Pokorny 5a93054
# If go_arches not defined fall through to implicit golang archs
Fridolin Pokorny 5a93054
%if 0%{?go_arches:1}
Fridolin Pokorny 5a93054
ExclusiveArch:  %{go_arches}
Fridolin Pokorny 5a93054
%else
Fridolin Pokorny 5a93054
ExclusiveArch:   %{ix86} x86_64 %{arm}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
# If gccgo_arches does not fit or is not defined fall through to golang
Fridolin Pokorny 5a93054
%ifarch 0%{?gccgo_arches}
Fridolin Pokorny 5a93054
BuildRequires:   gcc-go >= %{gccgo_min_vers}
Fridolin Pokorny 5a93054
%else
Fridolin Pokorny 5a93054
BuildRequires:   golang
Fridolin Pokorny 5a93054
%endif
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}/
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
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
b784ce2
cp -pav test.htdigest %{buildroot}/%{gopath}/src/%{import_path}/
Fridolin Pokorny 5a93054
echo "%%{gopath}/src/%%{import_path}/test.htdigest" >> devel.file-list
b784ce2
cp -pav test.htpasswd %{buildroot}/%{gopath}/src/%{import_path}/
Fridolin Pokorny 5a93054
echo "%%{gopath}/src/%%{import_path}/test.htpasswd" >> devel.file-list
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
# testing files for this project
Fridolin Pokorny 5a93054
%if 0%{?with_unit_test}
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
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
Fridolin Pokorny 5a93054
%endif
b784ce2
b784ce2
%check
Fridolin Pokorny 5a93054
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
Fridolin Pokorny 5a93054
%ifarch 0%{?gccgo_arches}
Fridolin Pokorny 5a93054
function gotest { %{gcc_go_test} "$@"; }
Fridolin Pokorny 5a93054
%else
Fridolin Pokorny 5a93054
%if 0%{?golang_test:1}
Fridolin Pokorny 5a93054
function gotest { %{golang_test} "$@"; }
Fridolin Pokorny 5a93054
%else
Fridolin Pokorny 5a93054
function gotest { go test "$@"; }
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
%endif
b784ce2
Fridolin Pokorny 5a93054
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
Fridolin Pokorny 5a93054
gotest %{import_path}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
%if 0%{?with_devel}
Fridolin Pokorny 5a93054
%files devel -f devel.file-list
Fridolin Pokorny 5a93054
%copying LICENSE
Fridolin Pokorny 5a93054
%doc README.md
b784ce2
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
Fridolin Pokorny 5a93054
%dir %{gopath}/src/%{import_path}
Fridolin Pokorny 5a93054
%endif
Fridolin Pokorny 5a93054
Fridolin Pokorny 5a93054
%if 0%{?with_unit_test}
Fridolin Pokorny 5a93054
%files unit-test -f unit-test.file-list
Fridolin Pokorny 5a93054
%copying LICENSE
Fridolin Pokorny 5a93054
%doc README.md
Fridolin Pokorny 5a93054
%endif
b784ce2
b784ce2
%changelog
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