mirror of
https://git.yoctoproject.org/poky
synced 2026-04-18 03:32:13 +02:00
devtool: deploy: fix preservation of symlinks and permissions/ownership
It turns out that scp can't be used to copy symlinks because it follows them instead of copying them, and this is by design (since it emulates rcp which also behaved this way); the unfortunate result is that symlinks that point to valid files on the host translate into the host file being copied to the target (yuck). The simplest alternative that does not have this undesirable behaviour is to use tar and pipe it over ssh. At the same time, it would be even better if we properly reflect file permissions and ownership on the target that have been established within the pseudo environment. We can do this by executing the copy process under pseudo, which turns out to be quite easy with access to the pseudo environment set up by the build system. Fixes [YOCTO #7868]. (From OE-Core rev: 69adaed0e982d627ebfa57b360b0ee049ea7a276) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
e22c18113b
commit
2054b29dd7
@@ -19,7 +19,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
import logging
|
||||
from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
|
||||
from devtool import exec_fakeroot, setup_tinfoil, DevtoolError
|
||||
|
||||
logger = logging.getLogger('devtool')
|
||||
|
||||
@@ -73,9 +73,13 @@ def deploy(args, config, basepath, workspace):
|
||||
extraoptions = ''
|
||||
if args.no_host_check:
|
||||
extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
|
||||
if not args.show_status:
|
||||
if args.show_status:
|
||||
tarextractopts = 'xv'
|
||||
else:
|
||||
tarextractopts = 'x'
|
||||
extraoptions += ' -q'
|
||||
ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True)
|
||||
# We cannot use scp here, because it doesn't preserve symlinks
|
||||
ret = exec_fakeroot(rd, 'tar cf - . | ssh %s %s \'tar %s -C %s -f -\'' % (extraoptions, args.target, tarextractopts, destdir), cwd=recipe_outdir, shell=True)
|
||||
if ret != 0:
|
||||
raise DevtoolError('Deploy failed - rerun with -s to get a complete '
|
||||
'error message')
|
||||
|
||||
Reference in New Issue
Block a user