#!/usr/bin/env bash # CI Ebuild commit tester # Run this in a overlay directory. # This script uses pkgcheck and repoman # to check the latest commit for QA issues. # Check if we are in a git repo if ! git status >/dev/null; then echo Stop exit 1 fi # Variables needed for tools [ -z "${ARCH}" ] && export ARCH=x86_64 [ -z "${ACCEPT_KEYWORDS}" ] && export ACCEPT_KEYWORDS='**' test_success=true # Use pkgchek pkgcheck scan --commits || test_success=false # Iterate through changed files in last commit # For each of these use dirname to change directory # to the one where the changed file resides # and run repoman in there for file in $(git diff --name-only HEAD HEAD~1) do commit_dir="$(dirname "${file}")" [[ "${commit_dir}" = *files ]] && continue [[ "${commit_dir}" = *eclass ]] && continue if cd "${commit_dir}"; then echo echo "Directory $(pwd):" repoman -Idix || test_success=false cd - >/dev/null || return fi done # If any of the QA tools fail the test will fail [ ${test_success} = false ] && ( echo "Exiting with failure due to previous errors..."; exit 1 )