# If any of the following macros should be set otherwise,
# you can wrap any of them with the following conditions:
# - %%if 0%%{centos} == 7
# - %%if 0%%{?rhel} == 7
# - %%if 0%%{?fedora} == 23
# Or just test for particular distribution:
# - %%if 0%%{centos}
# - %%if 0%%{?rhel}
# - %%if 0%%{?fedora}
#
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
# Build with debug info rpm
%global with_debug 0
%if 0%{?with_debug}
%global _dwz_low_mem_die_limit 0
%else
%global debug_package %{nil}
%endif
%global provider github
%global provider_tld com
%global project exercism
%global repo cli
# https://github.com/exercism/cli
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%global commit 3968e887bae5e6ff32e1f29f19e5830c9721da44
%global commitdate 20170701
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: %{project}
Version: 2.4.1
Release: 3%{?dist}
Summary: Exercism command-line interface
License: MIT
URL: https://%{provider_prefix}
Source0: https://%{provider_prefix}/archive/v%{version}.tar.gz
# Remove the github.com/inconshreveable/go-update dependency
Patch1: exercism-0001-remove-self-update.patch
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
BuildRequires: golang(github.com/blang/semver)
BuildRequires: golang(github.com/urfave/cli)
BuildRequires: golang(golang.org/x/net/html/charset)
BuildRequires: golang(golang.org/x/text/transform)
Requires: golang(github.com/blang/semver)
Requires: golang(github.com/urfave/cli)
Requires: golang(golang.org/x/net/html/charset)
Requires: golang(golang.org/x/text/transform)
Provides: golang(%{import_path}) = %{version}-%{release}
%description
Exercism provides a way to do the problems on http://exercism.io .
This CLI ships as a binary with no additional run-time requirements. This means
that if you're doing the Haskell problems on exercism you don't need a working
Python or Ruby environment simply to fetch and submit exercises.
%prep
%setup -q -n %{repo}-%{version}
%patch1 -p1
# create a fake GOPATH
mkdir -p ./_build/src/%{provider}.%{provider_tld}/%{project}
ln -s $(pwd) ./_build/src/%{import_path}
%build
export GOPATH=$(pwd)/_build:%{gopath}
go build -o out/exercism exercism/main.go
%install
# main exercism binary
install -d -p %{buildroot}%{_bindir}/
install -p out/exercism %{buildroot}%{_bindir}/
%check
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/_build:%{gopath}
# TestLoad_InvalidJSON try to hard-link from PWD to TMPDIR
export TMPDIR=$(pwd)/_check_tmp
mkdir -p $TMPDIR
%if ! 0%{?gotest:1}
%global gotest go test
%endif
%gotest %{import_path}/api
%gotest %{import_path}/cmd
%gotest %{import_path}/config
%gotest %{import_path}/debug
%gotest %{import_path}/paths
%gotest %{import_path}/user
#define license tag if not already defined
%{!?_licensedir:%global license %doc}
%files
%license LICENSE
%doc CHANGELOG.md RELEASE.md README.md
%{_bindir}/exercism
%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Sep 06 2017 Clément David <c.david86@gmail.com> - 2.4.1-1
- First package for Fedora