yocto-check-layer-wrapper 921 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. # Yocto Project layer check tool wrapper
  3. #
  4. # Creates a temporary build directory to run the yocto-check-layer
  5. # script to avoid a contaminated environment.
  6. #
  7. # Copyright (C) 2017 Intel Corporation
  8. # Released under the MIT license (see COPYING.MIT)
  9. if [ -z "$BUILDDIR" ]; then
  10. echo "Please source oe-init-build-env before run this script."
  11. exit 2
  12. fi
  13. # since we are using a temp directory, use the realpath for output
  14. # log option
  15. output_log=''
  16. while getopts o: name
  17. do
  18. case $name in
  19. o) output_log=$(realpath "$OPTARG")
  20. esac
  21. done
  22. shift $(($OPTIND - 1))
  23. # generate a temp directory to run check layer script
  24. base_dir=$(realpath $BUILDDIR/../)
  25. cd $base_dir
  26. build_dir=$(mktemp -p $base_dir -d -t build-XXXX)
  27. source oe-init-build-env $build_dir
  28. if [[ $output_log != '' ]]; then
  29. yocto-check-layer -o "$output_log" "$*"
  30. else
  31. yocto-check-layer "$@"
  32. fi
  33. retcode=$?
  34. rm -rf $build_dir
  35. exit $retcode