9045287
# If any of the following macros should be set otherwise,
9045287
# you can wrap any of them with the following conditions:
9045287
# - %%if 0%%{centos} == 7
9045287
# - %%if 0%%{?rhel} == 7
9045287
# - %%if 0%%{?fedora} == 23
9045287
# Or just test for particular distribution:
9045287
# - %%if 0%%{centos}
9045287
# - %%if 0%%{?rhel}
9045287
# - %%if 0%%{?fedora}
9045287
#
9045287
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
9045287
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
9045287
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
9045287
9045287
# Generate devel rpm
652a2a9
%global with_devel 1
9045287
# Build project from bundled dependencies
652a2a9
%global with_bundled 0
9045287
# Build with debug info rpm
652a2a9
%global with_debug 0
9045287
# Run tests in check section
dbbe28c
%global with_check 0
9045287
# Generate unit-test rpm
652a2a9
%global with_unit_test 1
652a2a9
652a2a9
%if 0%{?with_debug}
652a2a9
%global _dwz_low_mem_die_limit 0
652a2a9
%else
c4eb463
%global debug_package   %{nil}
652a2a9
%endif
652a2a9
510a991
%global provider        github
c4eb463
%global provider_tld    com
510a991
%global project         golang
c4eb463
%global repo            crypto
510a991
# https://github.com/golang/crypto
652a2a9
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
652a2a9
%global import_path     golang.org/x/crypto
f033604
%global commit          81372b2fc2f10bef2a7f338da115c315a56b2726
652a2a9
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
652a2a9
652a2a9
%global gc_import_path     code.google.com/p/go.crypto
510a991
%global gc_rev             69e2a90ed92d03812364aeb947b7068dc42e561e
510a991
%global gc_shortrev        %(r=%{rev}; echo ${r:0:12})
c4eb463
652a2a9
%global x_name          golang-golangorg-crypto
c4eb463
dbbe28c
%global devel_main      %{x_name}-devel
dbbe28c
652a2a9
Name:           golang-googlecode-go-crypto
c4eb463
Version:        0
f033604
Release:        0.13.git%{shortcommit}%{?dist}
c4eb463
Summary:        Supplementary Go cryptography libraries
c4eb463
License:        BSD
652a2a9
URL:            https://%{provider_prefix}
652a2a9
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
652a2a9
dbbe28c
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
9045287
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
dbbe28c
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
dbbe28c
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
c4eb463
c4eb463
%description
c4eb463
%{summary}
c4eb463
652a2a9
%if 0%{?with_devel}
c4eb463
%package devel
652a2a9
Summary:       %{summary}
652a2a9
BuildArch:     noarch
652a2a9
652a2a9
%if 0%{?with_check}
f033604
BuildRequires: golang(golang.org/x/net/context)
f033604
BuildRequires: golang(golang.org/x/net/context/ctxhttp)
652a2a9
%endif
652a2a9
f033604
Requires: golang(golang.org/x/net/context)
f033604
Requires: golang(golang.org/x/net/context/ctxhttp)
f033604
f033604
Provides:      golang(%{gc_import_path}/acme) = %{version}-%{release}
f033604
Provides:      golang(%{gc_import_path}/acme/autocert) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/bcrypt) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/blowfish) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/bn256) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/cast5) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/curve25519) = %{version}-%{release}
f033604
Provides:      golang(%{gc_import_path}/ed25519) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/hkdf) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/md4) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/nacl/box) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/nacl/secretbox) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ocsp) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp/armor) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp/clearsign) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp/elgamal) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp/errors) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp/packet) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/openpgp/s2k) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/otr) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/pbkdf2) = %{version}-%{release}
f033604
Provides:      golang(%{gc_import_path}/pkcs12) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/poly1305) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ripemd160) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/salsa20) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/salsa20/salsa) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/scrypt) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/sha3) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ssh) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ssh/agent) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ssh/terminal) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ssh/test) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/ssh/testdata) = %{version}-%{release}
f033604
Provides:      golang(%{gc_import_path}/tea) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/twofish) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/xtea) = %{version}-%{release}
652a2a9
Provides:      golang(%{gc_import_path}/xts) = %{version}-%{release}
c4eb463
c4eb463
%description devel
c4eb463
%{summary}
c4eb463
652a2a9
This package contains library source intended for
652a2a9
building other packages which use import path with
652a2a9
%{gc_import_path} prefix.
c4eb463
c4eb463
%package -n %{x_name}-devel
652a2a9
Summary:       %{summary}
652a2a9
BuildArch:     noarch
652a2a9
652a2a9
%if 0%{?with_check}
f033604
BuildRequires: golang(golang.org/x/net/context)
f033604
BuildRequires: golang(golang.org/x/net/context/ctxhttp)
652a2a9
%endif
652a2a9
f033604
Requires: golang(golang.org/x/net/context)
f033604
Requires: golang(golang.org/x/net/context/ctxhttp)
f033604
f033604
Provides:      golang(%{import_path}/acme) = %{version}-%{release}
f033604
Provides:      golang(%{import_path}/acme/autocert) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/bcrypt) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/blowfish) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/bn256) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/cast5) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/curve25519) = %{version}-%{release}
f033604
Provides:      golang(%{import_path}/ed25519) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/hkdf) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/md4) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/nacl/box) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/nacl/secretbox) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ocsp) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp/armor) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp/clearsign) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp/elgamal) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp/errors) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp/packet) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/openpgp/s2k) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/otr) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/pbkdf2) = %{version}-%{release}
f033604
Provides:      golang(%{import_path}/pkcs12) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/poly1305) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ripemd160) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/salsa20) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/salsa20/salsa) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/scrypt) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/sha3) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ssh) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ssh/agent) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ssh/terminal) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ssh/test) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/ssh/testdata) = %{version}-%{release}
f033604
Provides:      golang(%{import_path}/tea) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/twofish) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/xtea) = %{version}-%{release}
652a2a9
Provides:      golang(%{import_path}/xts) = %{version}-%{release}
c4eb463
c4eb463
%description -n %{x_name}-devel
c4eb463
%{summary}
c4eb463
652a2a9
This package contains library source intended for
652a2a9
building other packages which use import path with
652a2a9
%{import_path} prefix.
652a2a9
%endif
652a2a9
652a2a9
%if 0%{?with_unit_test}
652a2a9
%package unit-test
652a2a9
Summary:         Unit tests for %{name} package
652a2a9
652a2a9
%if 0%{?with_check}
652a2a9
#Here comes all BuildRequires: PACKAGE the unit tests
652a2a9
#in %%check section need for running
652a2a9
%endif
652a2a9
652a2a9
# test subpackage tests code from devel subpackage
6aaaf74
Requires:        %{x_name}-devel = %{version}-%{release}
652a2a9
652a2a9
%description unit-test
652a2a9
%{summary}
652a2a9
652a2a9
This package contains unit tests for project
652a2a9
providing packages with %{import_path} prefix.
652a2a9
%endif
c4eb463
c4eb463
%prep
510a991
%setup -q -n %{repo}-%{commit}
c4eb463
c4eb463
%build
c4eb463
c4eb463
%install
652a2a9
# source codes for building projects
652a2a9
%if 0%{?with_devel}
652a2a9
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
dbbe28c
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
652a2a9
install -d -p %{buildroot}/%{gopath}/src/%{gc_import_path}/
dbbe28c
echo "%%dir %%{gopath}/src/%%{gc_import_path}/." >> gc_devel.file-list
652a2a9
for ext in go s; do
652a2a9
	# find all *.go but no *_test.go files and generate devel.file-list
652a2a9
	for file in $(find . -iname "*.$ext" \! -iname "*_test.go") ; do
652a2a9
	    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
652a2a9
	    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
652a2a9
	    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
652a2a9
	    install -d -p %{buildroot}/%{gopath}/src/%{gc_import_path}/$(dirname $file)
652a2a9
	    cp -pav $file %{buildroot}/%{gopath}/src/%{gc_import_path}/$file
652a2a9
	    echo "%%{gopath}/src/%%{gc_import_path}/$file" >> gc_devel.file-list
652a2a9
	done
9897f48
done
652a2a9
pushd %{buildroot}/%{gopath}/src/%{gc_import_path}
1f86345
sed -i 's/"golang\.org\/x\/crypto/"code\.google\.com\/p\/go\.crypto/g' \
c4eb463
        $(find . -name '*.go')
652a2a9
popd
652a2a9
%endif
652a2a9
652a2a9
# testing files for this project
652a2a9
%if 0%{?with_unit_test}
652a2a9
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
652a2a9
# find all *_test.go files and generate unit-test.file-list
652a2a9
for file in $(find . -iname "*_test.go"); do
652a2a9
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
652a2a9
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
652a2a9
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
652a2a9
done
652a2a9
for file in ./sha3/testdata/keccakKats.json.deflate; do
652a2a9
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/sha3/testdata
652a2a9
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
652a2a9
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
652a2a9
done
652a2a9
%endif
c4eb463
c4eb463
%check
652a2a9
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
dbbe28c
%if ! 0%{?with_bundled}
dbbe28c
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
652a2a9
%else
dbbe28c
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
652a2a9
%endif
dbbe28c
dbbe28c
%if ! 0%{?gotest:1}
dbbe28c
%global gotest go test
652a2a9
%endif
652a2a9
dbbe28c
%gotest %{import_path}/bcrypt
dbbe28c
%gotest %{import_path}/blowfish
dbbe28c
%gotest %{import_path}/bn256
dbbe28c
%gotest %{import_path}/cast5
dbbe28c
%gotest %{import_path}/curve25519
dbbe28c
%gotest %{import_path}/hkdf
dbbe28c
%gotest %{import_path}/md4
dbbe28c
%gotest %{import_path}/nacl/box
dbbe28c
%gotest %{import_path}/nacl/secretbox
652a2a9
# undefined: elliptic.P224
dbbe28c
#%gotest %%{import_path}/ocsp
dbbe28c
%gotest %{import_path}/openpgp
dbbe28c
%gotest %{import_path}/openpgp/armor
dbbe28c
%gotest %{import_path}/openpgp/clearsign
dbbe28c
%gotest %{import_path}/openpgp/elgamal
dbbe28c
%gotest %{import_path}/openpgp/packet
dbbe28c
%gotest %{import_path}/openpgp/s2k
dbbe28c
%gotest %{import_path}/otr
dbbe28c
%gotest %{import_path}/pbkdf2
dbbe28c
%gotest %{import_path}/poly1305
dbbe28c
%gotest %{import_path}/ripemd160
dbbe28c
%gotest %{import_path}/salsa20
dbbe28c
%gotest %{import_path}/salsa20/salsa
dbbe28c
%gotest %{import_path}/scrypt
dbbe28c
%gotest %{import_path}/sha3
652a2a9
# undefined: elliptic.P224
dbbe28c
#%gotest %%{import_path}/ssh
dbbe28c
%gotest %{import_path}/ssh/agent
dbbe28c
%gotest %{import_path}/ssh/terminal
dbbe28c
%gotest %{import_path}/ssh/test
dbbe28c
%gotest %{import_path}/twofish
dbbe28c
%gotest %{import_path}/xtea
dbbe28c
%gotest %{import_path}/xts
652a2a9
%endif
652a2a9
dbbe28c
#define license tag if not already defined
dbbe28c
%{!?_licensedir:%global license %doc}
dbbe28c
652a2a9
%if 0%{?with_devel}
652a2a9
%files -n %{x_name}-devel -f devel.file-list
dbbe28c
%license LICENSE
652a2a9
%doc CONTRIBUTING.md README AUTHORS CONTRIBUTORS
652a2a9
%dir %{gopath}/src/%{import_path}
652a2a9
652a2a9
%files devel -f gc_devel.file-list
dbbe28c
%license LICENSE
652a2a9
%doc CONTRIBUTING.md README AUTHORS CONTRIBUTORS
652a2a9
%dir %{gopath}/src/%{gc_import_path}
652a2a9
%endif
652a2a9
652a2a9
%if 0%{?with_unit_test}
652a2a9
%files unit-test -f unit-test.file-list
dbbe28c
%license LICENSE
652a2a9
%doc CONTRIBUTING.md README AUTHORS CONTRIBUTORS
652a2a9
%endif
c4eb463
c4eb463
%changelog
f033604
* Fri Jan 13 2017 Jan Chaloupka <jchaloup@redhat.com> - 0-0.13.git81372b2
f033604
- Bump to upstream 81372b2fc2f10bef2a7f338da115c315a56b2726
f033604
  related: #1231618
f033604
9045287
* Fri Dec 16 2016 Jan Chaloupka <jchaloup@redhat.com> - 0-0.12.gitc10c31b
9045287
- Polish the spec file
9045287
  related: #1231618
9045287
8e9d4ad
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.11.gitc10c31b
8e9d4ad
- https://fedoraproject.org/wiki/Changes/golang1.7
8e9d4ad
dbbe28c
* Sun Mar 06 2016 jchaloup <jchaloup@redhat.com> - 0-0.10.gitc10c31b
dbbe28c
- Bump to upstream c10c31b5e94b6f7a0283272dc2bb27163dcea24b
dbbe28c
  related: #1231618
dbbe28c
f0ad2ca
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.9.gitc57d4a7
f0ad2ca
- https://fedoraproject.org/wiki/Changes/golang1.6
f0ad2ca
e0a2638
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.8.gitc57d4a7
e0a2638
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
e0a2638
1f86345
* Thu Oct 08 2015 jchaloup <jchaloup@redhat.com> - 0-0.7.gitc57d4a7
1f86345
- Fix sed for import path
1f86345
  related: #1231618
1f86345
6aaaf74
* Thu Aug 20 2015 jchaloup <jchaloup@redhat.com> - 0-0.6.gitc57d4a7
6aaaf74
- Choose the correct devel subpackage
6aaaf74
  related: #1231618
6aaaf74
652a2a9
* Wed Aug 19 2015 jchaloup <jchaloup@redhat.com> - 0-0.5.gitc57d4a7
652a2a9
- Update spec file to spec-2.0
652a2a9
  related: #1231618
652a2a9
b266342
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.4.gitc57d4a7
b266342
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
b266342
510a991
* Mon Jun 15 2015 jchaloup <jchaloup@redhat.com> - 0-0.3.git%{shortcommit}
510a991
- Repository has moved to github.com/golang/crypto, updating spec file accordingly
510a991
  resolves: #1231618
510a991
9897f48
* Sun Dec 14 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0-0.2.hg69e2a90ed92d
9897f48
- Correct Source0 URL
9897f48
- Correct paths for golang.org/x/crypto/*
9897f48
c4eb463
* Thu Dec 04 2014 jchaloup <jchaloup@redhat.com> - 0-0.1.hg69e2a90ed92d
c4eb463
- First package for Fedora
c4eb463
  resolves: #1148704