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