File oci-seccomp-bpf-hook.spec of Package oci-seccomp-bpf-hook

#
# spec file for package oci-seccomp-bpf-hook
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global provider_url github.com
%global project containers
%global repo oci-seccomp-bpf-hook
Name:           oci-seccomp-bpf-hook
Version:        1.2.10
Release:        0
Summary:        OCI hook based on EBPF to generate seccomp profile for container
License:        Apache-2.0
URL:            https://%{provider_url}/%{project}/%{repo}
Source:         %{url}/archive/v%{version}.tar.gz
BuildRequires:  bcc-devel
BuildRequires:  bcc-tools
BuildRequires:  git
BuildRequires:  go
BuildRequires:  go-md2man
BuildRequires:  libseccomp-devel
BuildRequires:  make
BuildRequires:  podman

%description
An OCI hook based on EBPF to trace syscalls and generate seccomp profile used by container

This package provides a library for applications looking to use the Container Pod concept popularized by Kubernetes.

%package tests
Summary:        Tests for %{name}
Requires:       %{name} = %{version}-%{release}
Requires:       bats
Requires:       podman
BuildArch:      noarch

%description tests
An OCI hook based on EBPF to trace syscalls and generate seccomp profile used by container

This package provides system tests for %{name}

%prep
%autosetup -Sgit -n %{name}-%{version}

%build
# To satisfy the Go test called in the check section below
mkdir _output
pushd _output
mkdir -p src/%{provider_url}/%{project}
ln -s ../../../../ src/%{provider_url}/%{project}/%{repo}
popd
ln -s vendor src

export GOPATH=$(pwd)/_output:$(pwd):$(pwd):$GOPATH
sed -i 's;\(\$(GO_BUILD).*\$(OSBH_VERSION)\"\);\1 -buildmode=pie;' Makefile
%make_build

%install
%make_install PREFIX=%{_prefix}

#To eliminate the rmplint complain of using 'env' as interpreter
sed -i 's;#!/usr/bin/env ;#!/usr/bin/;g' test/*.{bats,sh}

install -d -p %{buildroot}/%{_datadir}/%{name}/test/system
cp -pav test/. %{buildroot}/%{_datadir}/%{name}/test/system
chmod 755 %{buildroot}/%{_datadir}/%{name}/test/system/*.bats

%check
%make_build test-unit

%files
%license LICENSE
%doc README.md
%if 0%{?suse_version} == 1500 && 0%{?is_opensuse}
%dir %{_prefix}/libexec
%endif
%dir %{_prefix}/libexec/oci
%dir %{_prefix}/libexec/oci/hooks.d
%{_prefix}/libexec/oci/hooks.d/%{name}
%{_datadir}/containers/oci/hooks.d/%{name}.json
%{_mandir}/man1/%{name}.1%{?ext_man}

%files tests
%license LICENSE
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/test

%changelog
openSUSE Build Service is sponsored by