diff options
Diffstat (limited to 'recipes-containers')
-rw-r--r-- | recipes-containers/criu/criu_git.bb | 44 | ||||
-rw-r--r-- | recipes-containers/criu/files/0003-crit-pycriu-build-and-install-wheels.patch | 75 |
2 files changed, 108 insertions, 11 deletions
diff --git a/recipes-containers/criu/criu_git.bb b/recipes-containers/criu/criu_git.bb index 7cadda24..c4539e34 100644 --- a/recipes-containers/criu/criu_git.bb +++ b/recipes-containers/criu/criu_git.bb | |||
@@ -19,11 +19,12 @@ PV = "3.19.0+git" | |||
19 | SRC_URI = "git://github.com/checkpoint-restore/criu.git;branch=master;protocol=https \ | 19 | SRC_URI = "git://github.com/checkpoint-restore/criu.git;branch=master;protocol=https \ |
20 | file://0001-criu-Skip-documentation-install.patch \ | 20 | file://0001-criu-Skip-documentation-install.patch \ |
21 | file://0002-criu-Change-libraries-install-directory.patch \ | 21 | file://0002-criu-Change-libraries-install-directory.patch \ |
22 | file://0003-crit-pycriu-build-and-install-wheels.patch \ | ||
22 | " | 23 | " |
23 | 24 | ||
24 | COMPATIBLE_HOST = "(x86_64|arm|aarch64).*-linux" | 25 | COMPATIBLE_HOST = "(x86_64|arm|aarch64).*-linux" |
25 | 26 | ||
26 | DEPENDS += "libnl libcap protobuf-c-native protobuf-c util-linux-native libbsd libnet python3-pip-native" | 27 | DEPENDS += "libnl libcap protobuf-c-native protobuf-c util-linux-native libbsd libnet" |
27 | RDEPENDS:${PN} = "bash cgroup-lite" | 28 | RDEPENDS:${PN} = "bash cgroup-lite" |
28 | 29 | ||
29 | S = "${WORKDIR}/git" | 30 | S = "${WORKDIR}/git" |
@@ -40,7 +41,7 @@ EXTRA_OEMAKE:aarch64 += "ARCH=aarch64 WERROR=0" | |||
40 | EXTRA_OEMAKE:append = " SBINDIR=${sbindir} LIBDIR=${libdir} INCLUDEDIR=${includedir} PIEGEN=no" | 41 | EXTRA_OEMAKE:append = " SBINDIR=${sbindir} LIBDIR=${libdir} INCLUDEDIR=${includedir} PIEGEN=no" |
41 | EXTRA_OEMAKE:append = " LOGROTATEDIR=${sysconfdir} SYSTEMDUNITDIR=${systemd_unitdir}" | 42 | EXTRA_OEMAKE:append = " LOGROTATEDIR=${sysconfdir} SYSTEMDUNITDIR=${systemd_unitdir}" |
42 | 43 | ||
43 | CFLAGS += "-D__USE_GNU -D_GNU_SOURCE " | 44 | CFLAGS += "-D__USE_GNU -D_GNU_SOURCE " |
44 | 45 | ||
45 | CFLAGS += " -I${STAGING_INCDIR} -I${STAGING_INCDIR}/libnl3" | 46 | CFLAGS += " -I${STAGING_INCDIR} -I${STAGING_INCDIR}/libnl3" |
46 | CFLAGS:arm += "-D__WORDSIZE" | 47 | CFLAGS:arm += "-D__WORDSIZE" |
@@ -53,7 +54,8 @@ export BUILD_SYS | |||
53 | export HOST_SYS | 54 | export HOST_SYS |
54 | export HOSTCFLAGS = "${BUILD_CFLAGS}" | 55 | export HOSTCFLAGS = "${BUILD_CFLAGS}" |
55 | 56 | ||
56 | inherit setuptools3 | 57 | inherit python_setuptools_build_meta |
58 | #inherit setuptools3 | ||
57 | inherit pkgconfig | 59 | inherit pkgconfig |
58 | 60 | ||
59 | B = "${S}" | 61 | B = "${S}" |
@@ -71,27 +73,47 @@ do_compile:prepend() { | |||
71 | ln -s ${PKG_CONFIG_SYSROOT_DIR}/usr/include/google/protobuf/descriptor.proto ${S}/images/google/protobuf/descriptor.proto | 73 | ln -s ${PKG_CONFIG_SYSROOT_DIR}/usr/include/google/protobuf/descriptor.proto ${S}/images/google/protobuf/descriptor.proto |
72 | } | 74 | } |
73 | 75 | ||
76 | #PEP517_SOURCE_PATH ="${S}/lib" | ||
77 | |||
78 | #do_compile[network] = "1" | ||
79 | |||
74 | do_compile () { | 80 | do_compile () { |
75 | oe_runmake FULL_PYTHON=${PYTHON} PYTHON=python3 | 81 | #python_pep517_do_compile |
82 | #export PEP517_SOURCE_PATH="${S}/crit" | ||
83 | #python_pep517_do_compile | ||
84 | #oe_runmake | ||
85 | #oe_runmake #PIP_BREAK_SYSTEM_PACKAGES=1 | ||
86 | export PEP517_WHEEL_PATH="${PEP517_WHEEL_PATH}" | ||
87 | oe_runmake FULL_PYTHON=${PYTHON} PYTHON=nativepython3 | ||
76 | } | 88 | } |
77 | 89 | ||
90 | #do_install[network] = "1" | ||
91 | |||
78 | do_install () { | 92 | do_install () { |
79 | export INSTALL_LIB="${libdir}/${PYTHON_DIR}/site-packages" | 93 | export INSTALL_LIB="${libdir}/${PYTHON_DIR}/site-packages" |
80 | oe_runmake PREFIX=${exec_prefix} LIBDIR=${libdir} DESTDIR="${D}" PLUGINDIR="${localstatedir}/lib" FULL_PYTHON=${PYTHON} PYTHON=python3 install | 94 | export PEP517_WHEEL_PATH="${PEP517_WHEEL_PATH}" |
95 | #oe_runmake PREFIX=${exec_prefix} LIBDIR=${libdir} DESTDIR="${D}" PLUGINDIR="${localstatedir}/lib" PIP_BREAK_SYSTEM_PACKAGES=1 install | ||
96 | oe_runmake PREFIX=${exec_prefix} LIBDIR=${libdir} DESTDIR="${D}" PLUGINDIR="${localstatedir}/lib" FULL_PYTHON=${PYTHON} PYTHON=nativepython3 install | ||
81 | 97 | ||
82 | # python3's distutils has a feature of rewriting the interpeter on setup installed | 98 | # python3's distutils has a feature of rewriting the interpeter on setup installed |
83 | # scripts. 'crit' is one of those scripts. The "executable" or "e" option to the | 99 | # scripts. 'crit' is one of those scripts. The "executable" or "e" option to the |
84 | # setup call should fix it, but it is being ignored. So to avoid getting our native | 100 | # setup call should fix it, but it is being ignored. So to avoid getting our native |
85 | # intepreter replaced in the script, we'll do an explicit update ourselves. | 101 | # intepreter replaced in the script, we'll do an explicit update ourselves. |
86 | sed -i 's%^\#\!.*%\#\!/usr/bin/env python3%' ${D}/usr/bin/crit ${D}${libdir}/python3*/site-packages/crit-*-py3*.egg/EGG-INFO/scripts/crit | 102 | # |
87 | 103 | # we're building wheels now, so EGG-INFO need not apply | |
88 | rm -rf ${D}/__pycache__ | 104 | #sed -i 's%^\#\!.*%\#\!/usr/bin/env python3%' ${D}/usr/bin/crit ${D}${libdir}/python3*/site-packages/crit-*-py3*.egg/EGG-INFO/scripts/crit |
105 | |||
106 | # all the __pycache__ contains references to TMPDIR and these will be built the first time | ||
107 | # it runs on the target anyway | ||
108 | for pycachedir in $(find ${D} -name __pycache__); do | ||
109 | rm -rf $pycachedir | ||
110 | done | ||
89 | } | 111 | } |
90 | 112 | ||
91 | FILES:${PN} += "${systemd_unitdir}/ \ | 113 | FILES:${PN} += "${systemd_unitdir}/ \ |
92 | ${libdir}/python3*/site-packages/ \ | 114 | #${libdir}/python3*/site-packages/ \ |
93 | ${libdir}/pycriu/ \ | 115 | #${libdir}/pycriu/ \ |
94 | ${libdir}/crit-0.0.1-py3*.egg-info \ | 116 | #${libdir}/crit-0.0.1-py3*.egg-info \ |
95 | " | 117 | " |
96 | 118 | ||
97 | FILES:${PN}-staticdev += " \ | 119 | FILES:${PN}-staticdev += " \ |
diff --git a/recipes-containers/criu/files/0003-crit-pycriu-build-and-install-wheels.patch b/recipes-containers/criu/files/0003-crit-pycriu-build-and-install-wheels.patch new file mode 100644 index 00000000..2da96f44 --- /dev/null +++ b/recipes-containers/criu/files/0003-crit-pycriu-build-and-install-wheels.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From 40d2f0735d668dca893a5f0e787f1f11af74cf25 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tim Orling <tim.orling@konsulko.com> | ||
3 | Date: Fri, 1 Mar 2024 22:22:37 -0800 | ||
4 | Subject: [PATCH] crit/pycriu: build and install wheels | ||
5 | |||
6 | Rather than using heavy handed pip (which requires network access to | ||
7 | fetch the index), mimic what we do in python_pep517.bbclass do_compile | ||
8 | and do_install for both crit/ and lib/pycriu | ||
9 | |||
10 | Signed-off-by: Tim Orling <tim.orling@konsulko.com> | ||
11 | --- | ||
12 | crit/Makefile | 8 ++++++-- | ||
13 | lib/Makefile | 11 +++++++++-- | ||
14 | 2 files changed, 15 insertions(+), 4 deletions(-) | ||
15 | |||
16 | diff --git a/crit/Makefile b/crit/Makefile | ||
17 | index 9a856db6d..9b36f4be1 100644 | ||
18 | --- a/crit/Makefile | ||
19 | +++ b/crit/Makefile | ||
20 | @@ -1,5 +1,7 @@ | ||
21 | PYTHON_EXTERNALLY_MANAGED := $(shell $(PYTHON) -c 'import os, sysconfig; print(int(os.path.isfile(os.path.join(sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED"))))') | ||
22 | PIP_BREAK_SYSTEM_PACKAGES := 0 | ||
23 | +PEP517_SOURCE_PATH := ./crit | ||
24 | +PEP517_BUILD_OPTS := | ||
25 | |||
26 | VERSION_FILE := $(if $(obj),$(addprefix $(obj)/,crit/version.py),crit/version.py) | ||
27 | |||
28 | @@ -16,11 +18,13 @@ ifeq ($(PIP_BREAK_SYSTEM_PACKAGES),0) | ||
29 | $(E) " Consider using PIP_BREAK_SYSTEM_PACKAGES=1 make install" | ||
30 | else | ||
31 | $(E) " INSTALL " crit | ||
32 | - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./crit | ||
33 | + $(Q) $(PYTHON) -m build --no-isolation --wheel --outdir $(PEP517_WHEEL_PATH) $(PEP517_SOURCE_PATH) $(PEP517_BUILD_OPTS) | ||
34 | endif | ||
35 | else | ||
36 | + $(E) " BUILD " crit | ||
37 | + $(Q) $(PYTHON) -m build --no-isolation --wheel --outdir $(PEP517_WHEEL_PATH) $(PEP517_SOURCE_PATH) $(PEP517_BUILD_OPTS) | ||
38 | $(E) " INSTALL " crit | ||
39 | - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./crit | ||
40 | + $(Q) $(PYTHON) -m installer $(INSTALL_WHEEL_COMPILE_BYTECODE) --interpreter "$(USRBINPATH)/env $(PEP517_INSTALL_PYTHON)" --destdir=$(DESTDIR) $(PEP517_WHEEL_PATH)/crit-*.whl | ||
41 | endif | ||
42 | .PHONY: install | ||
43 | |||
44 | diff --git a/lib/Makefile b/lib/Makefile | ||
45 | index ae371e78e..b5f147482 100644 | ||
46 | --- a/lib/Makefile | ||
47 | +++ b/lib/Makefile | ||
48 | @@ -1,6 +1,9 @@ | ||
49 | CRIU_SO := libcriu.so | ||
50 | CRIU_A := libcriu.a | ||
51 | UAPI_HEADERS := lib/c/criu.h images/rpc.proto images/rpc.pb-c.h criu/include/version.h | ||
52 | +PEP517_SOURCE_PATH := ./lib | ||
53 | +PEP517_BUILD_OPTS := | ||
54 | +INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0" | ||
55 | |||
56 | all-y += lib-c lib-a lib-py | ||
57 | |||
58 | @@ -63,11 +66,15 @@ ifeq ($(PIP_BREAK_SYSTEM_PACKAGES),0) | ||
59 | $(E) " Consider using PIP_BREAK_SYSTEM_PACKAGES=1 make install" | ||
60 | else | ||
61 | $(E) " INSTALL " pycriu | ||
62 | - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./lib | ||
63 | + $(Q) $(PYTHON) -m build --no-isolation --wheel --outdir $(PEP517_WHEEL_PATH) $(PEP517_SOURCE_PATH) $(PEP517_BUILD_OPTS) | ||
64 | endif | ||
65 | else | ||
66 | + $(E) " BUILD " pycriu | ||
67 | + $(Q) $(PYTHON) -m build --no-isolation --wheel --outdir $(PEP517_WHEEL_PATH) $(PEP517_SOURCE_PATH) $(PEP517_BUILD_OPTS) | ||
68 | $(E) " INSTALL " pycriu | ||
69 | - $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./lib | ||
70 | + #nativepython3 -m installer ${INSTALL_WHEEL_COMPILE_BYTECODE} --interpreter "${USRBINPATH}/env ${PEP517_INSTALL_PYTHON}" --destdir=${D} ${PEP517_WHEEL_PATH}/*.whl | ||
71 | + | ||
72 | + $(Q) $(PYTHON) -m installer $(INSTALL_WHEEL_COMPILE_BYTECODE) --interpreter "$(USRBINPATH)/env $(PEP517_INSTALL_PYTHON)" --destdir=$(DESTDIR) $(PEP517_WHEEL_PATH)/pycriu-*.whl | ||
73 | endif | ||
74 | .PHONY: install | ||
75 | |||