mirror of
https://github.com/ARM-software/devlib.git
synced 2025-09-01 17:41: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:
committed by
Marc Bonnici
parent
07bbf902ba
commit
24e6de67ae
@@ -21,25 +21,25 @@ they do not derive from a common base. Instead, a :class:`Connection` is any
|
||||
class that implements the following methods.
|
||||
|
||||
|
||||
.. method:: push(self, source, dest, timeout=None)
|
||||
.. method:: push(self, sources, dest, timeout=None)
|
||||
|
||||
Transfer a file from the host machine to the connected device.
|
||||
Transfer a list of files from the host machine to the connected device.
|
||||
|
||||
:param source: path of to the file on the host
|
||||
:param dest: path of to the file on the connected device.
|
||||
:param timeout: timeout (in seconds) for the transfer; if the transfer does
|
||||
not complete within this period, an exception will be raised.
|
||||
:param sources: list of paths on the host
|
||||
:param dest: path to the file or folder on the connected device.
|
||||
:param timeout: timeout (in seconds) for the transfer of each file; if the
|
||||
transfer does not complete within this period, an exception will be
|
||||
raised.
|
||||
|
||||
.. method:: pull(self, source, dest, timeout=None)
|
||||
.. method:: pull(self, sources, dest, timeout=None)
|
||||
|
||||
Transfer a file, or files matching a glob pattern, from the connected device
|
||||
to the host machine.
|
||||
Transfer a list of files from the connected device to the host machine.
|
||||
|
||||
:param source: path of to the file on the connected device. If ``dest`` is a
|
||||
directory, may be a glob pattern.
|
||||
:param dest: path of to the file on the host
|
||||
:param timeout: timeout (in seconds) for the transfer; if the transfer does
|
||||
not complete within this period, an exception will be raised.
|
||||
:param sources: list of paths on the connected device.
|
||||
:param dest: path to the file or folder on the host
|
||||
:param timeout: timeout (in seconds) for the transfer for each file; if the
|
||||
transfer does not complete within this period, an exception will be
|
||||
raised.
|
||||
|
||||
.. method:: execute(self, command, timeout=None, check_exit_code=False, as_root=False, strip_colors=True, will_succeed=False)
|
||||
|
||||
|
@@ -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]]]]]])
|
||||
|
||||
|
Reference in New Issue
Block a user