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