b4-wrapper-bitbake.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python3
  2. #
  3. # Copyright OpenEmbedded Contributors
  4. #
  5. # SPDX-License-Identifier: MIT
  6. #
  7. # This script is to be called by b4:
  8. # - through b4.send-auto-cc-cmd with "send-auto-cc-cmd" as first argument,
  9. #
  10. # When send-auto-cc-cmd is passed:
  11. #
  12. # This returns the list of Cc recipients for a patch.
  13. #
  14. # This script takes as stdin a patch.
  15. import subprocess
  16. import sys
  17. cmd = sys.argv[1]
  18. if cmd != "send-auto-cc-cmd":
  19. sys.exit(-1)
  20. patch = sys.stdin.read()
  21. if subprocess.call(["which", "lsdiff"], stdout=subprocess.DEVNULL) != 0:
  22. print("lsdiff missing from host, please install patchutils")
  23. sys.exit(-1)
  24. files = subprocess.check_output(["lsdiff", "--strip-match=1", "--strip=1", "--include=doc/*"],
  25. input=patch, text=True)
  26. if len(files):
  27. print("docs@lists.yoctoproject.org")
  28. else:
  29. # Handle patches made with --no-prefix
  30. files = subprocess.check_output(["lsdiff", "--include=doc/*"],
  31. input=patch, text=True)
  32. if len(files):
  33. print("docs@lists.yoctoproject.org")
  34. sys.exit(0)