1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-08 21:11:54 +01:00

target: Add Target.{push,pull}(globbing=False) parameter

When globbing=True, the source is interpreted as a globbing pattern on
the target and is expanded before pulling the files or folders.

This also aligns the behaviour of all targets:
    * adb connection was supported a limited form of globbing by default
      (only on the last component of the path)
    * SCP was supporting a limited form of globbing
    * GEM5 was not supporting globbing at all
    * paramiko was not supporting globbing at all

Also fix a race condition on push/pull as root, where pushing/pulling
the same file from multiple threads would have ended up using the same
temporary file.
This commit is contained in:
douglas-raillard-arm
2020-06-16 11:56:25 +01:00
committed by Marc Bonnici
parent 07bbf902ba
commit 24e6de67ae
6 changed files with 259 additions and 131 deletions

View File

@@ -218,7 +218,7 @@ Target
operations during reboot process to detect if the reboot has failed and
the device has hung.
.. method:: Target.push(source, dest [,as_root , timeout])
.. method:: Target.push(source, dest [,as_root , timeout, globbing])
Transfer a file from the host machine to the target device.
@@ -227,8 +227,12 @@ Target
:param as_root: whether root is required. Defaults to false.
:param timeout: timeout (in seconds) for the transfer; if the transfer does
not complete within this period, an exception will be raised.
:param globbing: If ``True``, the ``source`` is interpreted as a globbing
pattern instead of being take as-is. If the pattern has mulitple
matches, ``dest`` must be a folder (or will be created as such if it
does not exists yet).
.. method:: Target.pull(source, dest [, as_root, timeout])
.. method:: Target.pull(source, dest [, as_root, timeout, globbing])
Transfer a file from the target device to the host machine.
@@ -237,6 +241,10 @@ Target
:param as_root: whether root is required. Defaults to false.
:param timeout: timeout (in seconds) for the transfer; if the transfer does
not complete within this period, an exception will be raised.
:param globbing: If ``True``, the ``source`` is interpreted as a globbing
pattern instead of being take as-is. If the pattern has mulitple
matches, ``dest`` must be a folder (or will be created as such if it
does not exists yet).
.. method:: Target.execute(command [, timeout [, check_exit_code [, as_root [, strip_colors [, will_succeed [, force_locale]]]]]])