1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-03-04 17:27:51 +00:00

target: Copy symlinks as files when pulling

When pulling a file from the target, copy all paths as files and follow
symlinks if necessary. That fixes issues related to chmod not working on
symlinks and generally allows getting any path.

If we want to one day preserve symlinks in some capacities, we can
always add an option to Target.pull() to do so.
This commit is contained in:
Douglas Raillard 2024-11-20 16:41:34 +00:00 committed by Marc Bonnici
parent df1b5ef4a2
commit 1efcfed63f

View File

@ -899,7 +899,7 @@ class Target(object):
for sources, dest in mapping.items(): for sources, dest in mapping.items():
for source in sources: for source in sources:
async with self._xfer_cache_path(source) as device_tempfile: async with self._xfer_cache_path(source) as device_tempfile:
await self.execute.asyn("cp -r -- {} {}".format(quote(source), quote(device_tempfile)), as_root=as_root) await self.execute.asyn("cp -rL -- {} {}".format(quote(source), quote(device_tempfile)), as_root=as_root)
await self.execute.asyn("{} chmod 0644 -- {}".format(self.busybox, quote(device_tempfile)), as_root=as_root) await self.execute.asyn("{} chmod 0644 -- {}".format(self.busybox, quote(device_tempfile)), as_root=as_root)
do_pull([device_tempfile], dest) do_pull([device_tempfile], dest)
else: else: