oe-debuginfod 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env python3
  2. #
  3. # Copyright OpenEmbedded Contributors
  4. #
  5. # SPDX-License-Identifier: MIT
  6. #
  7. import os
  8. import sys
  9. scripts_path = os.path.dirname(os.path.realpath(__file__))
  10. lib_path = scripts_path + "/lib"
  11. sys.path.insert(0, lib_path)
  12. import scriptpath
  13. scriptpath.add_bitbake_lib_path()
  14. import bb.tinfoil
  15. import subprocess
  16. import argparse
  17. if __name__ == "__main__":
  18. p = argparse.ArgumentParser()
  19. p.add_argument("-d", action='store_true', \
  20. help="store debuginfod files in project sub-directory")
  21. args = p.parse_args()
  22. with bb.tinfoil.Tinfoil() as tinfoil:
  23. tinfoil.prepare(config_only=True)
  24. package_classes_var = "DEPLOY_DIR_" + tinfoil.config_data.getVar("PACKAGE_CLASSES").split()[0].replace("package_", "").upper()
  25. feed_dir = tinfoil.config_data.getVar(package_classes_var, expand=True)
  26. opts = [ '--verbose', '-R', '-U', feed_dir ]
  27. if args.d:
  28. fdir = os.path.join(os.getcwd(), 'oedid-files')
  29. os.makedirs(fdir, exist_ok=True)
  30. opts += [ '-d', os.path.join(fdir, 'did.sqlite') ]
  31. subprocess.call(['bitbake', '-c', 'addto_recipe_sysroot', 'elfutils-native'])
  32. subprocess.call(['oe-run-native', 'elfutils-native', 'debuginfod'] + opts)
  33. # we should not get here
  34. print("\nTo use the debuginfod server please ensure that this variable PACKAGECONFIG:pn-elfutils-native = \"debuginfod libdebuginfod\" is set in the local.conf")