diff --git a/.gitignore b/.gitignore index 7a2de98..e7267fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/vgrep-*.tar.gz -/vgrep-*-vendor.tar.bz2 +vgrep-*.tar.gz diff --git a/sources b/sources index e798e83..d6d31f5 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ SHA512 (vgrep-2.8.0.tar.gz) = 1fbd674a7fddffede70a9d0715bf09359d48abf5c238cace43996a222e3e34ec73a7911f62b8476a2dcef40485ce192476067fd99d52b7fa0e7e3fe9297f461e -SHA512 (vgrep-2.8.0-vendor.tar.bz2) = 56eb03889e68439eb108124175708dc1b90ef9bd0d03a317baf1aade8bfc1a35c643d7d4c8a4108da50ea8ae3a4a9aeedcf9aa482bdf1cdfcdfde18bc095fb70 diff --git a/vgrep.spec b/vgrep.spec index 77008c5..f964bb4 100644 --- a/vgrep.spec +++ b/vgrep.spec @@ -1,69 +1,62 @@ -%bcond check 1 +# https://github.com/vrothberg/vgrep +%global goipath github.com/vrothberg/vgrep +Version: 2.8.0 -Name: vgrep -Version: 2.8.0 -Release: %autorelease -ExclusiveArch: %{golang_arches_future} -Summary: User-friendly pager for grep -License: Apache-2.0 AND BSD-3-Clause AND GPL-3.0-only AND MIT -URL: https://github.com/vrothberg/vgrep -Source0: %{url}/archive/v%{version}/vgrep-%{version}.tar.gz -Source1: vgrep-%{version}-vendor.tar.bz2 +%gometa -f -BuildRequires: go-rpm-macros -BuildRequires: go-vendor-tools -BuildRequires: askalono-cli -BuildRequires: go-md2man - - -%description +%global common_description %{expand: vgrep is a pager for grep, git-grep, ripgrep and similar grep implementations, and allows for opening the indexed file locations in a user-specified editor such as vim or emacs. vgrep is inspired by the ancient cgvg scripts but extended to perform further operations such as listing statistics of files and -directory trees or showing the context lines before and after the matches. +directory trees or showing the context lines before and after the matches.} +%global golicenses LICENSE +%global godocs README.md + +%bcond_without check + +Name: vgrep +Release: %autorelease +Summary: User-friendly pager for grep +License: GPL-3.0-only +URL: %{gourl} +Source: %{gosource} + +BuildRequires: go-md2man + +%description %{common_description} + +%gopkg %prep -%autosetup -a 1 +%goprep +%generate_buildrequires +%go_generate_buildrequires %build -# command -%global gomodulesmode GO111MODULE=on -export GO_LDFLAGS="-X main.version=%{version} " -%gobuild -o bin/vgrep . - -# manpage +export LDFLAGS="-X main.version=%{version} " +%gobuild -o %{gobuilddir}/bin/vgrep %{goipath} go-md2man -in docs/vgrep.1.md -out docs/vgrep.1 - %install -# licenses -%go_vendor_license_install +%gopkginstall +install -D -p -m 0755 %{gobuilddir}/bin/vgrep %{buildroot}%{_bindir}/vgrep +install -D -p -m 0644 docs/vgrep.1 %{buildroot}%{_mandir}/man1/vgrep.1 -# command -install -D -p -m 0755 -t %{buildroot}%{_bindir} bin/vgrep - -# manpage -install -D -p -m 0644 -t %{buildroot}%{_mandir}/man1 docs/vgrep.1 - - -%check -# license validation -%go_vendor_license_check - -# upstream tests %if %{with check} -%gocheck2 +%check +%gocheck %endif - -%files -f %{go_vendor_license_filelist} -%doc README.md +%files +%license %{golicenses} +%doc %{godocs} %{_bindir}/vgrep %{_mandir}/man1/vgrep.1* +%gopkgfiles %changelog %autochangelog