From e06310b323cc6f8d9bcefb8a58bcc3230d99aad7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Jul 11 2019 03:43:14 +0000 Subject: Update to latest Go macros. --- diff --git a/exercism.spec b/exercism.spec index c03824a..45e1664 100644 --- a/exercism.spec +++ b/exercism.spec @@ -1,59 +1,41 @@ -# 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 - +# Generated by go2rpm +%bcond_without check -%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 goipath github.com/exercism/cli +Version: 3.0.12 + +%gometa + +# Uncomment if we start providing devel packages: +#global common_description #{expand: +#A Go based command line tool for exercism.io.} -Name: %{project} -Version: 3.0.12 +#global golicenses LICENSE +#global godocs RELEASE.md CHANGELOG.md CONTRIBUTING.md README.md + +Name: exercism Release: 1%{?dist} Summary: Exercism command-line interface + License: MIT -URL: https://%{provider_prefix} -Source0: https://%{provider_prefix}/archive/v%{version}/%{repo}-%{version}.tar.gz +URL: %{gourl} +Source0: %{gosource} # Remove the github.com/inconshreveable/go-update dependency Patch0001: 0001-Disable-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/spf13/cobra) +BuildRequires: golang(github.com/spf13/pflag) +BuildRequires: golang(github.com/spf13/viper) +BuildRequires: golang(golang.org/x/net/html/charset) +BuildRequires: golang(golang.org/x/text/transform) -BuildRequires: golang(github.com/blang/semver) -BuildRequires: golang(github.com/spf13/cobra) -BuildRequires: golang(github.com/spf13/pflag) -BuildRequires: golang(github.com/spf13/viper) -BuildRequires: golang(golang.org/x/net/html/charset) -BuildRequires: golang(golang.org/x/text/transform) -BuildRequires: golang(github.com/stretchr/testify/assert) +%if %{with check} +# Tests +BuildRequires: golang(github.com/stretchr/testify/assert) +%endif %description Exercism provides a way to do the problems on https://exercism.io. @@ -64,22 +46,18 @@ Python or Ruby environment simply to fetch and submit exercises. %prep -%autosetup -n %{repo}-%{version} -p1 - -# create a fake GOPATH -mkdir -p ./_build/src/%{provider}.%{provider_tld}/%{project} -ln -s $(pwd) ./_build/src/%{import_path} +%goprep +%patch1 -p1 %build -export GOPATH=$(pwd)/_build:%{gopath} -go build -o out/exercism exercism/main.go +%gobuild -o %{gobuilddir}/bin/exercism %{goipath}/exercism %install # main exercism binary install -d -p %{buildroot}%{_bindir}/ -install -p out/exercism %{buildroot}%{_bindir}/ +install -p %{gobuilddir}/bin/exercism %{buildroot}%{_bindir}/ # shell completion install -d %{buildroot}%{_datadir}/bash-completion/completions install -Dpm0644 shell/exercism_completion.bash %{buildroot}%{_datadir}/bash-completion/completions/exercism @@ -89,30 +67,11 @@ install -d %{buildroot}%{_datadir}/zsh/site-functions install -Dpm0644 shell/exercism_completion.zsh %{buildroot}%{_datadir}/zsh/site-functions/_exercism +%if %{with check} %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 +%gocheck %endif -%gotest %{import_path}/api -%gotest %{import_path}/browser -%gotest %{import_path}/cli -%gotest %{import_path}/cmd -%gotest %{import_path}/config -%gotest %{import_path}/debug -%gotest %{import_path}/exercism -%gotest %{import_path}/workspace - - -#define license tag if not already defined -%{!?_licensedir:%global license %doc} - %files %license LICENSE %doc CHANGELOG.md RELEASE.md README.md @@ -132,6 +91,7 @@ mkdir -p $TMPDIR * Wed Jul 10 2019 Elliott Sales de Andrade - 3.0.12-1 - Update to latest version - Add fish completions +- Update to latest Go macros * Sat Feb 09 2019 Elliott Sales de Andrade - 3.0.11-1 - Update to latest version