如何在OpenEmbedded BitBake配方中递归安装目录结构? [英] How to install directory structure recursively in OpenEmbedded BitBake recipe?

查看:114
本文介绍了如何在OpenEmbedded BitBake配方中递归安装目录结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想简化BitBake食谱,该食谱通过使用某种递归安装例程而不是多次调用install来安装大型目录结构.在开发过程中,源目录的布局经常发生变化,这导致配方的修订远远超过我想要处理的版本.

I'd like to simplify a BitBake recipe that installs a large directory structure by using some sort of recursive install routine rather than calling install many times. The source directory layout is frequently changing during development, which is causing far more recipe revisions than I want to deal with.

作为示例,如何将以下do_install()简化为这样:

As an example, how would the following do_install() be simplified from this:

do_install() {
    install -d ${D}/foo
    install -m 0644 ${S}/foo/*.* ${D}/foo

    install -d ${D}/foo/a
    install -m 0644 ${S}/foo/a/*.* ${D}/foo/a

    install -d ${D}/foo/b
    install -m 0644 ${S}/foo/b/*.* ${D}/foo/b

    install -d ${D}/foo/c
    install -m 0644 ${S}/foo/c/*.* ${D}/foo/c

    install -d ${D}/bar
    install -m 0644 ${S}/bar/*.* ${D}/bar

    install -d ${D}/bar/a
    install -m 0644 ${S}/bar/a/*.* ${D}/bar/a

    install -d ${D}/bar/a/bananas
    install -m 0644 ${S}/bar/a/bananas/*.* ${D}/bar/a/bananas
}

更类似于此伪代码:

do_install() {
    for each subdir in ${S}/foo/
        install subdir recursively to ${D}/foo/subdir
    end

    for each subdir in ${S}/bar/
        install subdir recursively to ${D}/bar/subdir
    end
}

我们的源文件中的顶级目录(上例中的foo& bar)很少更改,因此可以在配方中将它们调出即可.经常更改的是较低级别的目录.

The top-level directories in our source files (foo & bar in the above example) rarely change, so calling them out in the recipe is fine. It's the lower level directories that are frequently changing.

可能是cp -r最终成为解决之道,但我相信我已经读过它在BitBake食谱中不赞成使用,所以我想知道BitBake是否提供了一些替代机制,或者是否有 其他一些合理的标准化方法可以做到这一点.

It may be that cp -r ends up being the way to go, but I believe I've read that it's frowned upon in BitBake recipes, so I'm wondering if BitBake provides some alternate mechanism, or if there's some other reasonably standardized way to do this.

推荐答案

我们过去通常是这样进行的:

We used to do it in that way:

do_install() {
find ${WORKDIR}/ -type f -exec 'install -m 0755 "{}" ${D}/var/www/' \;
}

这篇关于如何在OpenEmbedded BitBake配方中递归安装目录结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆