yocto-check-layer-wrapper 957 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #
  9. # SPDX-License-Identifier: MIT
  10. #
  11. if [ -z "$BUILDDIR" ]; then
  12. echo "Please source oe-init-build-env before run this script."
  13. exit 2
  14. fi
  15. # since we are using a temp directory, use the realpath for output
  16. # log option
  17. output_log=''
  18. while getopts o: name
  19. do
  20. case $name in
  21. o) output_log=$(realpath "$OPTARG")
  22. esac
  23. done
  24. shift $(($OPTIND - 1))
  25. # generate a temp directory to run check layer script
  26. base_dir=$(realpath $BUILDDIR/../)
  27. cd $base_dir
  28. build_dir=$(mktemp -p $base_dir -d -t build-XXXX)
  29. this_dir=$(dirname $(readlink -f $0))
  30. source $this_dir/../oe-init-build-env $build_dir
  31. if [[ $output_log != '' ]]; then
  32. yocto-check-layer -o "$output_log" "$*"
  33. else
  34. yocto-check-layer "$@"
  35. fi
  36. retcode=$?
  37. rm -rf $build_dir
  38. exit $retcode