In a number of places it would be helpful to be able to copy trees of files using hardlinks. This turns out to be harder than you'd expect since there is no good single command that does this well and handles all file types correctly.
Abstracting this into a function therefore makes sense, cpio seems as good an option as any other. We do require two passes due to the way cpio handles symbolic links. Signed-off-by: Richard Purdie <[email protected]> --- diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index 0a533af..91895ec 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -292,6 +292,17 @@ END chmod +x $cmd } +# Copy files/directories from $1 to $2 but using hardlinks +# Have to do this in two passes to handle symbolic links correctly due to +# the way cpio handles this combination of options. +hardlinkdir () { + from=$1 + to=$2 + (cd $from; find . -print0 | cpio --null -pdlu $to) + (cd $from; find . -type l -print0 | cpio -pd0mLu --no-preserve-owner $to) +} + + def check_app_exists(app, d): app = d.expand(app) path = d.getVar('PATH', d, True) -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
