From c04392ec859c7233b8bc9f4e280d0aed8ebd9d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Wed, 11 Mar 2020 23:59:18 +0100 Subject: [PATCH] lv2-turtle-helper: handle inifite qemu runs as error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit distrho-ports ttl generation with qemu has alway been pain: For unknown reasons some plugins caues qemu to run infinite. Up to now we could ignore particular plugins by adding them to LV2_PLUGIN_BLACKLIST_QEMU} but since the affected plugins change from time to time maintaining this turned into pain. So handle infinit qemu runs as error. To achive we: * add qemu-with-timeout-native which injects coreutils' 'timeout' into command line by creatin wrappers for all qemu-* available * rework qemu-ext-musicians.bbclass (was renamed to avoid conflicts with meta-qt5-extra's qemu-ext) * rework lv2-turtle-helper.bbclass and adjust logs Signed-off-by: Andreas Müller --- classes/lv2-turtle-helper.bbclass | 28 +++++++++---------- ...ext.bbclass => qemu-ext-musicians.bbclass} | 10 +++++-- .../calf-studio-gear/calf_git.bb | 2 +- recipes-musicians/carla/carla_git.bb | 2 +- recipes-musicians/distrho/distrho-ports.bb | 7 ----- recipes-musicians/drumgizmo/drumgizmo.bb | 2 +- recipes-musicians/helm/helm_git.bb | 2 +- recipes-musicians/hydrogen/hydrogen_git.bb | 2 +- recipes-musicians/lsp-plugins/lsp-plugins.bb | 2 +- recipes-musicians/zyn/zyn.inc | 2 +- .../qemu-with-timeout-native_0.1.bb | 19 +++++++++++++ 11 files changed, 47 insertions(+), 31 deletions(-) rename classes/{qemu-ext.bbclass => qemu-ext-musicians.bbclass} (61%) create mode 100644 recipes-support/qemu-with-timeout/qemu-with-timeout-native_0.1.bb diff --git a/classes/lv2-turtle-helper.bbclass b/classes/lv2-turtle-helper.bbclass index e4960c1..de69893 100644 --- a/classes/lv2-turtle-helper.bbclass +++ b/classes/lv2-turtle-helper.bbclass @@ -29,10 +29,7 @@ LV2_POSTINST_MANIFEST = "${datadir}/${BPN}/lv2-postinst-manifest" # (added by git-submodule) we can set a default matchin > 80%+ LV2_TTL_GENERATOR ?= "${S}/dpf/utils/lv2_ttl_generator" -# For some plugins qemu never finishes so we need a blacklist -LV2_PLUGIN_BLACKLIST_QEMU ?= "" - -inherit qemu-ext audio-plugin-common +inherit qemu-ext-musicians audio-plugin-common # override this function and execute sed (or other magic) to adjust Makefiles # so that lv2-ttl-generator is not executed but plugin information. Same here: @@ -54,30 +51,33 @@ do_compile_prepend() { rm -f ${LV2_PLUGIN_POSTINST_INFO_FILE} } -do_compile[vardeps] += "LV2_PLUGIN_BLACKLIST_QEMU LV2_TTL_GENERATOR" +do_compile[vardeps] += "LV2_TTL_GENERATOR" do_compile_append() { rm -f ${LV2_PLUGIN_INFO_FILE_CLEANED} if [ -e ${LV2_PLUGIN_INFO_FILE} ]; then - echo "lv2-plugins found - try ttl-generation with '${LV2_TTL_GENERATOR}" + echo + echo "---------- start of lv2 ttl generation ----------" + echo "lv2-plugins found - try ttl-generation with LV2_TTL_GENERATOR: '${LV2_TTL_GENERATOR}'" # try build ttl-files with quemu for sofile in `sort ${LV2_PLUGIN_INFO_FILE} | uniq`; do echo $sofile >> ${LV2_PLUGIN_INFO_FILE_CLEANED} sobase=`basename $sofile` ttl_failed="" - if echo "${LV2_PLUGIN_BLACKLIST_QEMU}" | grep -q "$sobase"; then - echo "$sobase found in blacklist - postpone ttl-genaration to ontarget postinst" - ttl_failed="true" - fi if [ "x${ttl_failed}" = "x" ]; then cd `dirname ${sofile}` echo "QEMU lv2-ttl-generator for ${sofile}..." - ${@qemu_run_binary_local(d, '${STAGING_DIR_TARGET}', '${LV2_TTL_GENERATOR}')} ${sofile} || ttl_failed="true" + ${@qemu_run_binary_local(d, '${STAGING_DIR_TARGET}', '${LV2_TTL_GENERATOR}')} ${sofile} || ttl_failed="$?" if [ "x${ttl_failed}" = "x" ]; then echo "Generation succeeded." else - # If qemu fails: remove generated core files & prepare for postinst fallback - echo "ERROR: for QEMU ${LV2_TTL_GENERATOR} for ${sofile} failed!" - rm -f *.core + if [ "x${ttl_failed}" = "x124" ]; then + echo "ERROR: ttl-generation for `basename ${sofile}` timed out!" + else + echo "ERROR: ttl-generation for `basename ${sofile}` failed!" + echo "LV2_TTL_GENERATOR set correctly - check few lines above?" + # qemu failed: remove generated core files + rm -f *.core + fi fi fi if [ "x${ttl_failed}" != "x" ]; then diff --git a/classes/qemu-ext.bbclass b/classes/qemu-ext-musicians.bbclass similarity index 61% rename from classes/qemu-ext.bbclass rename to classes/qemu-ext-musicians.bbclass index f016281..1996f67 100644 --- a/classes/qemu-ext.bbclass +++ b/classes/qemu-ext-musicians.bbclass @@ -1,6 +1,6 @@ inherit qemu -DEPENDS += "qemu-native" +DEPENDS_append = " qemu-native qemu-with-timeout-native coreutils-native" # This is an extended/modified qemu.bbclass tailored four our needs: # @@ -11,12 +11,16 @@ DEPENDS += "qemu-native" # not yet installed. # * A recipe can set an extra library path in 'QEMU_EXTRA_LIBDIR'. This path is # an absolute path. +# * To catch infine qemu runs we make use of qemu-with-timeout-native which +# hand timeouts as errors def qemu_run_binary_local(data, rootfs_path, binary): libdir = rootfs_path + data.getVar("libdir") base_libdir = rootfs_path + data.getVar("base_libdir") extra_libdir = data.getVar("QEMU_EXTRA_LIBDIR") + if extra_libdir: - return qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir, extra_libdir]) + binary + cmdline = qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir, extra_libdir]) + binary else: - return qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir]) + binary + cmdline = qemu_wrapper_cmdline(data, rootfs_path, [libdir, base_libdir]) + binary + return cmdline.replace(qemu_target_binary(data), qemu_target_binary(data) + '-timeout') diff --git a/recipes-musicians/calf-studio-gear/calf_git.bb b/recipes-musicians/calf-studio-gear/calf_git.bb index 324950f..b913ea9 100644 --- a/recipes-musicians/calf-studio-gear/calf_git.bb +++ b/recipes-musicians/calf-studio-gear/calf_git.bb @@ -17,7 +17,7 @@ SRCREV = "e5c08dc2483c444d18d24a37c395274002320f5c" S = "${WORKDIR}/git" PV = "0.90.1" -inherit autotools-brokensep pkgconfig gtk-icon-cache bash-completion qemu-ext +inherit autotools-brokensep pkgconfig gtk-icon-cache bash-completion qemu-ext-musicians DEPENDS += " \ gtk+ \ diff --git a/recipes-musicians/carla/carla_git.bb b/recipes-musicians/carla/carla_git.bb index 13730ae..52fd996 100644 --- a/recipes-musicians/carla/carla_git.bb +++ b/recipes-musicians/carla/carla_git.bb @@ -17,7 +17,7 @@ PV = "2.0.0+git${SRCPV}" REQUIRED_DISTRO_FEATURES = "x11" -inherit qmake5_base pkgconfig qemu-ext features_check mime mime-xdg gtk-icon-cache +inherit qmake5_base pkgconfig qemu-ext-musicians features_check mime mime-xdg gtk-icon-cache B = "${S}" diff --git a/recipes-musicians/distrho/distrho-ports.bb b/recipes-musicians/distrho/distrho-ports.bb index 774d1df..a73bb8a 100644 --- a/recipes-musicians/distrho/distrho-ports.bb +++ b/recipes-musicians/distrho/distrho-ports.bb @@ -47,13 +47,6 @@ DEPENDS += " \ LV2_TTL_GENERATOR = "${B}/libs/lv2_ttl_generator" -LV2_PLUGIN_BLACKLIST_QEMU = " \ - drowaudio-tremolo.so \ - drumsynth.so \ - eqinox.so \ - HiReSam.so \ -" - do_ttl_sed() { # keep unmodified scripts for distrho-ports-extra cp -r ${S}/scripts ${WORKDIR} diff --git a/recipes-musicians/drumgizmo/drumgizmo.bb b/recipes-musicians/drumgizmo/drumgizmo.bb index 6c90a1d..2687399 100644 --- a/recipes-musicians/drumgizmo/drumgizmo.bb +++ b/recipes-musicians/drumgizmo/drumgizmo.bb @@ -1,6 +1,6 @@ require ${BPN}.inc -inherit autotools-brokensep pkgconfig features_check gtk-icon-cache qemu-ext +inherit autotools-brokensep pkgconfig features_check gtk-icon-cache qemu-ext-musicians REQUIRED_DISTRO_FEATURE = "x11" diff --git a/recipes-musicians/helm/helm_git.bb b/recipes-musicians/helm/helm_git.bb index fb64566..a65dd8e 100644 --- a/recipes-musicians/helm/helm_git.bb +++ b/recipes-musicians/helm/helm_git.bb @@ -3,7 +3,7 @@ HOMEPAGE = "http://tytel.org/helm/" LICENSE = "GPLv3" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" -inherit dos2unix qemu-ext features_check gtk-icon-cache pack_audio_plugins mime-xdg +inherit dos2unix qemu-ext-musicians features_check gtk-icon-cache pack_audio_plugins mime-xdg REQUIRED_DISTRO_FEATURES = "x11" diff --git a/recipes-musicians/hydrogen/hydrogen_git.bb b/recipes-musicians/hydrogen/hydrogen_git.bb index 37d2706..b4dfde3 100644 --- a/recipes-musicians/hydrogen/hydrogen_git.bb +++ b/recipes-musicians/hydrogen/hydrogen_git.bb @@ -86,7 +86,7 @@ SRC_URI = " \ https://freewavesamples.com/files/YamahaRX15Kit.h2drumkit;downloadfilename=YamahaRX15Kit.tar.gz;name=YamahaRX15Kit;subdir=drumkits \ https://freewavesamples.com/files/YamahaTG-55Kit.h2drumkit;downloadfilename=YamahaTG-55Kit.tar.gz;name=YamahaTG-55Kit;subdir=drumkits \ " -SRCREV = "e317548515bfc64b973f873b47fa6c1f8df73297" +SRCREV = "9dfab9acc576e6bbe99e6f519d948d16094a6509" PV ="1.0.0~beta1+git${SRCPV}" S = "${WORKDIR}/git" diff --git a/recipes-musicians/lsp-plugins/lsp-plugins.bb b/recipes-musicians/lsp-plugins/lsp-plugins.bb index 987bd7e..cdc871b 100644 --- a/recipes-musicians/lsp-plugins/lsp-plugins.bb +++ b/recipes-musicians/lsp-plugins/lsp-plugins.bb @@ -1,6 +1,6 @@ require ${BPN}.inc -inherit features_check pack_audio_plugins qemu-ext +inherit features_check pack_audio_plugins qemu-ext-musicians REQUIRED_DISTRO_FEATURES = "x11" diff --git a/recipes-musicians/zyn/zyn.inc b/recipes-musicians/zyn/zyn.inc index f04d0d7..3b70a87 100644 --- a/recipes-musicians/zyn/zyn.inc +++ b/recipes-musicians/zyn/zyn.inc @@ -2,7 +2,7 @@ HOMEPAGE = "http://zynaddsubfx.sourceforge.net" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=21fa88a5e50a1c608d22612c1fbe1971" -inherit cmake qemu-ext pkgconfig gtk-icon-cache features_check pack_audio_plugins +inherit cmake qemu-ext-musicians pkgconfig gtk-icon-cache features_check pack_audio_plugins REQUIRED_DISTRO_FEATURES = "x11" diff --git a/recipes-support/qemu-with-timeout/qemu-with-timeout-native_0.1.bb b/recipes-support/qemu-with-timeout/qemu-with-timeout-native_0.1.bb new file mode 100644 index 0000000..0d8a4d1 --- /dev/null +++ b/recipes-support/qemu-with-timeout/qemu-with-timeout-native_0.1.bb @@ -0,0 +1,19 @@ +SUMMARY = "qemu wrapper: add timout to qemu for infinite loop situations" +LICENSE = "MIT" +IC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit native + +DEPENDS += "qemu-native" + +DEFAULT_TIMEOUT ?= "30" + +do_install() { + install -d ${D}${bindir} + for qemu in `find ${STAGING_BINDIR_NATIVE} -name qemu-*`; do + orig_name=`basename $qemu` + wrapper_name="$orig_name-timeout" + echo "timeout ${DEFAULT_TIMEOUT} $orig_name \$@" > ${D}${bindir}/$wrapper_name + chmod +x ${D}${bindir}/$wrapper_name + done +}