File youki.spec of Package youki

#
# spec file for package youki
#
# 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/
#


Name:           youki
Version:        0.3.2
Release:        0
Summary:        Container runtime written in Rust
License:        Apache-2.0
URL:            https://github.com/containers/youki
Source0:        youki-%{version}.tar.gz
Source1:        vendor.tar.zst
BuildRequires:  cargo >= 1.77
BuildRequires:  cargo-packaging
BuildRequires:  zstd
BuildRequires:  libseccomp-devel


# error[E0412]: cannot find type `ucontext_t` in this scope
ExcludeArch:    ppc64le

%description
youki is an implementation of the OCI runtime-spec in Rust, similar to runc.

Here is why we are writing a new container runtime in Rust.

* Rust is one of the best languages to implement the oci-runtime spec. Many
  very nice container tools are currently written in Go. However, the container
  runtime requires the use of system calls, which requires a bit of special
  handling when implemented in Go. This is too tricky (e.g. namespaces(7),
  fork(2)); with Rust, it's not that tricky. And, unlike in C, Rust provides the
  benefit of memory safety. While Rust is not yet a major player in the container
  field, it has the potential to contribute a lot: something this project
  attempts to exemplify.

* youki has the potential to be faster and use less memory than runc, and
  therefore work in environments with tight memory usage requirements. Here is a
  simple benchmark of a container from creation to deletion.

  Runtime       Time (mean ± σ)         Range (min … max)
  youki         198.4 ms ± 52.1 ms      97.2 ms … 296.1 ms
  runc          352.3 ms ± 53.3 ms      248.3 ms … 772.2 ms
  crun          153.5 ms ± 21.6 ms      80.9 ms … 196.6 ms

* I have fun implementing this. In fact, this may be the most important.

%prep
%autosetup -p 1 -a 1
mkdir -p .cargo
rm -vf .cargo/config.toml

%build
%{cargo_build}

%install
install -D -d -m 0755 %{buildroot}%{_bindir}
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/%{name} %{buildroot}%{_bindir}/%{name}

# checks are disabled due to issues on OBS
# dbus is not available, hence the checks fail
# the part of the checks cannot be disabled
# https://github.com/containers/youki/issues/2767
%check
%{_builddir}/%{name}-%{version}/target/release/%{name} --version

%files
%doc README.md
%license LICENSE
%{_bindir}/%{name}

%changelog
openSUSE Build Service is sponsored by