Blob Blame History Raw
# Generated by go2rpm 1.6.0
%bcond_with bootstrap
%if %{without bootstrap}
%bcond_without check
%else
%bcond_with check
%endif

# https://github.com/containernetworking/cni
%global goipath         github.com/containernetworking/cni
Version:                1.1.1

%gometa

# Workaround cyclical dependency on github.com/containernetworking/plugins.
%if %{without bootstrap}
%global goipaths0       %{goipath}
%global goipathsex0    %{goipath}/plugins/debug
%global godevelheader0  %{expand:
# Obsolete version before the split of %%{goipath}/plugins/debug
Obsoletes:      golang-github-containernetworking-cni-devel < 1.1.0-1}
%endif

%global goipaths1       %{goipath}/plugins/debug
%global godevelheader1  %{expand:
# Obsolete version before the split of %%{goipath}/plugins/debug
Obsoletes:      golang-github-containernetworking-cni-devel < 1.1.0-1}

%global common_description %{expand:
Container Network Interface - networking for Linux containers.}

%global golicenses      LICENSE
%global godocs          GOVERNANCE.md README.md CONTRIBUTING.md CODE-OF-\\\
                        CONDUCT.md CONVENTIONS.md RELEASING.md SPEC.md\\\
                        ROADMAP.md cnitool-README.md Documentation/cnitool.md\\\
                        Documentation/spec-upgrades.md\\\
                        plugins-debug-README.md

Name:           %{goname}
Release:        %autorelease
Summary:        Container Network Interface - networking for Linux containers

# Upstream license specification: Apache-2.0
License:        ASL 2.0
URL:            %{gourl}
Source0:        %{gosource}

%description
%{common_description}

%gopkg

%prep
%goprep
%autopatch -p1

%generate_buildrequires
%go_generate_buildrequires

%build
%gobuild -o %{gobuilddir}/bin/cnitool %{goipath}/cnitool

%install
%gopkginstall
install -m 0755 -vd                           %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/cnitool %{buildroot}%{_bindir}/

# Prevent README filename clashes
mv plugins/debug/README.md plugins-debug-README.md
mv cnitool/README.md cnitool-README.md

%if %{with check}
%check
# Disable tests that require `go mod` functionality
rm -vf libcni/backwards_compatibility_test.go pkg/invoke/get_version_integration_test.go
%gocheck -d pkg/version/testhelpers
%endif

%files
%license LICENSE
%doc GOVERNANCE.md README.md CONTRIBUTING.md CODE-OF-CONDUCT.md CONVENTIONS.md
%doc RELEASING.md SPEC.md ROADMAP.md cnitool-README.md Documentation/cnitool.md
%doc Documentation/spec-upgrades.md plugins-debug-README.md
%{_bindir}/cnitool

%gopkgfiles

%changelog
%autochangelog