scripts/check-commit

38 lines
785 B
Plaintext
Raw Normal View History

2020-03-20 18:26:37 +01:00
#!/bin/sh
# 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
2020-03-20 19:07:38 +01:00
# Variables needed for tools
[ -z "${ARCH}" ] && export ARCH=x86_64
[ -z "${ACCEPT_KEYWORDS}" ] && export ACCEPT_KEYWORDS='**'
2020-03-20 18:26:37 +01:00
# Use pkgchek
pkgcheck scan --commits
# 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
if cd $(dirname "${file}"); then
echo
echo "Directory $(pwd):"
repoman -Idix
cd - >/dev/null
fi
done