labgrid icon indicating copy to clipboard operation
labgrid copied to clipboard

remote/client: implement udisks2-using write-files command

Open a3f opened this issue 2 years ago • 3 comments
trafficstars

Description

Adds a write-files client command to copy files onto mass storage. This is useful for bootloader development for processors with bootroms that load code from file systems (e.g. EFI system partition, OMAP, AT91, Zynq, Raspberry ... etc.). The user interface tries to reproduce the semantics of the UNIX cp command as much as possible.

As of now, we can only copy individual files, but not recursively on directories; in the future we might want to extend the ManagedFile class to support this use case as well.

This is mostly based on @sephalon's #548, with some sprinkles of my #820, but with udisksctl instead of pmount.

How to test

labgrid-client write-files a b      # writes files a, b into /mnt/
labgrid-client write-files -t a b c # writes files b, c into /mnt/a/
labgrid-client write-files -T a b   # writes file  b      to /mnt/a

Checklist

  • [x] Documentation for the feature
  • [ ] Tests for the feature
  • [x] The arguments and description in doc/configuration.rst have been updated
  • [x] CHANGES.rst has been updated
  • [x] PR has been tested
  • [x] Man pages have been regenerated

a3f avatar Jun 25 '23 11:06 a3f

Codecov Report

Attention: Patch coverage is 16.56051% with 131 lines in your changes are missing coverage. Please review.

Project coverage is 62.2%. Comparing base (6c8c6e5) to head (a712ee2).

Files Patch % Lines
labgrid/util/agents/udisks2.py 0.0% 70 Missing :warning:
labgrid/driver/usbstoragedriver.py 24.5% 43 Missing :warning:
labgrid/remote/client.py 40.0% 18 Missing :warning:
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1219     +/-   ##
========================================
- Coverage    62.7%   62.2%   -0.6%     
========================================
  Files         163     164      +1     
  Lines       12051   12191    +140     
========================================
+ Hits         7560    7584     +24     
- Misses       4491    4607    +116     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 25 '23 11:06 codecov[bot]

Hi Ahmad, the idea for the feature looks great, however we would very much prefer a solution which uses the udisks2 DBus API with the agent interface. The regex may not work across versions and the DBus interface should be much more stable.

Emantor avatar Jun 27 '23 14:06 Emantor

The case-insensitive regexes are only used for error recovery and if they don't match, they would just bubble up the error. The only hard requirement is the Mounted %s at %s message. But yes, using udiskctl in scripts is inferior to pmount. I have reworked the PR to do DBus in an agent. Looking forward to your feedback.

a3f avatar Jun 28 '23 13:06 a3f

Rebased on latest master and added a few fixups. With those applied, I'm all for finally merging this PR.

@a3f @sephalon Are those fixups okay with you?

Bastian-Krause avatar Mar 23 '24 15:03 Bastian-Krause

Thanks, @Bastian-Krause! Changes look ok to me.

a3f avatar Mar 24 '24 16:03 a3f

Fixups squashed.

Bastian-Krause avatar Mar 25 '24 09:03 Bastian-Krause