Blame golang-github-danwakefield-fnmatch.spec

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