Update spec to match More Go packaging template.
This commit is contained in:
169
fzf.spec
169
fzf.spec
@@ -1,47 +1,16 @@
|
||||
# Generate devel rpm
|
||||
%global with_devel 0
|
||||
# Build project from bundled dependencies
|
||||
%global with_bundled 0
|
||||
# Build with debug info rpm
|
||||
%global with_debug 1
|
||||
# Run tests in check section
|
||||
%global with_check 1
|
||||
# Generate unit-test rpm
|
||||
%global with_unit_test 0
|
||||
%global goipath github.com/junegunn/fzf
|
||||
Version: 0.17.4
|
||||
|
||||
%if 0%{?with_debug}
|
||||
%global _dwz_low_mem_die_limit 0
|
||||
%else
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
|
||||
%global provider github
|
||||
%global provider_tld com
|
||||
%global project junegunn
|
||||
%global repo fzf
|
||||
# https://github.com/junegunn/fzf
|
||||
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
||||
%global import_path %{provider_prefix}
|
||||
%global commit f0fe79dd3bb4b782ad6040c970b4bfc818729f05
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
%global commitdate 20180609
|
||||
%global realver 0.17.4
|
||||
%gometa
|
||||
|
||||
Name: fzf
|
||||
Version: 0.17.4
|
||||
Release: 1%{?dist}
|
||||
Summary: A command-line fuzzy finder written in Go
|
||||
License: MIT
|
||||
URL: https://%{provider_prefix}
|
||||
Source0: https://%{provider_prefix}/archive/%{realver}/%{repo}-%{realver}.tar.gz
|
||||
URL: %{gourl}
|
||||
Source0: %{gosource}
|
||||
Source1: README.Fedora
|
||||
|
||||
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
|
||||
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
|
||||
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
||||
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
||||
|
||||
BuildRequires: golang(github.com/gdamore/tcell)
|
||||
BuildRequires: golang(github.com/gdamore/tcell/encoding)
|
||||
BuildRequires: golang(github.com/mattn/go-isatty)
|
||||
@@ -49,7 +18,6 @@ BuildRequires: golang(github.com/mattn/go-runewidth)
|
||||
BuildRequires: golang(github.com/mattn/go-shellwords)
|
||||
BuildRequires: golang(golang.org/x/crypto/ssh/terminal)
|
||||
|
||||
|
||||
%description
|
||||
fzf is a general-purpose command-line fuzzy finder.
|
||||
|
||||
@@ -57,64 +25,15 @@ It's an interactive Unix filter for command-line that can be used with any
|
||||
list; files, command history, processes, hostnames, bookmarks, git commits,
|
||||
etc.
|
||||
|
||||
%if 0%{?with_devel}
|
||||
%package -n golang-%{provider}-%{project}-%{repo}-devel
|
||||
Summary: %{summary}
|
||||
BuildArch: noarch
|
||||
|
||||
Requires: golang(github.com/gdamore/tcell)
|
||||
Requires: golang(github.com/gdamore/tcell/encoding)
|
||||
Requires: golang(github.com/mattn/go-isatty)
|
||||
Requires: golang(github.com/mattn/go-runewidth)
|
||||
Requires: golang(github.com/mattn/go-shellwords)
|
||||
Requires: golang(golang.org/x/crypto/ssh/terminal)
|
||||
|
||||
Provides: golang(%{import_path}/src) = %{version}-%{release}
|
||||
Provides: golang(%{import_path}/src/algo) = %{version}-%{release}
|
||||
Provides: golang(%{import_path}/src/tui) = %{version}-%{release}
|
||||
Provides: golang(%{import_path}/src/util) = %{version}-%{release}
|
||||
|
||||
%description -n golang-%{provider}-%{project}-%{repo}-devel
|
||||
%{summary}
|
||||
|
||||
This package contains library source intended for
|
||||
building other packages which use import path with
|
||||
%{import_path} prefix.
|
||||
%endif
|
||||
|
||||
%if 0%{?with_unit_test} && 0%{?with_devel}
|
||||
%package -n golang-%{provider}-%{project}-%{repo}-unit-test-devel
|
||||
Summary: Unit tests for %{name} package
|
||||
%if 0%{?with_check}
|
||||
#Here comes all BuildRequires: PACKAGE the unit tests
|
||||
#in %%check section need for running
|
||||
%endif
|
||||
|
||||
# test subpackage tests code from devel subpackage
|
||||
Requires: golang-%{provider}-%{project}-%{repo}-devel = %{version}-%{release}
|
||||
|
||||
%if 0%{?with_check} && ! 0%{?with_bundled}
|
||||
%endif
|
||||
|
||||
|
||||
%description -n golang-%{provider}-%{project}-%{repo}-unit-test-devel
|
||||
%{summary}
|
||||
|
||||
This package contains unit tests for project
|
||||
providing packages with %{import_path} prefix.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n %{repo}-%{realver}
|
||||
%gosetup -q
|
||||
cp %{SOURCE1} .
|
||||
|
||||
|
||||
%build
|
||||
mkdir -p src/%{provider}.%{provider_tld}/%{project}/
|
||||
ln -s $(pwd) src/%{provider}.%{provider_tld}/%{project}/%{repo}
|
||||
export GOPATH=$(pwd):%{gopath}
|
||||
|
||||
%gobuild -o bin/fzf %{import_path}
|
||||
%gobuildroot
|
||||
%gobuild -o bin/fzf %{goipath}
|
||||
|
||||
# Cleanup interpreters
|
||||
sed -i -e '/^#!\//, 1d' shell/completion.*
|
||||
@@ -146,67 +65,10 @@ install -Dpm0644 shell/completion.zsh %{buildroot}%{_datadir}/zsh/site-functions
|
||||
install -d %{buildroot}%{_datadir}/fzf/shell
|
||||
install -Dpm0644 shell/key-bindings.* %{buildroot}%{_datadir}/fzf/shell/
|
||||
|
||||
# source codes for building projects
|
||||
%if 0%{?with_devel}
|
||||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
||||
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
|
||||
# find all *.go but no *_test.go files and generate devel.file-list
|
||||
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go") ; do
|
||||
dirprefix=$(dirname $file)
|
||||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
||||
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
||||
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
|
||||
|
||||
while [ "$dirprefix" != "." ]; do
|
||||
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
||||
dirprefix=$(dirname $dirprefix)
|
||||
done
|
||||
done
|
||||
%endif
|
||||
|
||||
# testing files for this project
|
||||
%if 0%{?with_unit_test} && 0%{?with_devel}
|
||||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
||||
# find all *_test.go files and generate unit-test-devel.file-list
|
||||
for file in $(find . -iname "*_test.go") ; do
|
||||
dirprefix=$(dirname $file)
|
||||
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
|
||||
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
||||
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
|
||||
|
||||
while [ "$dirprefix" != "." ]; do
|
||||
echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
|
||||
dirprefix=$(dirname $dirprefix)
|
||||
done
|
||||
done
|
||||
%endif
|
||||
|
||||
%if 0%{?with_devel}
|
||||
sort -u -o devel.file-list devel.file-list
|
||||
%endif
|
||||
|
||||
%check
|
||||
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
|
||||
%if ! 0%{?with_bundled}
|
||||
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
||||
%else
|
||||
# No dependency directories so far
|
||||
%gochecks
|
||||
|
||||
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
||||
%endif
|
||||
|
||||
%if ! 0%{?gotest:1}
|
||||
%global gotest go test
|
||||
%endif
|
||||
|
||||
%gotest %{import_path}/src
|
||||
%gotest %{import_path}/src/algo
|
||||
%gotest %{import_path}/src/tui
|
||||
%gotest %{import_path}/src/util
|
||||
%endif
|
||||
|
||||
#define license tag if not already defined
|
||||
%{!?_licensedir:%global license %doc}
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
@@ -225,22 +87,11 @@ export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
||||
%{_datadir}/nvim/site/plugin/fzf.vim
|
||||
%{_sysconfdir}/bash_completion.d/fzf
|
||||
|
||||
%if 0%{?with_devel}
|
||||
%files -n golang-%{provider}-%{project}-%{repo}-devel -f devel.file-list
|
||||
%license LICENSE
|
||||
%doc README.md CHANGELOG.md
|
||||
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
|
||||
%endif
|
||||
|
||||
%if 0%{?with_unit_test} && 0%{?with_devel}
|
||||
%files -n golang-%{provider}-%{project}-%{repo}-unit-test-devel -f unit-test-devel.file-list
|
||||
%license LICENSE
|
||||
%doc README.md CHANGELOG.md
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jun 14 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.17.4-1
|
||||
- New upstream release.
|
||||
- Update spec based on More Go Programming template.
|
||||
|
||||
* Fri Mar 16 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.17.3-1
|
||||
- New upstream release.
|
||||
|
||||
Reference in New Issue
Block a user