From c140f20c4e4b0864fd46d2b60d8b4ee3830d8ff1 Mon Sep 17 00:00:00 2001 From: XGQT Date: Sun, 12 Apr 2020 01:28:10 +0200 Subject: [PATCH] check-commit: correct the exit status (was: always true) --- src/check-commit | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/check-commit b/src/check-commit index 7924ae9..7bd1c27 100755 --- a/src/check-commit +++ b/src/check-commit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # CI Ebuild commit tester @@ -19,8 +19,12 @@ fi [ -z "${ACCEPT_KEYWORDS}" ] && export ACCEPT_KEYWORDS='**' +test_success=true + + # Use pkgchek -pkgcheck scan --commits +pkgcheck scan --commits || test_success=false + # Iterate through changed files in last commit # For each of these use dirname to change directory @@ -28,10 +32,16 @@ pkgcheck scan --commits # and run repoman in there for file in $(git diff --name-only HEAD HEAD~1) do - if cd "$(dirname "${file}")"; then + commit_dir="$(dirname "${file}")" + [[ "${commit_dir}" = *files ]] && continue + [[ "${commit_dir}" = *eclass ]] && continue + if cd "${commit_dir}"; then echo echo "Directory $(pwd):" - repoman -Idix + 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 )