# Generated by go2rpm 1 %bcond_without check # https://github.com/open-policy-agent/opa %global goipath github.com/open-policy-agent/opa Version: 0.18.0 %gometa %global common_description %{expand: An open source, general-purpose policy engine. The Open Policy Agent (OPA) is an open source, general-purpose policy engine that enables unified, context-aware policy enforcement across the entire stack.} %global golicenses LICENSE %global godocs docs/content CHANGELOG.md README.md MAINTAINERS.md\\\ ADOPTERS.md CODE_OF_CONDUCT.md CONTRIBUTING.md\\\ GOVERNANCE.md SECURITY.md Name: open-policy-agent Release: 1%{?dist} Summary: Open source, general-purpose policy engine # Upstream license specification: Apache-2.0 License: ASL 2.0 URL: %{gourl} Source0: %{gosource} # Fix url error checking for go 1.14 Patch0: https://github.com/open-policy-agent/opa/pull/2264.patch#/0001-Fix-URL-error-checking-go1-14.patch # Add man pages generation - light version of https://github.com/open-policy-agent/opa/pull/2273 Patch1: 0001-Add-man-pages-generation.patch BuildRequires: golang(github.com/fsnotify/fsnotify) BuildRequires: golang(github.com/ghodss/yaml) BuildRequires: golang(github.com/gobwas/glob) BuildRequires: golang(github.com/gorilla/mux) BuildRequires: golang(github.com/olekukonko/tablewriter) BuildRequires: golang(github.com/OneOfOne/xxhash) BuildRequires: golang(github.com/peterh/liner) BuildRequires: golang(github.com/pkg/errors) BuildRequires: golang(github.com/prometheus/client_golang/prometheus) BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promhttp) BuildRequires: golang(github.com/rcrowley/go-metrics) BuildRequires: golang(github.com/sirupsen/logrus) BuildRequires: golang(github.com/spf13/cobra) BuildRequires: golang(github.com/spf13/pflag) BuildRequires: golang(github.com/yashtewari/glob-intersection) %if %{with check} # Tests BuildRequires: golang(gopkg.in/yaml.v2) %endif %description %{common_description} %gopkg %prep %goprep %autopatch -p1 find . -name "*.go" -exec sed -i "s|gopkg.in/fsnotify.v1|github.com/fsnotify/fsnotify|" "{}" +; %build %gobuild -o %{gobuilddir}/bin/generate-man %{goipath}/build/generate-man export LDFLAGS="-X %{goipath}/version.Version=%{version} " %gobuild -o %{gobuilddir}/bin/opa %{goipath} mkdir _man %{gobuilddir}/bin/generate-man _man rm %{gobuilddir}/bin/generate-man %install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ install -d -p -m 0755 %{buildroot}%{_mandir}/man1 install -D -p -m 0644 _man/* %{buildroot}%{_mandir}/man1/ %if %{with check} %check %gocheck -d topdown %endif %files %license LICENSE %doc docs/content CHANGELOG.md README.md MAINTAINERS.md ADOPTERS.md CODE_OF_CONDUCT.md %doc CONTRIBUTING.md GOVERNANCE.md SECURITY.md %{_mandir}/man1/opa*.1* %{_bindir}/* %gopkgfiles %changelog * Tue Apr 07 08:15:00 CEST 2020 Olivier Lemasle - 0.18.0-1 - Initial package