|
|
10d0529 |
# If any of the following macros should be set otherwise,
|
|
|
10d0529 |
# you can wrap any of them with the following conditions:
|
|
|
10d0529 |
# - %%if 0%%{centos} == 7
|
|
|
10d0529 |
# - %%if 0%%{?rhel} == 7
|
|
|
10d0529 |
# - %%if 0%%{?fedora} == 23
|
|
|
10d0529 |
# Or just test for particular distribution:
|
|
|
10d0529 |
# - %%if 0%%{centos}
|
|
|
10d0529 |
# - %%if 0%%{?rhel}
|
|
|
10d0529 |
# - %%if 0%%{?fedora}
|
|
|
10d0529 |
#
|
|
|
10d0529 |
# Be aware, on centos, both %%rhel and %%centos are set. If you want to test
|
|
|
10d0529 |
# rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.
|
|
|
10d0529 |
# (Don't forget to replace double percentage symbol with single one in order to apply a condition)
|
|
|
10d0529 |
|
|
|
10d0529 |
# Generate devel rpm
|
|
|
10d0529 |
%global with_devel 1
|
|
|
10d0529 |
# Build project from bundled dependencies
|
|
|
10d0529 |
%global with_bundled 0
|
|
|
10d0529 |
# Build with debug info rpm
|
|
|
10d0529 |
%global with_debug 0
|
|
|
10d0529 |
# Run tests in check section
|
|
|
10d0529 |
%global with_check 1
|
|
|
10d0529 |
# Generate unit-test rpm
|
|
|
10d0529 |
%global with_unit_test 1
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_debug}
|
|
|
10d0529 |
%global _dwz_low_mem_die_limit 0
|
|
|
10d0529 |
%else
|
|
|
10d0529 |
%global debug_package %{nil}
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
|
|
|
10d0529 |
%global provider github
|
|
|
10d0529 |
%global provider_tld com
|
|
|
10d0529 |
%global project mitchellh
|
|
|
10d0529 |
%global repo go-wordwrap
|
|
|
10d0529 |
# https://github.com/mitchellh/go-wordwrap
|
|
|
10d0529 |
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
|
|
10d0529 |
%global import_path %{provider_prefix}
|
|
|
10d0529 |
%global commit ad45545899c7b13c020ea92b2072220eefad42b8
|
|
|
10d0529 |
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
10d0529 |
|
|
|
10d0529 |
Name: golang-%{provider}-%{project}-%{repo}
|
|
|
10d0529 |
Version: 0
|
|
|
fa22cf0 |
Release: 0.2.git%{shortcommit}%{?dist}
|
|
|
10d0529 |
Summary: A Go library for wrapping words in a string
|
|
|
10d0529 |
# Detected licences
|
|
|
10d0529 |
# - MIT/X11 (BSD like) at 'LICENSE.md'
|
|
|
10d0529 |
License: MIT
|
|
|
10d0529 |
URL: https://%{provider_prefix}
|
|
|
10d0529 |
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
|
|
|
10d0529 |
|
|
|
10d0529 |
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
|
|
|
10d0529 |
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
|
|
|
10d0529 |
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
|
|
10d0529 |
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
|
|
10d0529 |
|
|
|
10d0529 |
|
|
|
10d0529 |
|
|
|
10d0529 |
%description
|
|
|
10d0529 |
%{summary}
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_devel}
|
|
|
10d0529 |
%package devel
|
|
|
10d0529 |
Summary: %{summary}
|
|
|
10d0529 |
BuildArch: noarch
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_check} && ! 0%{?with_bundled}
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
|
|
|
10d0529 |
Provides: golang(%{import_path}) = %{version}-%{release}
|
|
|
10d0529 |
|
|
|
10d0529 |
%description devel
|
|
|
10d0529 |
%{summary}
|
|
|
10d0529 |
|
|
|
10d0529 |
This package contains library source intended for
|
|
|
10d0529 |
building other packages which use import path with
|
|
|
10d0529 |
%{import_path} prefix.
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
10d0529 |
%package unit-test-devel
|
|
|
10d0529 |
Summary: Unit tests for %{name} package
|
|
|
10d0529 |
%if 0%{?with_check}
|
|
|
10d0529 |
#Here comes all BuildRequires: PACKAGE the unit tests
|
|
|
10d0529 |
#in %%check section need for running
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
# test subpackage tests code from devel subpackage
|
|
|
10d0529 |
Requires: %{name}-devel = %{version}-%{release}
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_check} && ! 0%{?with_bundled}
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
|
|
|
10d0529 |
%description unit-test-devel
|
|
|
10d0529 |
%{summary}
|
|
|
10d0529 |
|
|
|
10d0529 |
This package contains unit tests for project
|
|
|
10d0529 |
providing packages with %{import_path} prefix.
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%prep
|
|
|
10d0529 |
%setup -q -n %{repo}-%{commit}
|
|
|
10d0529 |
|
|
|
10d0529 |
%build
|
|
|
10d0529 |
%install
|
|
|
10d0529 |
# source codes for building projects
|
|
|
10d0529 |
%if 0%{?with_devel}
|
|
|
10d0529 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
|
10d0529 |
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
|
|
|
10d0529 |
# find all *.go but no *_test.go files and generate devel.file-list
|
|
|
10d0529 |
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
|
|
|
10d0529 |
dirprefix=$(dirname $file)
|
|
|
10d0529 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
|
|
10d0529 |
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
|
10d0529 |
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
|
|
|
10d0529 |
|
|
|
10d0529 |
while [ "$dirprefix" != "." ]; do
|
|
|
10d0529 |
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
|
|
10d0529 |
dirprefix=$(dirname $dirprefix)
|
|
|
10d0529 |
done
|
|
|
10d0529 |
done
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
# testing files for this project
|
|
|
10d0529 |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
10d0529 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
|
10d0529 |
# find all *_test.go files and generate unit-test-devel.file-list
|
|
|
10d0529 |
for file in $(find . -iname "*_test.go") ; do
|
|
|
10d0529 |
dirprefix=$(dirname $file)
|
|
|
10d0529 |
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
|
|
10d0529 |
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
|
10d0529 |
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
|
|
|
10d0529 |
|
|
|
10d0529 |
while [ "$dirprefix" != "." ]; do
|
|
|
10d0529 |
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
|
|
10d0529 |
dirprefix=$(dirname $dirprefix)
|
|
|
10d0529 |
done
|
|
|
10d0529 |
done
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_devel}
|
|
|
10d0529 |
sort -u -o devel.file-list devel.file-list
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%check
|
|
|
10d0529 |
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
10d0529 |
%if ! 0%{?with_bundled}
|
|
|
10d0529 |
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
|
10d0529 |
%else
|
|
|
10d0529 |
# No dependency directories so far
|
|
|
10d0529 |
|
|
|
10d0529 |
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%if ! 0%{?gotest:1}
|
|
|
10d0529 |
%global gotest go test
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%gotest %{import_path}
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
#define license tag if not already defined
|
|
|
10d0529 |
%{!?_licensedir:%global license %doc}
|
|
|
10d0529 |
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_devel}
|
|
|
10d0529 |
%files devel -f devel.file-list
|
|
|
10d0529 |
%license LICENSE.md
|
|
|
10d0529 |
%doc README.md
|
|
|
10d0529 |
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
|
10d0529 |
%files unit-test-devel -f unit-test-devel.file-list
|
|
|
10d0529 |
%license LICENSE.md
|
|
|
10d0529 |
%doc README.md
|
|
|
10d0529 |
%endif
|
|
|
10d0529 |
|
|
|
10d0529 |
%changelog
|
|
|
fa22cf0 |
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2.gitad45545
|
|
|
fa22cf0 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
|
|
fa22cf0 |
|
|
|
10d0529 |
* Thu Jan 05 2017 Jan Chaloupka <jchaloup@redhat.com> - 0-0.1.gitad45545
|
|
|
10d0529 |
- First package for Fedora
|
|
|
10d0529 |
resolves: #1410394
|