Blame SPECS/gomtree.spec

2ed694
%if 0%{?fedora} || 0%{?rhel} == 6
2ed694
%global with_devel 1
2ed694
%global with_bundled 0
2ed694
%global with_debug 0
2ed694
%global with_check 1
2ed694
%global with_unit_test 1
2ed694
%else
2ed694
%global with_devel 0
2ed694
%global with_bundled 1
2ed694
%global with_debug 1
2ed694
%global with_check 0
2ed694
%global with_unit_test 0
2ed694
%endif
2ed694
2ed694
%if 0%{?with_debug}
2ed694
%global _dwz_low_mem_die_limit 0
2ed694
%else
2ed694
%global debug_package   %{nil}
2ed694
%endif
2ed694
2ed694
%if ! 0%{?gobuild:1}
2ed694
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
2ed694
%endif
2ed694
2ed694
%global provider        github
2ed694
%global provider_tld    com
2ed694
%global project         vbatts
2ed694
%global repo            go-mtree
2ed694
# https://github.com/vbatts/go-mtree
2ed694
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
2ed694
%global import_path     %{provider_prefix}
b9f8c8
%global commit          16da0f86ee549d8949775bf3d555e7921a9caca9
2ed694
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
2ed694
2ed694
Name:           gomtree
b9f8c8
Version:        0.5.0
b9f8c8
Release:        0.2.git%{shortcommit}%{?dist}
2ed694
Summary:        Go CLI tool for mtree support
2ed694
License:        BSD
2ed694
URL:            https://%{provider_prefix}
2ed694
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
2ed694
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
2ed694
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
2ed694
2ed694
%if ! 0%{?with_bundled}
2ed694
BuildRequires: golang(golang.org/x/crypto/ripemd160)
2ed694
%endif
2ed694
2ed694
%description
2ed694
%{summary}
2ed694
2ed694
%if 0%{?with_devel}
2ed694
%package devel
2ed694
Summary:       %{summary}
2ed694
BuildArch:     noarch
2ed694
2ed694
%if 0%{?with_check} && ! 0%{?with_bundled}
2ed694
BuildRequires: golang(golang.org/x/crypto/ripemd160)
2ed694
%endif
2ed694
2ed694
Requires:      golang(golang.org/x/crypto/ripemd160)
2ed694
2ed694
Provides:      golang(%{import_path}) = %{version}-%{release}
2ed694
Provides:      golang(%{import_path}/xattr) = %{version}-%{release}
2ed694
2ed694
%description devel
2ed694
%{summary}
2ed694
2ed694
This package contains library source intended for
2ed694
building other packages which use import path with
2ed694
%{import_path} prefix.
2ed694
%endif
2ed694
2ed694
%if 0%{?with_unit_test} && 0%{?with_devel}
2ed694
%package unit-test-devel
2ed694
Summary:         Unit tests for %{name} package
2ed694
%if 0%{?with_check}
2ed694
#Here comes all BuildRequires: PACKAGE the unit tests
2ed694
#in %%check section need for running
2ed694
%endif
2ed694
2ed694
# test subpackage tests code from devel subpackage
2ed694
Requires:        %{name}-devel = %{version}-%{release}
2ed694
2ed694
%description unit-test-devel
2ed694
%{summary}
2ed694
2ed694
This package contains unit tests for project
2ed694
providing packages with %{import_path} prefix.
2ed694
%endif
2ed694
2ed694
%prep
2ed694
%setup -q -n %{repo}-%{commit}
2ed694
2ed694
%build
2ed694
mkdir -p src/github.com/vbatts
2ed694
ln -s ../../../ src/github.com/vbatts/go-mtree
2ed694
2ed694
%if ! 0%{?with_bundled}
2ed694
export GOPATH=$(pwd):%{gopath}
2ed694
%else
2ed694
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
2ed694
%endif
2ed694
2ed694
%gobuild -o bin/%{name} %{import_path}/cmd/%{name}
2ed694
2ed694
%install
2ed694
install -d -p %{buildroot}%{_bindir}
2ed694
install -p -m 0755 bin/%{name} %{buildroot}%{_bindir}
2ed694
2ed694
# source codes for building projects
2ed694
%if 0%{?with_devel}
2ed694
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
2ed694
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
2ed694
# find all *.go but no *_test.go files and generate devel.file-list
2ed694
for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do
2ed694
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
2ed694
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
2ed694
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
2ed694
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
2ed694
done
2ed694
%endif
2ed694
2ed694
# testing files for this project
2ed694
%if 0%{?with_unit_test} && 0%{?with_devel}
2ed694
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
2ed694
# find all *_test.go files and generate unit-test.file-list
2ed694
for file in $(find . -iname "*_test.go"); do
2ed694
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
2ed694
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
2ed694
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
2ed694
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
2ed694
done
2ed694
%endif
2ed694
2ed694
%if 0%{?with_devel}
2ed694
sort -u -o devel.file-list devel.file-list
2ed694
%endif
2ed694
2ed694
%check
2ed694
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
2ed694
%if ! 0%{?with_bundled}
2ed694
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
2ed694
%else
2ed694
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
2ed694
%endif
2ed694
2ed694
%if ! 0%{?gotest:1}
2ed694
%global gotest go test
2ed694
%endif
2ed694
2ed694
#%%gotest %%{import_path}
2ed694
%gotest %{import_path}/xattr
2ed694
%endif
2ed694
2ed694
#define license tag if not already defined
2ed694
%{!?_licensedir:%global license %doc}
2ed694
2ed694
%files
2ed694
%license LICENSE
2ed694
%doc README.md
2ed694
%{_bindir}/%{name}
2ed694
2ed694
%if 0%{?with_devel}
2ed694
%files devel -f devel.file-list
2ed694
%license LICENSE
2ed694
%doc README.md
2ed694
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
2ed694
%endif
2ed694
2ed694
%if 0%{?with_unit_test} && 0%{?with_devel}
2ed694
%files unit-test-devel -f unit-test-devel.file-list
2ed694
%license LICENSE
2ed694
%doc README.md
2ed694
%endif
2ed694
2ed694
%changelog
b9f8c8
* Thu Feb 01 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.5.0-0.2.git16da0f8
b9f8c8
- rebase to 16da0f86ee549d8949775bf3d555e7921a9caca9
b9f8c8
2ed694
* Mon Dec 11 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.4.2-2.1
2ed694
- rebase to 0.4.2 - de69569d25a8611cfac834ac4801194bc352b448
2ed694
2ed694
* Wed Jul 12 2017 fkluknav <fkluknav@redhat.com> - 0.4.0-1.1
2ed694
- rebase to 0.4.0
2ed694
2ed694
* Mon Apr 03 2017 Lokesh Mandvekar <lsm5@redhat.com> - 0.3.1-2.1
2ed694
- build for all available arches on 7.4
2ed694
2ed694
* Tue Mar 21 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.3.1-2
2ed694
- golang arches: https://bugzilla.redhat.com/show_bug.cgi?id=1418480
2ed694
2ed694
* Mon Jan 23 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.3.1-1
2ed694
- Resolves: #1415321 - rebase to v0.3.1
2ed694
2ed694
* Wed Dec 14 2016 Lokesh Mandvekar 
2ed694
- Resolves: #1404402 - rebase to v0.3.0
2ed694
- built commit 58660bb
2ed694
2ed694
* Thu Oct 20 2016 Frantisek Kluknavsky <fkluknav@redhat.com> - 0-0.3.git8c6b32c
2ed694
- add debuginfo package (rpmdiff complains about unstripped binary)
2ed694
2ed694
* Mon Oct 03 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0-0.2.git8c6b32c
2ed694
- Resolves: #1380420 - import into Fedora
2ed694
- fix binary build step
2ed694
2ed694
* Thu Sep 29 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0-0.1.git8c6b32c
2ed694
- First package for Fedora