# $Id$ %global debug_package %{nil} %global commit d363963f9824b1e1127f4319f6e5c36e270b5bc4 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global gitrepo mikefarah Name: yq Version: 4.16.1 Release: 1%{?dist}.frs Summary: lightweight and portable command-line YAML processor License: MIT URL: https://mikefarah.gitbook.io/yq/ Source0: https://github.com/%{gitrepo}/%{name}/archive/refs/tags/v%{version}.tar.gz # BuildRequires: gcc BuildRequires: golang >= 1.11, git # pull in golang libraries by explicit import path, inside the meta golang() # BuildRequires: golang(github.com/gorilla/mux) >= 0-0.13 %description yq is a lightweight and portable command-line YAML processor. yq uses jq like syntax but works with yaml files as well as json. It doesn't yet support everything jq does - but it does support the most common operations and functions, and more is being added continuously. yq is written in go - so you can download a dependency free binary for your platform and you are good to go! If you prefer there are a variety of package managers that can be used as well as docker, all listed below. %prep %setup -q -n %{name}-%{version} # many golang binaries are "vendoring" (bundling) sources, so remove them. Those dependencies need to be packaged independently. rm -rf vendor %build # set up temporary build gopath, and put our directory there mkdir -p ./_build/src/github.com/%{gitrepo}/%{name} ln -s $(pwd) ./_build/src/github.com/%{gitrepo}/%{name}/app export GOPATH=$(pwd)/_build:%{gopath} export GO111MODULE=on %if 0%{?rhel} == 7 %ifarch x86_64 curl -L -o yq https://github.com/mikefarah/yq/releases/download/v%{version}/yq_linux_amd64 %endif %ifarch i386 curl -L -o yq https://github.com/mikefarah/yq/releases/download/v%{version}/yq_linux_386 %endif %else go build -o %{name} -v . %endif %install install -d %{buildroot}%{_bindir} install -p -m 0755 ./%{name} %{buildroot}%{_bindir}/%{name} %files %defattr(-,root,root,-) %doc CONTRIBUTING.md CODE_OF_CONDUCT.md LICENSE README.md %{_bindir}/%{name} %changelog * Tue Oct 19 2021 FRS Packager - 4.13.4-1 - First package, ready for COPR