如何解决:文件/目录已安装,但未在任何软件包中提供:



使用我的存储库修改配方后,重建后出现此错误。 如何解决这个问题? .log:

ERROR: phosphor-user-manager-1.0+gitAUTOINC+5a6e836a71-r1  do_package: QA Issue: phosphor-user-manager: Files/directories were installed but not shipped in any package:
/dbus-1
/usr/share
/usr/share/phosphor-certificate-manager
/usr/share/phosphor-certificate-manager/nslcd
/dbus-1/system.d
/dbus-1/system.d/phosphor-nslcd-cert-config.conf
/lib/systemd/system/multi-user.target.wants
/lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@nslcd.service
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
phosphor-user-manager: 8 installed and not shipped files. [installed-vs-shipped]
ERROR: phosphor-user-manager-1.0+gitAUTOINC+5a6e836a71-r1 do_package: Fatal QA errors found, failing task.
ERROR: Logfile of failure stored in: /home/openbmc/build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-user-manager/1.0+gitAUTOINC+5a6e836a71-r1/temp/log.do_package.224136
ERROR: Task (/home/openbmc/meta-phosphor/recipes-phosphor/users/phosphor-user-manager_git.bb:do_package) failed with exit code '1'

了解问题及其原因很好。

Yocto的每个食谱都有自己的${WORKDIR}路径。

在该路径下,BitbakeSRC_URI在开始执行下一个任务(例如配置、编译、...等。

现在,在获得输出后,您需要将其安装到最终rootfs中。

安装过程是使用${D}变量在do_install任务中完成的。

${D}指向${WORKDIR}/image.

假设您的配方编译了一个C程序,其输出hello二进制的。

现在,您将它安装到您的 rootfs 中,如下所示/usr/bin

do_install() {
install -d ${D}${bindir}
cp ${WORKDIR}/hello ${D}${bindir}
}

现在,执行do_install后,${D}${bindir}将包含hello

之后,包过程do_package将获取${D}/usr/bin内部的内容并将其添加到最终的配方包中,即${WORKDIR}内的package目录。

现在,问题将出现。

打包过程将仅获取与配方相关的FILES变量中的内容,有关FILES的更多信息,请单击此处。

如果它发现文件夹中存在${D}FILES_${PN}中未指定的某些内容,它将给出该错误。

因此,为了解决此问题,您只需要将${D}的所有内容添加到FILES_${PN}变量中。

此外,您还可以指定软件包的类型(dbgdocdevptest、...)。

示例:如果您的配方提供二进制文件、man文档和库文件,您可以像这样组织它:

do_install(){
install -d ${D}${bindir}
install -d ${D}/usr/include/helloLib
install -d ${D}/usr/share/man/man1/
cp ${WORKDIR}/build/hello ${D}${bindir}
cp ${WORKDIR}/build/lib_files ${D}/usr/include/helloLib
cp ${WORKDIR}/doc/hello.1 ${D}/usr/share/man/man1
}

对于${bindir}和其他适当的路径变量,请检查此项。

现在,我们${D}image文件夹包含:

/
  • usr/bin/hello
  • /
  • usr/include/helloLib/hello_lib.h(或许多其他)
  • /
  • usr/share/man/man1/hello.1

您可以像这样指定它们来FILES_${PN}

FILES_${PN} = "/usr/bin/* /usr/include/helloLib/* /usr/share/*"

或:

FILES_${PN}-doc = "/usr/share/man/man1/*"
FILES_${PN}-dev = "/usr/inlcude/helloLib/*"
FILES_${PN}     = "/usr/bin/*"

将所有指定的项目从FILES收集到package文件夹中后,将根据您的PACKAGE_CLASSES变量启动包类型过程,该变量可以是package_rpmpackage_debpackage_tarpackage_ipk,更多信息在这里。

最后,让我们了解如何收集最终图像。

image配方执行do_rootfs,这将创建系统的最终根。

它会遍历IMAGE_INSTALLIMAGE_FEATURES、.. 等中的所有配方,并为每个配方输入${WORKDIR}目录,并收集所有创建的软件包,并将它们安装到最终的 rootfs 中。

如果您使用的是新版本的Yocto,这将有所帮助:FILES:${PN} ="name"目录不发货";在旧版本中,它是FILES_${PN}.

所以你的答案应该是:FILES:${PN}= "/dbus-1 /usr/share /lib/systemd/"

最新更新