poky: qmmp_0.5.2.bb的问题以及修改方法。

在升级qmmp的过程中,遇到了下面的错误:

 WARNING: For recipe qmmp, the following files were installed but not shipped in any package:
| WARNING:   /usr/lib/qmmp/FileDialogs/libqmmpfiledialog.so
| WARNING:   /usr/lib/qmmp/FileDialogs/.debug/libqmmpfiledialog.so
| WARNING:   /usr/lib/qmmp/Engines/libmplayer.so
| WARNING:   /usr/lib/qmmp/Engines/.debug/libmplayer.so
| WARNING:   /usr/lib/qmmp/Effect/libstereo.so
| WARNING:   /usr/lib/qmmp/Effect/libladspa.so
....
| ERROR: QA Issue: non -dev/-dbg/-nativesdk package contains symlink .so: qmmp path '/work/i586-poky-linux/qmmp-0.5.1-r0/packages-split/qmmp/usr/lib/libqmmpui.so'
| ERROR: QA Issue: non -dev/-dbg/-nativesdk package contains symlink .so: qmmp path '/work/i586-poky-linux/qmmp-0.5.1-r0/packages-split/qmmp/usr/lib/libqmmp.so'

上面的WARNING错误是说:这些文件已经在image 的里面了,但是打包(打成rpm包的格式),的时候,却没有这些文件。

ERROR:意思是,在非dev,dbg,nativesdk的包的形式中,有了链接。比如:

在qmmp-0.5.2-r0.rpm这就是非qmmp-dev-0.5.2.r0.rpm qmmp-dbg-0.5.2.r0.rpm,qmmp-nativesdk-r0.0.5.2.rpm等等。它是把/usr/bin以及/usr/lib/*的资源打到这个包里面。

在原来的bb文件是这样的。

FILES_${PN} = "${bindir}/qmmp ${libdir}/*.so* \
               ${libdir}/qmmp/PlaylistFormats/*.so \
               ${libdir}/qmmp/Output/libalsa.so \
               ${libdir}/qmmp/Transports/libhttp.so \
               ${libdir}/qmmp/Visual/libanalyzer.so \
               ${datadir}/icons/* \
               ${datadir}/qmmp/images/* \
               ${datadir}/applications/qmmp.desktop \

这个在过来的版本是没有问题的,但是在最新的版本中,不允许这样做了。因为${bindir}和${libdir}是工具本身会去做的。不用在重新做。在do_package_qa中,会有一个函数来判断,是不是在收包的目录里有,链接库*.so,如果有就产生了ERROR,具体为什么这么做,还不知道,以后待研究。

如果想要放置带链接库,那么用lib*${SOLIBS}的形式。

QAPATHTEST[dev-so] = "package_qa_check_dev"
def package_qa_check_dev(path, name, d, elf, messages):
    """
    Check for ".so" library symlinks in non-dev packages
    """

    if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-nativesdk") and path.endswith(".so") and os.path.islink(path):
        messages.append("non -dev/-dbg/-nativesdk package contains symlink .so: %s path '%s'" % \
                 (name, package_qa_clean_path(path,d)))

所以,正确的写法如下:

FILES_${PN} =+ "\
               ${libdir}/qmmp/*/*.so \
               ${datadir}/icons/* \
               ${datadir}/qmmp/images/* \
               ${datadir}/applications/qmmp.desktop "

如果是,${bindir},${libdir}/* 以外的我们需要手工的加入,比如${libdir}/qmmp/*/*.so,因为,qmmp/*/*.so 不是${libdir}下的资源。

FILES_${PN}-dbg += "\
                ${libdir}/qmmp/*/.debug/* \

               “

还有一个问题就是如何将/usr/lib/qmmp下的库文件,打成每个文件都拥有自己的一个包。

用do_split_packge  函数

用法:

PACKAGES_DYNAMIC += "qmmp-plugin-*"


python populate_packages_prepend () {
        qmmp_libdir = bb.data.expand('${libdir}/qmmp', d)
        do_split_packages(d, qmmp_libdir, '^lib(.*)\.so$', 'qmmp-plugin-%s', 'Qmmp %s Plugin for', recursive=True,extra_depends='')
}

I find .debug can't be packaged to rpm package because it is invisible directory. In current OE-core .debug was shipped to FILES_${PN}-dbg, for example , gtk+ ,qt4-x11-free
If we want to split up .debug/* to single package, we can rename .debug to debug to make this directory visible, then debug directory can be split up to single package.
Please review the following two mode.

Mode 1: Ship  .debug to   FILES_${PN}-dbg

PACKAGES_DYNAMIC = "qmmp-plugin-* "


python populate_packages_prepend () {
        import os
        qmmp_libdir = bb.data.expand('${libdir}/qmmp', d)
        gd = bb.data.expand('${D}/${libdir}/qmmp', d)
        plug_dirs = os.listdir(gd)
# for makeing  do_split_package for each grouping and name them correctly
# qmmp-plugin--  with the Description: Qmmp plugin for %s"
# I use the following method.

        for plug_dir in plug_dirs:
                g_plug_dir = os.path.join(qmmp_libdir,plug_dir)
                do_split_packages(d, g_plug_dir, '^lib(.*)\.so$', 'qmmp-plugin-' + plug_dir + '-%s', 'Qmmp' + plug_dir  + 'plugin for %s')



}

# if I don't point files to ship file to ${PN}, then FILE_${PN} will get files in usr/lib/qmmp and qmmp-plug-* will not get files.
FILES_${PN} = "\
                ${bindir}/qmmp \
                ${libdir}/lib*${SOLIBS} \
                ${datadir}/icons/* \
                ${datadir}/qmmp/images/* \
                ${datadir}/applications/* \
                "

FILES_${PN}-dbg += "\
                ${libdir}/qmmp/*/.debug/* \
               "
=================================================================================

Mode 2: Split up  .debug to sub-packages


PACKAGES_DYNAMIC = "qmmp-plugin-* qmmp-debug-plugin-*"


python populate_packages_prepend () {
        import os
        qmmp_libdir = bb.data.expand('${libdir}/qmmp', d)
        qmmp_pkgd = bb.data.expand('${WORKDIR}/package/${libdir}/qmmp', d)
        gd = bb.data.expand('${D}/${libdir}/qmmp', d)
        plug_dirs = os.listdir(gd)

        for plug_dir in plug_dirs:
                #rename .debug to debug
                if os.path.exists( qmmp_pkgd + '/'  + plug_dir + '/.debug'):
                        os.rename(qmmp_pkgd + '/' + plug_dir + '/.debug',qmmp_pkgd + '/' + plug_dir + '/debug')
                g_plug_dir = os.path.join(qmmp_libdir,plug_dir)
                do_split_packages(d, g_plug_dir, '^lib(.*)\.so$', 'qmmp-plugin-' + plug_dir + '-%s', 'Qmmp' + plug_dir  + 'plugin for %s')
                #split up .debug to sub-packages
                g_plug_debug_dir = os.path.join(g_plug_dir,'debug')
                do_split_packages(d, g_plug_debug_dir, '^lib(.*)\.so$', 'qmmp-debug-plugin-' + plug_dir + '-%s', 'Qmmp' + plug_dir  + 'plugin debug for %s')
}

# if I don't point files to ship file to ${PN}, then FILE_${PN} will get files in usr/lib/qmmp and qmmp-plug-* will not get files.
  I check gtk+ and qt4-x11-free and find that they adopt the following method without using default mode.

FILES_${PN} = "\
                ${bindir}/qmmp \
                ${libdir}/lib*${SOLIBS} \
                ${datadir}/icons/* \
                ${datadir}/qmmp/images/* \
                ${datadir}/applications/* \

你可能感兴趣的:(Poky)