Sync from SUSE:ALP:Source:Standard:1.0 criu revision bac26ba49d10223ccbb5ee080a3a072d

This commit is contained in:
Adrian Schröter 2023-11-17 11:16:26 +01:00
commit 04a6fcdc82
9 changed files with 1758 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,42 @@
From 95191250537d1cd872668647da76234241f16661 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 1 Dec 2020 16:32:19 +0100
Subject: [PATCH] Fix build with nftables installed in different directory
The cflags needs to be passed to the build test.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
Makefile.config | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/Makefile.config
+++ b/Makefile.config
@@ -38,13 +38,16 @@ else
endif
ifeq ($(call pkg-config-check,libnftables),y)
+ CFLAGS_NFTABLES := $(shell $(PKG_CONFIG) --cflags libnftables)
LIB_NFTABLES := $(shell $(PKG_CONFIG) --libs libnftables)
- ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(LIB_NFTABLES)),true)
+ ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(CFLAGS_NFTABLES) $(LIB_NFTABLES)),true)
LIBS_FEATURES += $(LIB_NFTABLES)
FEATURE_DEFINES += -DCONFIG_HAS_NFTABLES_LIB_API_0
- else ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_1),$(LIB_NFTABLES)),true)
+ FEATURE_CFLAGS += $(CFLAGS_NFTABLES)
+ else ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_1),$(CFLAGS_NFTABLES) $(LIB_NFTABLES)),true)
LIBS_FEATURES += $(LIB_NFTABLES)
FEATURE_DEFINES += -DCONFIG_HAS_NFTABLES_LIB_API_1
+ FEATURE_CFLAGS += $(CFLAGS_NFTABLES)
else
$(warning Warn: you have libnftables installed but it has incompatible API)
$(warning Warn: Building without nftables support)
@@ -75,7 +78,7 @@ endif
endif
export DEFINES += $(FEATURE_DEFINES)
-export CFLAGS += $(FEATURE_DEFINES)
+export CFLAGS += $(FEATURE_DEFINES) $(FEATURE_CFLAGS)
FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \
SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW MEMFD_CREATE \

BIN
criu-3.18.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,28 @@
---
plugins/amdgpu/Makefile | 3 ++-
plugins/amdgpu/kfd_ioctl.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
--- a/plugins/amdgpu/Makefile
+++ b/plugins/amdgpu/Makefile
@@ -5,7 +5,8 @@ PLUGIN_SOBJ := amdgpu_plugin.so
PLUGIN_INCLUDE := -iquote../../include
PLUGIN_INCLUDE += -iquote../../criu/include
PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/
-PLUGIN_INCLUDE += -iquote../../
+PLUGIN_INCLUDE += -iquote../../include
+PLUGIN_INCLUDE += -iquote../..
COMPEL := ../../compel/compel-host
LIBDRM_INC := -I/usr/include/libdrm
--- a/plugins/amdgpu/kfd_ioctl.h
+++ b/plugins/amdgpu/kfd_ioctl.h
@@ -23,7 +23,7 @@
#ifndef KFD_IOCTL_H_INCLUDED
#define KFD_IOCTL_H_INCLUDED
-#include <drm/drm.h>
+#include <libdrm/drm.h>
#include <linux/ioctl.h>
/*

View File

@ -0,0 +1,12 @@
---
scripts/criu-ns | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/scripts/criu-ns
+++ b/scripts/criu-ns
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
import ctypes
import ctypes.util
import errno

56
criu-py-install-fix.diff Normal file
View File

@ -0,0 +1,56 @@
---
lib/Makefile | 7 ++++++-
scripts/crit-setup.py | 25 +++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,6 +2,10 @@ CRIU_SO := libcriu.so
CRIU_A := libcriu.a
UAPI_HEADERS := lib/c/criu.h images/rpc.proto images/rpc.pb-c.h criu/include/version.h
+#
+# File to keep track of files installed by setup.py
+CRIT_SETUP_FILES := lib/.crit-setup.files
+
all-y += lib-c lib-a lib-py
#
@@ -56,7 +60,8 @@ install: lib-c lib-a lib-py crit/crit li
$(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
ifeq ($(PYTHON),python3)
$(E) " INSTALL " crit
- $(Q) $(PYTHON) -m pip install --upgrade --force-reinstall --prefix=$(DESTDIR)$(PREFIX) ./crit
+ # $(Q) $(PYTHON) -m pip install --upgrade --force-reinstall --prefix=$(DESTDIR)$(PREFIX) ./crit
+ $(Q) $(PYTHON) scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) --record $(CRIT_SETUP_FILES)
endif
.PHONY: install
--- /dev/null
+++ b/scripts/crit-setup.py
@@ -0,0 +1,25 @@
+import os
+from distutils.core import setup
+
+criu_version = "0.0.1"
+env = os.environ
+
+if 'CRIU_VERSION_MAJOR' in env and 'CRIU_VERSION_MINOR' in env:
+ criu_version = '{}.{}'.format(
+ env['CRIU_VERSION_MAJOR'],
+ env['CRIU_VERSION_MINOR']
+ )
+
+ if 'CRIU_VERSION_SUBLEVEL' in env and env['CRIU_VERSION_SUBLEVEL']:
+ criu_version += '.' + env['CRIU_VERSION_SUBLEVEL']
+
+setup(name="crit",
+ version=criu_version,
+ description="CRiu Image Tool",
+ author="CRIU team",
+ author_email="criu@openvz.org",
+ license="GPLv2",
+ url="https://github.com/checkpoint-restore/criu",
+ package_dir={'pycriu': 'lib/py'},
+ packages=["pycriu", "pycriu.images"],
+ scripts=["crit/crit"])

1345
criu.changes Normal file

File diff suppressed because it is too large Load Diff

206
criu.spec Normal file
View File

@ -0,0 +1,206 @@
#
# spec file for package criu
#
# Copyright (c) 2023 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/
#
%if 0%{?suse_version} >= 1330
%define use_asciidoctor 1
%define make_options USE_ASCIIDOCTOR=1
%endif
# currently broken with LTO, resulting in segfaults (bsc#1203854)
%define _lto_cflags %{nil}
%ifarch x86_64 aarch64
%define with_amdgpu_plugin 1
%else
%define with_amdgpu_plugin 0
%endif
%define proto_c_ver %(protoc-c --version | head -1 | awk '{print $2}')
Name: criu
Version: 3.18
Release: 0
Summary: Checkpoint/Restore In Userspace Tools
License: GPL-2.0-only
Group: System/Console
URL: https://criu.org/
Source0: http://github.com/checkpoint-restore/criu/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch1: criu-py-install-fix.diff
Patch2: 0002-Fix-build-with-nftables-installed-in-different-direc.patch
Patch3: criu-amdgpu-plugin-fix.patch
Patch4: plugin-dir-path.patch
Patch5: criu-ns-python3-shebang.patch
BuildRequires: libcap-devel
%if %{with_amdgpu_plugin}
BuildRequires: libdrm-devel
%endif
BuildRequires: libgnutls-devel
BuildRequires: libnet-devel
BuildRequires: libnl3-devel
BuildRequires: pkgconfig
BuildRequires: protobuf-c
BuildRequires: protobuf-devel
BuildRequires: python3-devel
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150300
BuildRequires: nftables-devel
%endif
%if 0%{?use_asciidoctor}
BuildRequires: rubygem(asciidoctor)
%else
BuildRequires: asciidoc
BuildRequires: xmlto
%endif
Requires: python3-ipaddr
Requires: python3-protobuf
ExclusiveArch: x86_64 aarch64 ppc64le armv7l armv7hl s390x
%if 0%{?suse_version} > 1320
BuildRequires: libbsd-devel
%endif
%description
Checkpoint/Restore In Userspace, or CRIU, is a software tool for Linux
operating system. Using this tool, you can freeze a running application
(or part of it) and checkpoint it to a hard drive as a collection of
files. You can then use the files to restore and run the application from
the point it was frozen at.
%if %{with_amdgpu_plugin}
%package plugin-amdgpu
Summary: AMDGPU plugin for CRIU
License: GPL-2.0-only
Group: System/Console
Requires: %{name} = %{version}
%description plugin-amdgpu
This package contains the AMDGPU ROCm support plugin for CRIU.
%endif
%package -n libcriu2
Summary: Library for CRIU
License: LGPL-2.1-only
Group: System/Libraries
%description -n libcriu2
This package contains the library for CRIU, Checkpoint/Restore In
Userspace Tools.
%package -n libcompel1
Summary: Compel library for CRIU
License: LGPL-2.1-only
Group: System/Libraries
%description -n libcompel1
This package contains the compel library for CRIU to execute a parasite code.
%package devel
Summary: Include Files and Libraries mandatory for Development
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libcompel1 = %{version}
Requires: libcriu2 = %{version}
%description devel
This package contains all necessary include files and libraries needed
to develop applications with CRIU library.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
# default off
echo "BINFMT_MISC_VIRTUALIZED" > .config
%build
export CFLAGS="%{optflags}"
%ifarch %arm
export CFLAGS="$CFLAGS -Wno-error=deprecated"
%endif
# WERROR=0 is needed for avoiding warning due to doubly _GNU_SOURCE defines
make V=1 %{?_smp_mflags} %{?make_options} WERROR=0 \
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
LIBEXECDIR=%{_libexecdir}
%install
%make_install V=1 %{?make_options} WERROR=0 \
PREFIX=%{_prefix} \
LIBDIR=%{_libdir} \
LIBEXECDIR=%{_libexecdir}
# remove static libs
rm -f %{buildroot}%{_libdir}/lib*.a \
%{buildroot}%{_libexecdir}/compel/*.a
# remove stable files
rm -f %{buildroot}%{_includedir}/compel/plugins/std/asm/.gitignore
# for compatiblity
ln -s criu %{buildroot}%{_sbindir}/crtools
ln -s criu.8 %{buildroot}%{_mandir}/man8/crtools.8
%if ! %{with_amdgpu_plugin}
rm -f %{buildroot}%{_mandir}/man1/amdgpu_plugin.1
%endif
%post -n libcriu2 -p /sbin/ldconfig
%postun -n libcriu2 -p /sbin/ldconfig
%post -n libcompel1 -p /sbin/ldconfig
%postun -n libcompel1 -p /sbin/ldconfig
%files
%license COPYING
%doc README.md
%{_sbindir}/criu
%{_sbindir}/criu-ns
%{_sbindir}/crtools
%{_bindir}/compel
%{_bindir}/crit
%{_mandir}/man1/compel.1%{?ext_man}
%{_mandir}/man1/crit.1%{?ext_man}
%{_mandir}/man1/criu-ns.1%{?ext_man}
%{_mandir}/man8/criu.8%{?ext_man}
%{_mandir}/man8/crtools.8%{?ext_man}
%{_libexecdir}/criu
%{_libexecdir}/compel
%{python3_sitelib}/crit-*.egg-info
%{python3_sitelib}/pycriu
%if %{with_amdgpu_plugin}
%files plugin-amdgpu
%doc plugins/amdgpu/README.md
%{_mandir}/man1/amdgpu_plugin.1%{?ext_man}
%dir %{_libdir}/criu
%{_libdir}/criu/amdgpu_plugin.so
%endif
%files -n libcriu2
%{_libdir}/libcriu.so.*
%files -n libcompel1
%{_libdir}/libcompel.so.*
%files devel
%{_includedir}/criu
%{_includedir}/compel
%{_libdir}/libcriu.so
%{_libdir}/libcompel.so
%{_libdir}/pkgconfig/*.pc
%changelog

43
plugin-dir-path.patch Normal file
View File

@ -0,0 +1,43 @@
---
Makefile.install | 3 ++-
criu/Makefile | 3 +++
criu/include/plugin.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
--- a/Makefile.install
+++ b/Makefile.install
@@ -5,9 +5,10 @@ BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbin
MANDIR ?= $(PREFIX)/share/man
INCLUDEDIR ?= $(PREFIX)/include
+LIBDIR ?= $(PREFIX)/lib
LIBEXECDIR ?= $(PREFIX)/libexec
RUNDIR ?= /run
-PLUGINDIR ?= $(PREFIX)/lib/criu
+PLUGINDIR ?= $(LIBDIR)/criu
#
# For recent Debian/Ubuntu with multiarch support.
--- a/criu/include/plugin.h
+++ b/criu/include/plugin.h
@@ -6,7 +6,7 @@
#include "common/list.h"
#ifndef CR_PLUGIN_DEFAULT
-#define CR_PLUGIN_DEFAULT "/usr/lib/criu/"
+#define CR_PLUGIN_DEFAULT LIBDIR "/criu/"
#endif
void cr_plugin_fini(int stage, int err);
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -29,6 +29,9 @@ CFLAGS += -iquote $(ARCH_DIR)/include
CFLAGS += -iquote .
CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-3.0)
CFLAGS += $(CONFIG-DEFINES)
+CFLAGS += -DINCLUDEDIR=\"$(INCLUDEDIR)\"
+CFLAGS += -DLIBEXECDIR=\"$(LIBEXECDIR)\"
+CFLAGS += -DLIBDIR=\"$(LIBDIR)\"
ifeq ($(GMON),1)
CFLAGS += -pg