b20254
%global with_devel 0
b20254
%global with_bundled 1
b20254
%global with_debug 1
b20254
%global with_check 0
b20254
%global with_unit_test 0
b20254
b20254
%if 0%{?with_debug}
b20254
%global _find_debuginfo_dwz_opts %{nil}
b20254
%global _dwz_low_mem_die_limit 0
b20254
%else
b20254
%global debug_package   %{nil}
b20254
%endif
b20254
b20254
%if 0%{?rhel} > 7 && ! 0%{?fedora}
b20254
%define gobuild(o:) \
b20254
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};
b20254
%endif
b20254
b20254
%global provider github
b20254
%global provider_tld com
b20254
%global project containers
b20254
%global repo oci-seccomp-bpf-hook
b20254
# https://github.com/containers/oci-seccomp-bpf-hook
b20254
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
b20254
%global import_path %{provider_prefix}
b20254
%global git0 https://%{provider}.%{provider_tld}/%{project}/%{repo}
b20254
b20254
# bcc is not built for i686
b20254
ExcludeArch: i686
b20254
b20254
Name: oci-seccomp-bpf-hook
b20254
Version: 1.1.1
b20254
Release: 1%{?dist}
b20254
Summary: OCI Hook to generate seccomp json files based on EBF syscalls used by container
b20254
License: ASL 2.0
b20254
URL: %{git0}
b20254
Source0: %{git0}/archive/v%{version}.tar.gz
b20254
BuildRequires: golang
b20254
BuildRequires: go-md2man
b20254
BuildRequires: glib2-devel
b20254
BuildRequires: glibc-devel
b20254
BuildRequires: bcc-devel
b20254
BuildRequires: git
b20254
BuildRequires: gpgme-devel
b20254
BuildRequires: libseccomp-devel
b20254
BuildRequires: make
b20254
Enhances: podman
b20254
Enhances: cri-o
b20254
b20254
%description
b20254
%{summary}
b20254
%{repo} provides a library for applications looking to use
b20254
the Container Pod concept popularized by Kubernetes.
b20254
b20254
%prep
b20254
%autosetup -Sgit
b20254
sed -i '/$(MAKE) -C docs install/d' Makefile
b20254
sed -i 's/HOOK_BIN_DIR/\%{_usr}\/libexec\/oci\/hooks.d/' %{name}.json
b20254
sed -i '/$(HOOK_DIR)\/%{name}.json/d' Makefile
b20254
b20254
%build
b20254
export GO111MODULE=off
b20254
export GOPATH=$(pwd):$(pwd)/_build
b20254
b20254
mkdir _build
b20254
pushd _build
b20254
mkdir -p src/%{provider}.%{provider_tld}/%{project}
b20254
ln -s ../../../../ src/%{import_path}
b20254
popd
b20254
ln -s vendor src
b20254
b20254
export GOPATH=$(pwd)/_build:$(pwd)
b20254
%gobuild -o bin/%{name} %{import_path}
b20254
b20254
pushd docs
b20254
go-md2man -in %{name}.md -out %{name}.1
b20254
popd
b20254
b20254
%install
b20254
# install binary
b20254
%{__make} PREFIX=%{buildroot}%{_usr} ETCDIR=%{buildroot}%{_sysconfdir} OCI-SECCOMP-BPF_VERSION=%{version} install
b20254
b20254
# install %%{name}.json to /usr/share/containers/oci/hooks.d
b20254
install -dp %{buildroot}%{_datadir}/containers/oci/hooks.d
b20254
install -m 0644 %{name}.json %{buildroot}%{_datadir}/containers/oci/hooks.d
b20254
b20254
# install manpage
b20254
install -dp %{buildroot}%{_mandir}/man1
b20254
install -m 0644 docs/%{name}.1 %{buildroot}/%{_mandir}/man1
b20254
b20254
%check
b20254
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
b20254
# Since we aren't packaging up the vendor directory we need to link
b20254
# back to it somehow. Hack it up so that we can add the vendor
b20254
# directory from BUILD dir as a gopath to be searched when executing
b20254
# tests from the BUILDROOT dir.
b20254
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
b20254
b20254
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
b20254
b20254
%if ! 0%{?gotest:1}
b20254
%global gotest go test
b20254
%endif
b20254
b20254
%gotest %{import_path}/src/%{name}
b20254
%endif
b20254
b20254
#define license tag if not already defined
b20254
%{!?_licensedir:%global license %doc}
b20254
b20254
%files
b20254
%license LICENSE
b20254
%doc README.md
b20254
%dir %{_libexecdir}/oci/hooks.d
b20254
%{_libexecdir}/oci/hooks.d/%{name}
b20254
%{_datadir}/containers/oci/hooks.d/%{name}.json
b20254
%{_mandir}/man1/%{name}.1*
b20254
b20254
%changelog
b20254
* Thu Jun 18 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.1-1
b20254
- update to https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.1.1
b20254
- Related: #1821193
b20254
b20254
* Tue May 12 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.0-2
b20254
- exclude i686 arch as bcc, the build dependency is not built
b20254
  for it
b20254
- Related: #1821193
b20254
b20254
* Tue May 12 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.0-1
b20254
- initial build for container-tools-rhel8
b20254
- Related: #1821193