20a89e
%global with_check 0
20a89e
20a89e
%global _find_debuginfo_dwz_opts %{nil}
20a89e
%global _dwz_low_mem_die_limit 0
20a89e
20a89e
# https://bugzilla.redhat.com/show_bug.cgi?id=1904567
20a89e
%global _lto_cflags %%{nil}
20a89e
20a89e
%if 0%{?rhel} > 7 && ! 0%{?fedora}
20a89e
%define gobuild(o:) \
20a89e
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v %{?**};
20a89e
%else
20a89e
%if ! 0%{?gobuild:1}
20a89e
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -linkmode=external -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v %{?**};
20a89e
%endif
20a89e
%endif
20a89e
20a89e
%global provider github
20a89e
%global provider_tld com
20a89e
%global project containers
20a89e
%global repo oci-seccomp-bpf-hook
20a89e
# https://github.com/containers/oci-seccomp-bpf-hook
20a89e
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
20a89e
%global import_path %{provider_prefix}
20a89e
%global git0 https://%{provider}.%{provider_tld}/%{project}/%{repo}
20a89e
20a89e
# https://fedoraproject.org/wiki/PackagingDrafts/Go#Go_Language_Architectures
20a89e
ExclusiveArch: %{go_arches}
20a89e
20a89e
Name: oci-seccomp-bpf-hook
20a89e
Version: 1.2.3
20a89e
Release: 2%{?dist}
20a89e
Summary: OCI Hook to generate seccomp json files based on EBF syscalls used by container
20a89e
License: ASL 2.0
20a89e
URL: %{git0}
20a89e
Source0: %{git0}/archive/v%{version}.tar.gz
20a89e
BuildRequires: golang
20a89e
BuildRequires: go-md2man
20a89e
BuildRequires: glib2-devel
20a89e
BuildRequires: glibc-devel
20a89e
BuildRequires: bcc-devel
20a89e
BuildRequires: git
20a89e
BuildRequires: gpgme-devel
20a89e
BuildRequires: libseccomp-devel
20a89e
BuildRequires: make
20a89e
Conflicts: crun < 0.17
20a89e
Enhances: podman
20a89e
Enhances: cri-o
20a89e
20a89e
%description
20a89e
%{summary}
20a89e
%{repo} provides a library for applications looking to use
20a89e
the Container Pod concept popularized by Kubernetes.
20a89e
20a89e
%prep
20a89e
%autosetup -Sgit
20a89e
sed -i '/$(MAKE) -C docs install/d' Makefile
20a89e
sed -i 's/HOOK_BIN_DIR/\%{_usr}\/libexec\/oci\/hooks.d/' %{name}.json
20a89e
sed -i '/$(HOOK_DIR)\/%{name}.json/d' Makefile
20a89e
20a89e
%build
20a89e
export GO111MODULE=off
20a89e
export GOPATH=$(pwd):$(pwd)/_build
20a89e
export CGO_CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
20a89e
20a89e
mkdir _build
20a89e
pushd _build
20a89e
mkdir -p src/%{provider}.%{provider_tld}/%{project}
20a89e
ln -s ../../../../ src/%{import_path}
20a89e
popd
20a89e
ln -s vendor src
20a89e
20a89e
export GOPATH=$(pwd)/_build:$(pwd)
20a89e
export LDFLAGS="-X main.version=%{version}"
20a89e
%gobuild -o bin/%{name} %{import_path}
20a89e
20a89e
pushd docs
20a89e
go-md2man -in %{name}.md -out %{name}.1
20a89e
popd
20a89e
20a89e
%install
20a89e
%{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install-nobuild
20a89e
%{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} GOMD2MAN=go-md2man -C docs install-nobuild
20a89e
20a89e
%check
20a89e
%if 0%{?with_check}
20a89e
# Since we aren't packaging up the vendor directory we need to link
20a89e
# back to it somehow. Hack it up so that we can add the vendor
20a89e
# directory from BUILD dir as a gopath to be searched when executing
20a89e
# tests from the BUILDROOT dir.
20a89e
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
20a89e
20a89e
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
20a89e
20a89e
%if ! 0%{?gotest:1}
20a89e
%global gotest go test
20a89e
%endif
20a89e
20a89e
%gotest %{import_path}/src/%{name}
20a89e
%endif
20a89e
20a89e
#define license tag if not already defined
20a89e
%{!?_licensedir:%global license %doc}
20a89e
20a89e
%files
20a89e
%license LICENSE
20a89e
%doc README.md
20a89e
%dir %{_libexecdir}/oci/hooks.d
20a89e
%{_libexecdir}/oci/hooks.d/%{name}
20a89e
%{_datadir}/containers/oci/hooks.d/%{name}.json
20a89e
%{_mandir}/man1/%{name}.1*
20a89e
20a89e
%changelog
20a89e
* Wed May 26 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.3-2
20a89e
- convert crun dependency to a conflict
20a89e
20a89e
* Wed May 19 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.3-1
20a89e
- update to
20a89e
  https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.2.3
20a89e
20a89e
* Fri Feb 19 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.1-1
20a89e
- update to
20a89e
  https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.2.1
20a89e
- require crun >= 0.17
20a89e
20a89e
* Thu Jan 28 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.0-6
20a89e
- revert back to 1.2.0 due to build issues
20a89e
20a89e
* Thu Jan 28 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.1-1
20a89e
- update to
20a89e
  https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.2.1
20a89e
20a89e
* Tue Dec 08 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-5
20a89e
- use go_arches macro
20a89e
20a89e
* Fri Oct 02 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-4
20a89e
- use the same arch definitions as present in the bcc package
20a89e
20a89e
* Fri Oct 02 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-3
20a89e
- exclude also armv7hl arch as bcc is not built there
20a89e
20a89e
* Wed Sep 30 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-2
20a89e
- fix spec file to accommodate the new upstream release
20a89e
20a89e
* Wed Sep 30 2020 Jindrich Novy <jnovy@redhat.com> - 1.2.0-1
20a89e
- update to
20a89e
  https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.2.0
20a89e
20a89e
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-3
20a89e
- Second attempt - Rebuilt for
20a89e
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
20a89e
20a89e
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-2
20a89e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
20a89e
20a89e
* Fri Jul 17 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.1-1
20a89e
- update to
20a89e
  https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.1.1
20a89e
20a89e
* Fri Jul 17 2020 Jindrich Novy <jnovy@redhat.com> - 1.1.0-2
20a89e
- switch to mainline releases
20a89e
20a89e
* Tue May 19 2020 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-1.1.git05a82a1
20a89e
- bump version
20a89e
- reuse Makefile targets
20a89e
20a89e
* Mon Feb 17 2020 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.0.1-0.6.gitba7bbb16
20a89e
- Resolves: #1799105 - solve ftbfs and build latest upstream commit
20a89e
20a89e
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.1-0.5.git3baa603a
20a89e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
20a89e
20a89e
* Tue Nov 05 2019 Jindrich Novy <jnovy@redhat.com> - 0.0.1-0.4.git3baa603a
20a89e
- limit arches to only those supported by bcc so that this can be built
20a89e
20a89e
* Mon Nov 04 2019 Jindrich Novy <jnovy@redhat.com> - 0.0.1-0.3.git3baa603a
20a89e
- fix the license - should be ASL 2.0
20a89e
- use %%gobuild
20a89e
20a89e
* Mon Nov 04 2019 Jindrich Novy <jnovy@redhat.com> - 0.0.1-0.2.git3baa603a
20a89e
- pull in golang deps as BR
20a89e
20a89e
* Mon Sep 23 2019 Jindrich Novy <jnovy@redhat.com> - 0.0.1-0.1.git3baa603a
20a89e
- fix spec file and build
20a89e
20a89e
* Sun Sep 22 2019 Dan Walsh <dwalsh@redhat.com> - 0.0.1
20a89e
- Initial Version