Blame SPECS/gomtree.spec

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