Blame golang-github-howeyc-fsnotify.spec

6233f90
# Please use golang-github-go-fsnotify-fsnotify-devel
6233f90
# https://github.com/fsnotify/fsnotify
6233f90
%global   debug_package   %{nil}
6233f90
6233f90
%global   provider        github
6233f90
%global   provider_tld    com
6233f90
%global   project         howeyc
6233f90
%global   repo            fsnotify
6233f90
# https://github.com/howeyc/fsnotify
6233f90
%global   provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
6233f90
%global   import_path     %{provider_prefix}
6233f90
%global   commit          441bbc86b167f3c1f4786afae9931403b99fdacf
6233f90
%global   shortcommit     %(c=%{commit}; echo ${c:0:7})
6233f90
6233f90
Name:           golang-%{provider}-%{project}-%{repo}
6233f90
Version:        0.9.0
6233f90
Release:        0.1.git%{shortcommit}%{?dist}
6233f90
Summary:        File change notification Go language Binding.
6233f90
License:        BSD 3-clause
6233f90
URL:            https://%{provider_prefix}
6233f90
Source0:        %{url}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
6233f90
6233f90
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
6233f90
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
6233f90
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
6233f90
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
6233f90
6233f90
%description
6233f90
%{summary}.
6233f90
6233f90
%package devel
6233f90
Summary:        %{summary}
6233f90
BuildArch:      noarch
6233f90
Provides:       golang(%{import_path}) = %{version}-%{release}
6233f90
6233f90
%description devel
6233f90
%{summary}.
6233f90
6233f90
This package contains library source intended for
6233f90
building other packages which use import path with
6233f90
%{import_path} prefix.
6233f90
6233f90
%package unit-test-devel
6233f90
Summary:        Unit tests for %{name} package
6233f90
BuildArch:      noarch
6233f90
# test subpackage tests code from devel subpackage
6233f90
Requires:       %{name}-devel = %{version}-%{release}
6233f90
6233f90
%description unit-test-devel
6233f90
%{summary}.
6233f90
6233f90
This package contains unit tests for project
6233f90
providing packages with %{import_path} prefix.
6233f90
6233f90
6233f90
%prep
6233f90
%setup -q -n %{repo}-%{commit}
6233f90
6233f90
%build
6233f90
6233f90
%install
6233f90
# source codes for building projects
6233f90
install -d -p %{buildroot}%{gopath}/src/%{import_path}/
6233f90
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
6233f90
# find all *.go but no *_test.go files and generate devel.file-list
6233f90
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
6233f90
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
6233f90
    install -d -p %{buildroot}%{gopath}/src/%{import_path}/$(dirname $file)
6233f90
    cp -pav $file %{buildroot}%{gopath}/src/%{import_path}/$file
6233f90
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
6233f90
done
6233f90
6233f90
# testing files for this project
6233f90
install -d %{buildroot}%{gopath}/src/%{import_path}/
6233f90
# find all *_test.go files and generate unit-test.file-list
6233f90
for file in $(find . -iname "*_test.go"); do
6233f90
    dirprefix=$(dirname $file)
6233f90
    install -d -p %{buildroot}%{gopath}/src/%{import_path}/$dirprefix
6233f90
    cp -pav $file %{buildroot}%{gopath}/src/%{import_path}/$file
6233f90
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
6233f90
    while [ "$dirprefix" != "." ]; do
6233f90
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
6233f90
        dirprefix=$(dirname $dirprefix)
6233f90
    done
6233f90
done
6233f90
6233f90
sort -u -o devel.file-list devel.file-list
6233f90
sort -u -o unit-test-devel.file-list unit-test-devel.file-list
6233f90
6233f90
%check
6233f90
export GOPATH=%{buildroot}%{gopath}:%{gopath}
6233f90
6233f90
%if ! 0%{?gotest:1}
6233f90
%global gotest go test
6233f90
%endif
6233f90
6233f90
# Test fail
6233f90
#%%gotest %%{import_path}
6233f90
6233f90
%files devel -f devel.file-list
6233f90
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
6233f90
6233f90
%files unit-test-devel -f unit-test-devel.file-list
6233f90
6233f90
%changelog
6233f90
* Fri Aug 18 2017 mosquito <sensor.wen@gmail.com> - 0.9.0-0.1.git441bbc8
6233f90
- Rebuild
6233f90
6233f90
* Wed Dec 28 2016 Jaroslav <cz.guardian@gmail.com> Stepanek 0.9.0.1.git441bbc8
6233f90
- Initial package build