Files
buildroot/package/jailhouse/jailhouse.mk
Julien Olivain c808e271e3 package/jailhouse: fix build when python helper scripts are enabled
When compiling jailhouse with BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS=y,
build is failing with error:

    Traceback (most recent call last):
      File "/buildroot/output/build/jailhouse-e57d1eff6d55aeed5f977fe4e2acfb6ccbdd7560/setup.py", line 18, in <module>
        setup(name="pyjailhouse", version=version,
      File "/buildroot/output/host/lib/python3.12/site-packages/setuptools/__init__.py", line 108, in setup
        return distutils.core.setup(**attrs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ...
      File "/buildroot/output/host/lib/python3.12/sysconfig.py", line 549, in _init_posix
        _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ValueError: Empty module name

This is due to a missing dependency on the target python3 package.

Jailhouse Python scripts are using setuptools with host-python3 which
reads its sysconfig data from the target-python3. See:
https://gitlab.com/buildroot.org/buildroot/-/blob/2024.08.1/package/pkg-python.mk?ref_type=tags#L33

If the target python3 is not installed, this get expanded as an empty
string, leading to this "ValueError: Empty module name" error.

Pure Python packages which are using the python-package infrastructure
usually get this dependency automatically from:
https://gitlab.com/buildroot.org/buildroot/-/blob/2024.08.1/package/pkg-python.mk?ref_type=tags#L295

Here, the jailhouse package rather uses the generic-package
infrastructure, then installs the Python scripts (if enabled) with
dedicated macros. This is why the target python3 is needed.

This commit fixes the issue by adding this missing dependency.

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-10-28 21:48:38 +01:00

72 lines
1.9 KiB
Makefile

################################################################################
#
# jailhouse
#
################################################################################
JAILHOUSE_VERSION = e57d1eff6d55aeed5f977fe4e2acfb6ccbdd7560
JAILHOUSE_SITE = $(call github,siemens,jailhouse,$(JAILHOUSE_VERSION))
JAILHOUSE_LICENSE = GPL-2.0
JAILHOUSE_LICENSE_FILES = COPYING
JAILHOUSE_DEPENDENCIES = \
linux
JAILHOUSE_MAKE_OPTS = \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(KERNEL_ARCH)" \
KDIR="$(LINUX_DIR)" \
DESTDIR="$(TARGET_DIR)" \
prefix=/usr
ifeq ($(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),y)
JAILHOUSE_DEPENDENCIES += \
host-python-mako \
host-python-setuptools \
python3
JAILHOUSE_MAKE_OPTS += \
HAS_PYTHON_MAKO="yes" \
PYTHON_PIP_USABLE="yes"
else
JAILHOUSE_MAKE_OPTS += \
HAS_PYTHON_MAKO="no" \
PYTHON_PIP_USABLE="no"
endif
ifeq ($(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),y)
define JAILHOUSE_BUILD_HELPER_SCRIPTS
cd $(@D) && \
$(PKG_PYTHON_SETUPTOOLS_ENV) \
$(HOST_DIR)/bin/python setup.py \
build
endef
define JAILHOUSE_INSTALL_HELPER_SCRIPTS
cd $(@D) && \
$(PKG_PYTHON_SETUPTOOLS_ENV) \
$(HOST_DIR)/bin/python setup.py \
install --no-compile \
$(PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS) \
--root=$(TARGET_DIR)
endef
endif
define JAILHOUSE_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(JAILHOUSE_MAKE_OPTS) -C $(@D)
$(JAILHOUSE_BUILD_HELPER_SCRIPTS)
endef
define JAILHOUSE_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(JAILHOUSE_MAKE_OPTS) -C $(@D) modules_install firmware_install tool_inmates_install
$(TARGET_MAKE_ENV) $(MAKE) $(JAILHOUSE_MAKE_OPTS) -C $(@D)/tools src=$(@D)/tools install
$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/jailhouse
$(INSTALL) -D -m 0644 $(@D)/configs/*/*.cell $(TARGET_DIR)/etc/jailhouse
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/libexec/jailhouse/demos
$(INSTALL) -D -m 0755 $(@D)/inmates/demos/*/*.bin $(TARGET_DIR)/usr/libexec/jailhouse/demos
$(JAILHOUSE_INSTALL_HELPER_SCRIPTS)
endef
$(eval $(generic-package))