Blame golang-github-petermattis-goid.spec

a5fce12
# Generate devel rpm
a5fce12
%global with_devel 1
a5fce12
# Build project from bundled dependencies
a5fce12
%global with_bundled 0
a5fce12
# Build with debug info rpm
a5fce12
%global with_debug 0
a5fce12
# Run tests in check section
a5fce12
%global with_check 1
a5fce12
# Generate unit-test rpm
a5fce12
%global with_unit_test 1
a5fce12
a5fce12
%if 0%{?with_debug}
a5fce12
%global _dwz_low_mem_die_limit 0
a5fce12
%else
a5fce12
%global debug_package   %{nil}
a5fce12
%endif
a5fce12
a5fce12
%global provider        github
a5fce12
%global provider_tld    com
a5fce12
%global project         petermattis
a5fce12
%global repo            goid
a5fce12
# https://github.com/petermattis/goid
a5fce12
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
a5fce12
%global import_path     %{provider_prefix}
59f6c4e
%global commit          b0b1615b78e5ee59739545bb38426383b2cda4c9
a5fce12
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
59f6c4e
%global commitdate      20180202
a5fce12
a5fce12
a5fce12
Name:           golang-%{provider}-%{project}-%{repo}
a5fce12
Version:        0
c3540c5
Release:        0.9.%{commitdate}.git%{shortcommit}%{?dist}
a5fce12
Summary:        Programmatic retrieval of goroutine IDs
a5fce12
License:        ASL 2.0
a5fce12
URL:            https://%{provider_prefix}
2d860d0
Source0:        https://%{provider_prefix}/archive/%{commit}/%{project}-%{repo}-%{shortcommit}.tar.gz
a5fce12
a5fce12
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
a5fce12
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
a5fce12
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
a5fce12
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
a5fce12
a5fce12
%description
a5fce12
%{summary}
a5fce12
a5fce12
a5fce12
%if 0%{?with_devel}
a5fce12
%package        devel
a5fce12
Summary:        %{summary}
a5fce12
BuildArch:      noarch
a5fce12
a5fce12
Provides:       golang(%{import_path}) = %{version}-%{release}
a5fce12
a5fce12
%description    devel
a5fce12
%{summary}
a5fce12
a5fce12
This package contains library source intended for
a5fce12
building other packages which use import path with
a5fce12
%{import_path} prefix.
a5fce12
%endif
a5fce12
a5fce12
a5fce12
%if 0%{?with_unit_test} && 0%{?with_devel}
a5fce12
%package        unit-test-devel
a5fce12
Summary:        Unit tests for %{name} package
a5fce12
a5fce12
# test subpackage tests code from devel subpackage
a5fce12
Requires:       %{name}-devel = %{version}-%{release}
a5fce12
a5fce12
%description    unit-test-devel
a5fce12
%{summary}
a5fce12
a5fce12
This package contains unit tests for project
a5fce12
providing packages with %{import_path} prefix.
a5fce12
%endif
a5fce12
a5fce12
a5fce12
%prep
a5fce12
%setup -q -n %{repo}-%{commit}
a5fce12
a5fce12
a5fce12
%build
a5fce12
a5fce12
a5fce12
%install
a5fce12
# source codes for building projects
a5fce12
%if 0%{?with_devel}
a5fce12
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
a5fce12
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
a5fce12
a5fce12
# find all *.go but no *_test.go files and generate devel.file-list
a5fce12
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
a5fce12
    dirprefix=$(dirname $file)
a5fce12
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
a5fce12
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
a5fce12
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
a5fce12
a5fce12
    while [ "$dirprefix" != "." ]; do
a5fce12
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
a5fce12
        dirprefix=$(dirname $dirprefix)
a5fce12
    done
a5fce12
done
a5fce12
%endif
a5fce12
a5fce12
# testing files for this project
a5fce12
%if 0%{?with_unit_test} && 0%{?with_devel}
a5fce12
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
a5fce12
a5fce12
# find all *_test.go files and generate unit-test-devel.file-list
a5fce12
for file in $(find . -iname "*_test.go") ; do
a5fce12
    dirprefix=$(dirname $file)
a5fce12
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
a5fce12
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
a5fce12
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
a5fce12
a5fce12
    while [ "$dirprefix" != "." ]; do
a5fce12
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
a5fce12
        dirprefix=$(dirname $dirprefix)
a5fce12
    done
a5fce12
done
a5fce12
%endif
a5fce12
a5fce12
%if 0%{?with_devel}
a5fce12
sort -u -o devel.file-list devel.file-list
a5fce12
%endif
a5fce12
a5fce12
a5fce12
%check
a5fce12
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
a5fce12
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
a5fce12
a5fce12
%if ! 0%{?gotest:1}
a5fce12
%global gotest go test
a5fce12
%endif
a5fce12
a5fce12
%gotest %{import_path}
a5fce12
%endif
a5fce12
a5fce12
a5fce12
#define license tag if not already defined
a5fce12
%{!?_licensedir:%global license %doc}
a5fce12
a5fce12
a5fce12
%if 0%{?with_devel}
a5fce12
%files devel -f devel.file-list
a5fce12
%license LICENSE
a5fce12
%doc README.md
a5fce12
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
a5fce12
%endif
a5fce12
a5fce12
a5fce12
%if 0%{?with_unit_test} && 0%{?with_devel}
a5fce12
%files unit-test-devel -f unit-test-devel.file-list
a5fce12
%license LICENSE
a5fce12
%doc README.md
a5fce12
%endif
a5fce12
a5fce12
a5fce12
%changelog
c3540c5
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.9.20180202.gitb0b1615
c3540c5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
c3540c5
4278500
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.8.20180202.gitb0b1615
4278500
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
4278500
59f6c4e
* Mon Feb 05 2018 Fabio Valentini <decathorpe@gmail.com> - 0-0.7.20180202.gitb0b1615
59f6c4e
- Bump to commit b0b1615.
59f6c4e
9ee14db
* Tue Jan 09 2018 Fabio Valentini <decathorpe@gmail.com> - 0-0.6.git176e84a
9ee14db
- Bump to commit 176e84a.
9ee14db
dc56f79
* Tue Sep 05 2017 Fabio Valentini <decathorpe@gmail.com> - 0-0.5.git3db12eb
dc56f79
- Bump to commit 3db12eb.
dc56f79
2d860d0
* Sat Aug 05 2017 Fabio Valentini <decathorpe@gmail.com> - 0-0.4.git0ded858
2d860d0
- Bump to commit 0ded858, which adds support for go 1.9.
2d860d0
87009c3
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.3.gitcaab644
87009c3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
87009c3
002da10
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2.gitcaab644
002da10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
002da10
a5fce12
* Wed Mar 01 2017 Fabio Valentini <decathorpe@gmail.com> - 0-0.1.gitcaab644
a5fce12
- First package for Fedora
a5fce12