Bug 5246

Summary: Variable dependency parsing does not handle braces within functions well
Product: [Build System, Metadata & Runtime] BitBake Reporter: Paul Eggleton <bluelightning>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: poky.bs.watcher, poky.watcher, sgw
Version: 1.5   
Target Milestone: 1.5 M5   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Paul Eggleton 2013-09-20 14:10:03 UTC
meta/recipes-qt/qt4/qt4-x11-free.inc has some sed expressions that try to replace ${...} references in scripts; however in jumping through hoops to avoid actual ${...} references in the function itself it contains some unclosed {. These don't cause any problems except when it comes to determining the dependencies for the function - the parser chokes on them resulting in somewhat broken task dependencies:

[':g\' $pc\n\tdone\n\n\t#Append an E to the qtdemo file\n\tif [ -n "" ] ; then\n\t\t[ -f /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/bin/qtdemo ] && mv /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/bin/qtdemo /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/bin/qtdemo\n\tfi\n\n\tscript="/home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image//usr/share/qt4/environment-setup"\n\ttouch $script\n\techo \'export QT_DIR_NAME=qt4\' >> $script\n\techo \'export QT_LIBINFIX=\' >> $script\n\techo \'export OE_QMAKE_AR=ar\' >> $script\n\techo \'export OE_QMAKE_CC=gcc\' >> $script\n\techo \'export OE_QMAKE_CXX=g++\' >> $script\n\techo \'export OE_QMAKE_LINK=g++\' >> $script\n\techo \'export OE_QMAKE_LIBDIR_QT=/usr/lib\' >> $script\n\techo \'export OE_QMAKE_INCDIR_QT=/usr/include/qt4\' >> $script\n\techo \'export OE_QMAKE_MOC=/usr/bin/moc\' >> $script\n\techo \'export OE_QMAKE_UIC=/usr/bin/uic\' >> $script\n\techo \'export OE_QMAKE_UIC3=/usr/bin/uic3\' >> $script\n\techo \'export OE_QMAKE_RCC=/usr/bin/rcc\' >> $script\n\techo \'export OE_QMAKE_QDBUSCPP2XML=/usr/bin/qdbuscpp2xml\' >> $script\n\techo \'export OE_QMAKE_QDBUSXML2CPP=/usr/bin/qdbusxml2cpp\' >> $script\n\techo \'export OE_QMAKE_QT_CONFIG=/usr/share/qt4/mkspecs/qconfig.pri\' >> $script\n\techo \'export QMAKESPEC=/usr/share/qt4/mkspecs/linux-g++\' >> $script\n\tchmod 0755 $script\n  # fix pkgconfig, libtool and prl files\n  sed -i -e \'s#I/usr/include#Iincludedir', 'ABIEXTENSION', 'AR', 'AS', 'ASNEEDED', 'BPN', 'BUILD_AR', 'BUILD_ARCH', 'BUILD_AS', 'BUILD_AS_ARCH', 'BUILD_CC', 'BUILD_CCLD', 'BUILD_CC_ARCH', 'BUILD_CFLAGS', 'BUILD_CPP', 'BUILD_CPPFLAGS', 'BUILD_CXX', 'BUILD_CXXFLAGS', 'BUILD_F77', 'BUILD_LD', 'BUILD_LDFLAGS', 'BUILD_LD_ARCH', 'BUILD_NM', 'BUILD_OPTIMIZATION', 'BUILD_OS', 'BUILD_PREFIX', 'BUILD_RANLIB', 'BUILD_STRIP', 'BUILD_SYS', 'BUILD_VENDOR', 'CC', 'CCLD', 'CFLAGS', 'CPP', 'CPPFLAGS', 'CXX', 'CXXFLAGS', 'D', 'DEBUG_BUILD', 'DEBUG_FLAGS', 'DEBUG_OPTIMIZATION', 'DEFAULTTUNE', 'EXTENDPE', 'EXTRA_OEMAKE', 'F77', 'FULL_OPTIMIZATION', 'HOST_AS_ARCH', 'HOST_CC_ARCH', 'HOST_LD_ARCH', 'HOST_PREFIX', 'LC_ALL', 'LD', 'LDFLAGS', 'LIBCEXTENSION', 'LINKER_HASH_STYLE', 'MAKE', 'MULTIMACH_TARGET_SYS', 'NM', 'OBJCOPY', 'OBJDUMP', 'OE_QMAKE_AR', 'OE_QMAKE_CC', 'OE_QMAKE_CFLAGS', 'OE_QMAKE_CXX', 'OE_QMAKE_CXXFLAGS', 'OE_QMAKE_INCDIR_QT', 'OE_QMAKE_LCONVERT', 'OE_QMAKE_LDFLAGS', 'OE_QMAKE_LIBDIR_QT', 'OE_QMAKE_LIBS_QT', 'OE_QMAKE_LIBS_X11', 'OE_QMAKE_LIBS_X11SM', 'OE_QMAKE_LINK', 'OE_QMAKE_LRELEASE', 'OE_QMAKE_LUPDATE', 'OE_QMAKE_MOC', 'OE_QMAKE_QDBUSCPP2XML', 'OE_QMAKE_QDBUSXML2CPP', 'OE_QMAKE_QMAKE', 'OE_QMAKE_QT_CONFIG', 'OE_QMAKE_RCC', 'OE_QMAKE_RPATH', 'OE_QMAKE_STRIP', 'OE_QMAKE_UIC', 'OE_QMAKE_UIC3', 'OE_QMAKE_XMLPATTERNS', 'PACKAGE_ARCH', 'PATCH_GET', 'PE', "PE\\x7d_'][int(d.getVar('PE',1) or 0) > 0]", 'PKG_CONFIG_DIR', 'PKG_CONFIG_DISABLE_UNINSTALLED', 'PKG_CONFIG_LIBDIR', 'PKG_CONFIG_PATH', 'PKG_CONFIG_SYSROOT_DIR', 'PN', 'PR', 'PSEUDO_DISABLED', 'PV', 'QMAKESPEC', 'QT_BASE_NAME', 'QT_CONF_PATH', 'QT_DIR_NAME', 'QT_LIBINFIX', 'QT_LIB_NAMES', 'RANLIB', 'S', 'SELECTED_OPTIMIZATION', 'SPECIAL_PKGSUFFIX', 'STAGING_BASE_LIBDIR_NATIVE', 'STAGING_BINDIR_NATIVE', 'STAGING_DATADIR', 'STAGING_DIR', 'STAGING_DIR_NATIVE', 'STAGING_INCDIR', 'STAGING_INCDIR_NATIVE', 'STAGING_LIBDIR', 'STAGING_LIBDIR_NATIVE', 'STRINGS', 'STRIP', 'TARGET_ARCH', 'TARGET_AS_ARCH', 'TARGET_CC_ARCH', 'TARGET_CFLAGS', 'TARGET_CPPFLAGS', 'TARGET_CXXFLAGS', 'TARGET_LDFLAGS', 'TARGET_LD_ARCH', 'TARGET_LINK_HASH_STYLE', 'TARGET_OS', 'TARGET_PREFIX', 'TARGET_SYS', 'TARGET_VENDOR', 'TOOLCHAIN_OPTIONS', 'TUNE_ARCH', 'TUNE_ASARGS', 'TUNE_CCARGS', 'TUNE_FEATURES', 'TUNE_FEATURES_tune-x86-64', 'TUNE_LDARGS', 'TUNE_PKGARCH', 'TUNE_PKGARCH_tune-x86-64', 'WORKDIR', 'X86ARCH32', 'X86ARCH64', 'base_bindir', 'base_libdir', 'base_libdir_native', 'base_prefix', 'base_prune_suffix', 'base_sbindir', 'baselib', 'bbfatal', 'bbnote', 'bindir', 'bindir_native', 'datadir', 'die', 'do_install[fakeroot]', 'do_install[umask]', 'docdir', 'exec_prefix', 'in#g\' \\\n    /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/lib/*.la /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/lib/*.prl /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/lib/pkgconfig/*.pc\n\n  # QT abuses $includedir to point to its headers, which breaks pkgconfig sysroot, so\n  # manually fix it up here:\n  for pc in /home/buildbot/poky/build2/tmp/work/x86_64-poky-linux/qt4-x11-free/4.8.5-r0/image/usr/lib/pkgconfig/*.pc ; do\n    sed -i -e "s:prefix', 'includedir', 'includedir_native', 'infodir', 'libdir', 'libdir_native', 'libexecdir', 'localstatedir', 'mandir', 'name', 'nonarch_base_libdir', 'oe_runmake', 'oldincludedir', 'prefix', 'prefix_native', 'sbindir', 'servicedir', 'sharedstatedir', 'sysconfdir', 'systemd_unitdir']


Apart from being ugly this has caused problems with sstate rebuilds where the garbage values change.
Comment 1 Richard Purdie 2013-09-21 10:07:01 UTC
This is actually quite serious once you get into it. I've a fix queued.