|
|
2b9943f |
# If any of the following macros should be set otherwise,
|
|
|
2b9943f |
# you can wrap any of them with the following conditions:
|
|
|
2b9943f |
# - %%if 0%%{centos} == 7
|
|
|
2b9943f |
# - %%if 0%%{?rhel} == 7
|
|
|
2b9943f |
# - %%if 0%%{?fedora} == 23
|
|
|
2b9943f |
# Or just test for particular distribution:
|
|
|
2b9943f |
# - %%if 0%%{centos}
|
|
|
2b9943f |
# - %%if 0%%{?rhel}
|
|
|
2b9943f |
# - %%if 0%%{?fedora}
|
|
|
2b9943f |
#
|
|
|
2b9943f |
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
|
|
|
2b9943f |
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
|
|
|
2b9943f |
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
|
|
|
2b9943f |
|
|
|
2b9943f |
# Generate devel rpm
|
|
|
2b9943f |
%global with_devel 1
|
|
|
2b9943f |
# Build project from bundled dependencies
|
|
|
2b9943f |
%global with_bundled 0
|
|
|
2b9943f |
# Build with debug info rpm
|
|
|
2b9943f |
%global with_debug 0
|
|
|
2b9943f |
# Run tests in check section
|
|
|
2b9943f |
%global with_check 1
|
|
|
2b9943f |
# Generate unit-test rpm
|
|
|
2b9943f |
%global with_unit_test 1
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_debug}
|
|
|
2b9943f |
%global _dwz_low_mem_die_limit 0
|
|
|
2b9943f |
%else
|
|
|
2b9943f |
%global debug_package %{nil}
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
|
|
|
2b9943f |
%global provider github
|
|
|
2b9943f |
%global provider_tld com
|
|
|
2b9943f |
%global project flynn
|
|
|
2b9943f |
%global repo json5
|
|
|
2b9943f |
# https://github.com/flynn/json5
|
|
|
2b9943f |
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
|
|
2b9943f |
%global import_path %{provider_prefix}
|
|
|
2b9943f |
%global commit 7620272ed63390e979cf5882d2fa0506fe2a8db5
|
|
|
2b9943f |
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
2b9943f |
%global commitdate 20160717
|
|
|
2b9943f |
|
|
|
2b9943f |
Name: golang-%{provider}-%{project}-%{repo}
|
|
|
2b9943f |
Version: 0
|
|
|
127d193 |
Release: 0.2.%{commitdate}git%{shortcommit}%{?dist}
|
|
|
2b9943f |
Summary: Go JSON5 decoder package based on encoding/json
|
|
|
2b9943f |
# Main package: BSD
|
|
|
2b9943f |
# Test data: MIT
|
|
|
2b9943f |
License: BSD and MIT
|
|
|
2b9943f |
URL: https://%{provider_prefix}
|
|
|
2b9943f |
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
|
|
|
2b9943f |
|
|
|
2b9943f |
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
|
|
|
2b9943f |
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
|
|
|
2b9943f |
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
|
|
2b9943f |
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
|
|
2b9943f |
|
|
|
2b9943f |
|
|
|
2b9943f |
|
|
|
2b9943f |
%description
|
|
|
2b9943f |
%{summary}
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_devel}
|
|
|
2b9943f |
%package devel
|
|
|
2b9943f |
Summary: %{summary}
|
|
|
2b9943f |
BuildArch: noarch
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_check} && ! 0%{?with_bundled}
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
|
|
|
2b9943f |
Provides: golang(%{import_path}) = %{version}-%{release}
|
|
|
2b9943f |
|
|
|
2b9943f |
%description devel
|
|
|
2b9943f |
%{summary}
|
|
|
2b9943f |
|
|
|
2b9943f |
This package contains library source intended for
|
|
|
2b9943f |
building other packages which use import path with
|
|
|
2b9943f |
%{import_path} prefix.
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
2b9943f |
%package unit-test-devel
|
|
|
2b9943f |
Summary: Unit tests for %{name} package
|
|
|
2b9943f |
%if 0%{?with_check}
|
|
|
2b9943f |
#Here comes all BuildRequires: PACKAGE the unit tests
|
|
|
2b9943f |
#in %%check section need for running
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
# test subpackage tests code from devel subpackage
|
|
|
2b9943f |
Requires: %{name}-devel = %{version}-%{release}
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_check} && ! 0%{?with_bundled}
|
|
|
2b9943f |
BuildRequires: golang(github.com/kylelemons/godebug/pretty)
|
|
|
2b9943f |
BuildRequires: golang(github.com/robertkrimen/otto)
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
Requires: golang(github.com/kylelemons/godebug/pretty)
|
|
|
2b9943f |
Requires: golang(github.com/robertkrimen/otto)
|
|
|
2b9943f |
|
|
|
2b9943f |
%description unit-test-devel
|
|
|
2b9943f |
%{summary}
|
|
|
2b9943f |
|
|
|
2b9943f |
This package contains unit tests for project
|
|
|
2b9943f |
providing packages with %{import_path} prefix.
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%prep
|
|
|
2b9943f |
%autosetup -n %{repo}-%{commit}
|
|
|
2b9943f |
|
|
|
2b9943f |
%build
|
|
|
2b9943f |
%install
|
|
|
2b9943f |
# source codes for building projects
|
|
|
2b9943f |
%if 0%{?with_devel}
|
|
|
2b9943f |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
|
2b9943f |
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
|
|
|
2b9943f |
# find all *.go but no *_test.go files and generate devel.file-list
|
|
|
2b9943f |
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
|
|
|
2b9943f |
dirprefix=$(dirname $file)
|
|
|
2b9943f |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
|
|
2b9943f |
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
|
2b9943f |
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
|
|
|
2b9943f |
|
|
|
2b9943f |
while [ "$dirprefix" != "." ]; do
|
|
|
2b9943f |
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
|
|
2b9943f |
dirprefix=$(dirname $dirprefix)
|
|
|
2b9943f |
done
|
|
|
2b9943f |
done
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
# testing files for this project
|
|
|
2b9943f |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
2b9943f |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
|
2b9943f |
# find all *_test.go files and generate unit-test-devel.file-list
|
|
|
2b9943f |
for file in $(find . -iname "*_test.go") ; do
|
|
|
2b9943f |
dirprefix=$(dirname $file)
|
|
|
2b9943f |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
|
|
2b9943f |
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
|
2b9943f |
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
|
|
|
2b9943f |
|
|
|
2b9943f |
while [ "$dirprefix" != "." ]; do
|
|
|
2b9943f |
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
|
|
2b9943f |
dirprefix=$(dirname $dirprefix)
|
|
|
2b9943f |
done
|
|
|
2b9943f |
done
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_devel}
|
|
|
2b9943f |
sort -u -o devel.file-list devel.file-list
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%check
|
|
|
2b9943f |
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
2b9943f |
%if ! 0%{?with_bundled}
|
|
|
2b9943f |
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
|
2b9943f |
%else
|
|
|
2b9943f |
# No dependency directories so far
|
|
|
2b9943f |
|
|
|
2b9943f |
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%if ! 0%{?gotest:1}
|
|
|
2b9943f |
%global gotest go test
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%gotest %{import_path}
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
#define license tag if not already defined
|
|
|
2b9943f |
%{!?_licensedir:%global license %doc}
|
|
|
2b9943f |
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_devel}
|
|
|
2b9943f |
%files devel -f devel.file-list
|
|
|
2b9943f |
%license LICENSE
|
|
|
2b9943f |
%doc README.md CONTRIBUTING.md
|
|
|
2b9943f |
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
2b9943f |
%files unit-test-devel -f unit-test-devel.file-list
|
|
|
2b9943f |
%license LICENSE
|
|
|
2b9943f |
%doc README.md CONTRIBUTING.md
|
|
|
2b9943f |
%endif
|
|
|
2b9943f |
|
|
|
2b9943f |
%changelog
|
|
|
127d193 |
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2.20160717git7620272
|
|
|
127d193 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
|
|
127d193 |
|
|
|
2b9943f |
* Fri Sep 29 2017 Robert-André Mauchin <zebob.m@gmail.com> - 0-0.1.20160717git7620272
|
|
|
2b9943f |
- First package for Fedora
|
|
|
2b9943f |
|