How to recursively set the directory structure in an OpenEmbedded BitBake recipe?

I would like to simplify the BitBake recipe, which installs a large directory structure using some recursive installation procedure, rather than invoking the installation many times. The layout of the source directory often changes during development, which causes far more changes to the recipes than I want to have.

As an example, the following do_install () will be simplified:

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 } 

For something more like this pseudo code:

 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 } 

The top-level directories in our source files (foo and bar in the example above) rarely change, so calling them in the recipe is ok. These are low-level directories that change frequently.

It is possible that cp -r ends up with what you need, but I think I read that it frowned at BitBake recipes, so I wonder if BitBake can use an alternative mechanism, or if there are some other reasonably standardized ways to do this.

+4
source share
2 answers

We did it like this:

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

The canonical form in OE is

 cp -R --no-dereference --preserve=mode,links -v SOURCE DESTINATION 

see the answer here (although they look slightly different in code, questions are semantically equivalent)

+2
source

All Articles