Blame golang-googlecode-go-crypto.spec

652a2a9
%if 0%{?fedora} || 0%{?rhel} == 6
652a2a9
%global with_devel 1
652a2a9
%global with_bundled 0
652a2a9
%global with_debug 0
652a2a9
%global with_check 1
652a2a9
%global with_unit_test 1
652a2a9
%else
652a2a9
%global with_devel 0
652a2a9
%global with_bundled 0
652a2a9
%global with_debug 0
652a2a9
%global with_check 0
652a2a9
%global with_unit_test 0
652a2a9
%endif
652a2a9
652a2a9
%if 0%{?with_debug}
652a2a9
%global _dwz_low_mem_die_limit 0
652a2a9
%else
c4eb463
%global debug_package   %{nil}
652a2a9
%endif
652a2a9
652a2a9
%define copying() \
652a2a9
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
652a2a9
%license %{*} \
652a2a9
%else \
652a2a9
%doc %{*} \
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
510a991
%global commit          c57d4a71915a248dbad846d60825145062b4c18e
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
652a2a9
Name:           golang-googlecode-go-crypto
c4eb463
Version:        0
f0ad2ca
Release:        0.9.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
652a2a9
# If go_arches not defined fall through to implicit golang archs
652a2a9
%if 0%{?go_arches:1}
652a2a9
ExclusiveArch:  %{go_arches}
c4eb463
%else
652a2a9
ExclusiveArch:   %{ix86} x86_64 %{arm}
652a2a9
%endif
652a2a9
# If gccgo_arches does not fit or is not defined fall through to golang
652a2a9
%ifarch 0%{?gccgo_arches}
652a2a9
BuildRequires:   gcc-go >= %{gccgo_min_vers}
652a2a9
%else
652a2a9
BuildRequires:   golang
c4eb463
%endif
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}
652a2a9
%endif
652a2a9
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}
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}
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}
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}
652a2a9
%endif
652a2a9
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}
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}
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}
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
# If go_arches not defined fall through to implicit golang archs
652a2a9
%if 0%{?go_arches:1}
652a2a9
ExclusiveArch:  %{go_arches}
652a2a9
%else
652a2a9
ExclusiveArch:   %{ix86} x86_64 %{arm}
652a2a9
%endif
652a2a9
# If gccgo_arches does not fit or is not defined fall through to golang
652a2a9
%ifarch 0%{?gccgo_arches}
652a2a9
BuildRequires:   gcc-go >= %{gccgo_min_vers}
652a2a9
%else
652a2a9
BuildRequires:   golang
652a2a9
%endif
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}/
652a2a9
install -d -p %{buildroot}/%{gopath}/src/%{gc_import_path}/
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}
652a2a9
%ifarch 0%{?gccgo_arches}
652a2a9
function gotest { %{gcc_go_test} "$@"; }
652a2a9
%else
652a2a9
%if 0%{?golang_test:1}
652a2a9
function gotest { %{golang_test} "$@"; }
652a2a9
%else
652a2a9
function gotest { go test "$@"; }
652a2a9
%endif
652a2a9
%endif
652a2a9
652a2a9
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
652a2a9
gotest %{import_path}/bcrypt
652a2a9
gotest %{import_path}/blowfish
652a2a9
gotest %{import_path}/bn256
652a2a9
gotest %{import_path}/cast5
652a2a9
gotest %{import_path}/curve25519
652a2a9
gotest %{import_path}/hkdf
652a2a9
gotest %{import_path}/md4
652a2a9
gotest %{import_path}/nacl/box
652a2a9
gotest %{import_path}/nacl/secretbox
652a2a9
# undefined: elliptic.P224
652a2a9
#gotest %%{import_path}/ocsp
652a2a9
gotest %{import_path}/openpgp
652a2a9
gotest %{import_path}/openpgp/armor
652a2a9
gotest %{import_path}/openpgp/clearsign
652a2a9
gotest %{import_path}/openpgp/elgamal
652a2a9
gotest %{import_path}/openpgp/packet
652a2a9
gotest %{import_path}/openpgp/s2k
652a2a9
gotest %{import_path}/otr
652a2a9
gotest %{import_path}/pbkdf2
652a2a9
gotest %{import_path}/poly1305
652a2a9
gotest %{import_path}/ripemd160
652a2a9
gotest %{import_path}/salsa20
652a2a9
gotest %{import_path}/salsa20/salsa
652a2a9
gotest %{import_path}/scrypt
652a2a9
gotest %{import_path}/sha3
652a2a9
# undefined: elliptic.P224
652a2a9
#gotest %%{import_path}/ssh
652a2a9
gotest %{import_path}/ssh/agent
652a2a9
gotest %{import_path}/ssh/terminal
652a2a9
gotest %{import_path}/ssh/test
652a2a9
gotest %{import_path}/twofish
652a2a9
gotest %{import_path}/xtea
652a2a9
gotest %{import_path}/xts
652a2a9
%endif
652a2a9
652a2a9
%if 0%{?with_devel}
652a2a9
%files -n %{x_name}-devel -f devel.file-list
652a2a9
%copying LICENSE
652a2a9
%doc CONTRIBUTING.md README AUTHORS CONTRIBUTORS
652a2a9
%dir %{gopath}/src/%{import_path}
652a2a9
652a2a9
%files devel -f gc_devel.file-list
652a2a9
%copying 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
652a2a9
%copying LICENSE
652a2a9
%doc CONTRIBUTING.md README AUTHORS CONTRIBUTORS
652a2a9
%endif
c4eb463
c4eb463
%changelog
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