Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Yocto Project layer check tool wrapper |
| 4 | # |
| 5 | # Creates a temporary build directory to run the yocto-check-layer |
| 6 | # script to avoid a contaminated environment. |
| 7 | # |
| 8 | # Copyright (C) 2017 Intel Corporation |
| 9 | # Released under the MIT license (see COPYING.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 | |
| 16 | # since we are using a temp directory, use the realpath for output |
| 17 | # log option |
| 18 | output_log='' |
| 19 | while getopts o: name |
| 20 | do |
| 21 | case $name in |
| 22 | o) output_log=$(realpath "$OPTARG") |
| 23 | esac |
| 24 | done |
| 25 | shift $(($OPTIND - 1)) |
| 26 | |
| 27 | # generate a temp directory to run check layer script |
| 28 | base_dir=$(realpath $BUILDDIR/../) |
| 29 | cd $base_dir |
| 30 | |
| 31 | build_dir=$(mktemp -p $base_dir -d -t build-XXXX) |
| 32 | |
Andrew Geissler | 99467da | 2019-02-25 18:54:23 -0600 | [diff] [blame] | 33 | this_dir=$(dirname $(readlink -f $0)) |
| 34 | |
| 35 | source $this_dir/../oe-init-build-env $build_dir |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | if [[ $output_log != '' ]]; then |
| 37 | yocto-check-layer -o "$output_log" "$*" |
| 38 | else |
| 39 | yocto-check-layer "$@" |
| 40 | fi |
| 41 | retcode=$? |
| 42 | |
| 43 | rm -rf $build_dir |
| 44 | |
| 45 | exit $retcode |