tree: fa5e5d0528602e071ee7d7c29b843c789d0dbb4f [path history] [tgz]
  1. .gitignore
  2. README.md
  3. __init__.py
  4. audit_source_hashes.py
  5. audit_source_hashes_unittest.py
  6. chrome_debugger.py
  7. chrome_debugger_unittest.py
  8. cpu_usage_monitor.py
  9. cpu_usage_monitor_unittest.py
  10. deps.conf
  11. deps.py
  12. diff_image.py
  13. diff_image_unittest.py
  14. disk_space.py
  15. disk_space_unittest.py
  16. download_patch.py
  17. download_patch_unittest.py
  18. factory.py
  19. factory_bug.py
  20. factory_bundle_info.py
  21. factory_diff.py
  22. finalize_bundle.py
  23. flash_netboot.py
  24. format_json_test_list.py
  25. get_version.py
  26. get_version_unittest.py
  27. ghost.py
  28. goofy_ghost/
  29. gsutil.py
  30. gsutil_unittest.py
  31. install_symlinks.py
  32. install_symlinks_unittest.py
  33. key_filter.py
  34. list_pytests.py
  35. make_par.py
  36. make_par_unittest.py
  37. make_text_image.py
  38. merge_logs.py
  39. migrate_board_dir.py
  40. migrate_board_dir_unittest.py
  41. mount_partition.py
  42. ovl.py
  43. port_fwd.py
  44. regcode.py
  45. relay_overlord_discovery_packet.py
  46. run_tests.py
  47. send_key.py
  48. sftp_uploader.py
  49. show_device_data.py
  50. smart_lint.py
  51. stream_camera.py
  52. test_list_checker.py
  53. test_make_factory_package.py
  54. testdata/
  55. thermal_monitor.py
  56. time_sanitizer.py
  57. time_sanitizer_unittest.py
  58. update_ui_status.py
  59. yaml2json.py
py/tools/README.md

Factory Tools

This folder provides tools that are useful for managing factory repo and factory flow.

download_patch.py

When we are releasing factory toolkit or bundle, sometimes, especially in early build phase, we need to cherry-pick some workarounds that haven't / cannot be merged into ToT. Manually cherry picking these workarounds is a tedious process, this tool helps you automate the process.

This tool uses topic or hashtag to filter changes on Gerrit. Each change can only have one topic but can have multiple hashtags.

Assign Topic to Changes

There are three ways you can set topic of a change:

  • Go to https://crosreview.com/<CL>, change the topic field manually.
  • repo upload -t (use branch name as topic)
  • gerrit topic abc 439944

Add Hashtags to Changes

There are three ways you can set hashtags on a change:

  • Go to https://crosreview.com/<CL>, change the hashtag field manually.
  • repo upload -o hashtag=<hashtag>
  • Command line: gerrit sethashtags <CL> tag_to_add ~tag_to_remove ...

Examples and Explanations

git stash  # you cannot cherry-pick CLs if there are unstaged changes
# First of all, download unmerged changes that fix download_patch.py.
py/tools/download_patch.py --hashtag fix-download-patch

Above command downloads changes with hashtag fix-download-patch on Gerrit in factory repository. The following things will happen:

  1. Stash all unstaged local changes.
  2. Check out cros/master (the remote master branch) of factory repo.
  3. Cherry-pick changes with hashtag fix-download-patch from Gerrit. The program tries its best to resolve dependencies between each changes.
  4. Print a summary line showing CLs that successfully downloaded and CLs that failed to download.
py/tools/download_patch.py --topic spring-factory --board spring \
    --branch factory-spring-4262.B

Above command will perform the following steps:

  1. In factory repo
    1. Check out cros/factory-spring-4262.B
    2. Cherry-pick changes with topic spring-factory on branch factory-spring-4262.B.
    3. Print a summary line
  2. In spring overlay
    1. Check out cros/factory-spring-4262.B
    2. Cherry-pick changes with topic spring-factory on branch factory-spring-4262.B.
    3. Print a summary line

If both topic and hashtag are provided, this will limit the program to download changes has given topic and given hashtag. Currently, we don't support multiple hashtags (disjunction nor conjunction).